Need BAPI program to upload PO creation with flatfile having HEADER N ITEM
Hi abap experts,
I Need sample BAPI program to upload PO creation(ME21) with flatfile having HEADER AND ITEM datas.
arun
Hi,
Look at the below links
Re: BAPI_PO_CREATE1 and net price
Re: Using BAPI_PO_CREATE1 : Linking service, and account assignment
Regards
Sudheer
Similar Messages
-
BAPI or FM for geting all sales master data, header data , item data etc
Hi experts,
In my requirement i need a BAPI (or) Function module for getting all "Sales information" data means header data , item
data, scheduled data etc .
Thank you,
Dinesh Reddy.Hi,
check BAPI_SALESORDER_GETLIST
I hope it helps you....
Regards,
NaPPy -
Is there any BAPI available for sales order creation with reference?
Hi Experts,
My requirement is to create sales order with reference for order type.
Now my billing document number already contains the two items
one is correct and another is zero quantity.
I want to create order with reference of billing document but not with zero quantity item.
Which BAPI I should use and what to pass to ignore zero quantity item?
Regards,
RHHi Ronny,
Try using BAPI_SALESORDER_CREATEFROMDAT2
Regards,
Shraddha -
I need a program to do a playlist with my DVD on a projector
Hello,
I have a library of my DVD on my hardisk.
I'm searching for a program that can play a selection of my DVD (or maybe mpeg files) to show on a LCD projector linked at my mac.
there's any program to do that ?
(I'm sorry If I'm in the bad forum for that answer but I don't know exactly where to ask for)
regardsIs the isssue that you cannot get DVD Playeer to go out the output? You could place the selections as QT movies into Powerpoint (or maybe one of the Apple Apps like Keynote (have not used that) ) and output that way?
Director also has the ability to play back video, though I have never used it to play out to a LCD. (Powerpoint I have hooked up to projectors and TV and outputted that way>) -
Powershell program to upload multiple files with version control at the file level
I have a network folder which contains multiple files refreshed daily.I then run a power
shell scrip which uploads all the files . I have scheduled it to run once
daily. I have version control at the directory level , is there a way to upload all the files daily and maintain the last X versions for each file , rite now it does it at a folder level . I want it at a file level
powershell script
if((Get-PSSnapin "Microsoft.SharePoint.PowerShell") -eq $null)
Add-PSSnapin Microsoft.SharePoint.PowerShell
#Script settings
$webUrl = "http://sharepoint.contoso.com/Corporate/Sales/"
$docLibraryName = "Shared Documents"
$docLibraryUrlName = "Shared Documents\arizona" # specify your subfolder url here
$localFolderPath = "C:\Test"
#Open web and library
$web = Get-SPWeb $webUrl
write-host $webUrl
$docLibrary = $web.Lists[$docLibraryName]
write-host $docLibrary
$files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles()
write-host $files
ForEach($file in $files)
if($file.Name.Contains(".pdf"))
write-host $file
#Open file
try
$fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()
#Add file
$folder = $web.getfolder($docLibraryUrlName)
write-host "Copying file " $file.Name " to " $folder.ServerRelativeUrl "..."
$spFile = $folder.Files.Add($folder.Url + "/" + $file.Name,[System.IO.Stream]$fileStream, $true)
write-host "Success"
#Close file stream
$fileStream.Close();
catch
Write "Error: $file.name: $_" >>c:\logfile.txt
continue;
#Dispose web
$web.Dispose()Check if this helps you
http://blogs.technet.com/b/heyscriptingguy/archive/2013/04/28/weekend-scripter-use-powershell-to-upload-a-sharepoint-file-version.aspx
# Add the Snapin
Add-PSSnapin Microsoft.SharePoint.PowerShell
# Retrieve specific Site
$spWeb = Get-SPWeb http://SP01
# Create instance of Folder
$spFolder = $spWeb.GetFolder("Shared Documents")
# Get the file on Disk that we want to upload
$file = Get-Item C:\Documents\MyDoc.docx
# upload the file.
$spFolder.Files.Add("Shared Documents/MyDoc.docx",$file.OpenRead(),$false)
$newVersion = $spFolder.Files.Add($spFile.Name, $file.OpenRead(), $spFile.Author, $spFile.ModifiedBy, $spFile.TimeCreated, (Get-Date))
If this helped you resolve your issue, please mark it Answered -
In LSMW using BAPI Scenario, how to assign the same file to HEADER and ITEM
Hi,
i got a problem when we are in ASSIGN FILES step how to assign the same file to both HEADER and ITEM Structures?Hi,
When defining the file in specify files step check the option 'Data for Multiple Source Structures'.
Hope it helps.
Thanks,
Mahesh -
Need to know the name of DSO used to load Header and Item level info in LO
Hi friends ,
can some one tell me the name of DSO used to load Header and Item Level information from Data sources - 2lis_11_vahdr and 2lis_11_vaitm .
plz make it fast
ThanksHi ,
It is 0SD_O03 from 2lis_11_vahdr and 0SD_O01 & 0SD_O02 from 2lis_11_vaitm.
Bye
Dinesh -
Hi All,
I need the sample BDC or BAPI Program for Purchase Order Creations upload.
Regards
MustafaHi Mustafa,
The BAPI for PO creation is BAPI_PO_CREATE1.
Have a look at this thread.Link : [Thread|Reg BAPI_PO_CREATE1;.
Hope your query resolves quickly.
Have a best day ahead. -
BAPI-To create production orders with reference to sales order & item
Hi,
Can anyone tell me which is the best method to create open production orders?
Is there any BAPI available for creating production orders with reference to sales order & item.
I tried this BAPI "BAPI_PRODORD_CREATE".
I am getting pop up to enter serial number while executing the custom program.
Which table contains the serial number(effectivity parameters)?.I have custom screen fields on notification service!
i think a bdc is better. -
Program to upload inspection results
Hi,
for go-live, I need a program to upload inspection results in inspections lots and take usage decisions.
Can you tell me what I can use?
Thanks. JessicaNothing standard here. These are usually written ABAP programs.
I would suggest looking at how IDOC's are formatted. I beleive your programmer's should be able to find a standard process for using an IDOC to update the inspection results.
Once the results are loaded, I would use the Auto UD program or collective UD to make the UD's. Those that have off-spec results will have to be done manually. Hopefully there will only be a handful of these.
Craig -
Problem with Purchase Order creation with Random numbers .
Hi Experts
Currently i am facing an issue with Bapi BAPI_PO_CREATE1 to create Purchase order with random numbers for example items 1, 3,5.
Please let me know the settings .
Thanks in AdvanceHi Neha,
A reset of the release strategy only takes place if
- the changeability of the release indicator is set to '4' in
case of a purchase requisition and '4' or '6' in case of
another purchasing document (purchase order, request for
quotation, contract, scheduling agreement),
- the document is still subject to the previous release
strategy,
- the new TOTAL NET ORDER VALUE is higher than the old one.
The total net order value is linked to CEKKO-GNETW for a purchase order,
CEBAN-GSWRT for a purchase requisition item-wise release and CEBAN-GFWRT
for a purchase requisition overall release.
If you have maintained a Tolerance for value changes during release
(V_161S-TLFAE), the release strategy is reset when the value of the
document is higher than the percentage you have specified and if the
document is still subject to the previous release strategy.
Review the SAP note 365604 and 493900 for more
information about Release strategy.
Regards,
Ashwini. -
Need to create a mass upload program for appraisal document creation for multiple employee
Hi Expertise,
I need to create a mass upload program for appraisal document creation for manager and his multiple employee
at a time using tcode appcreate.
Please help me out.
Best regards,
PriyaranjanHi Priyaranjan,
I think you can take the abap'ers help in creating the program. But u need to provide them the exact functionality and the required specifications in creating the appraisal document.
Even tcode also u can get it prepared by Abap'ers.
Thanks and Regards
Balaji -
Hi Expertise,
I need to create a mass upload program for appraisal document creation for manager and his multiple employee
at a time using tcode appcreate.
Please help me out.
Best regards,
PriyaranjanHi,
I have done appraisal document creation for bulk using txt file.
this fm used for single for creation in standard tcode (phap_prepare): 'WZ_HRHAP_0DOC_WZ01_START'.
So create ztcode usinh this fm for single form then record BDC for this tcode and called this tcode in that bdc for bulk creation .
While recording for single I have used manual option instead of automatic . -
Hi All,
I have to create a file upload program to create service PO's with BAPI_PO_CREATE1. Please if anyone can give me a example of it it would be great.
Thanks.
MalindaHi ,
Check out this program .
use this program for creating service po's using bapi.
*& Report ZMM_PO_CREATE1 *
REPORT ZMM_PO_CREATE1 .
data : POHEADER like BAPIMEPOHEADER occurs 0 with header line,
POHEADERX like BAPIMEPOHEADERX occurs 0 with header line,
POITEM like BAPIMEPOITEM occurs 0 with header line,
POITEMX like BAPIMEPOITEMX occurs 0 with header line,
POESLLC like BAPIESLLC occurs 0 with header line,
POACCOUNT like BAPIMEPOACCOUNT occurs 0 with header line,
POACCOUNTX like BAPIMEPOACCOUNTX occurs 0 with header line,
POCONDHEADER like BAPIMEPOCONDHEADER occurs 0 with header line,
POCONDHEADERX like BAPIMEPOCONDHEADERX occurs 0 with header line,
POCOND like BAPIMEPOCOND occurs 0 with header line,
RETURN like BAPIRET2 occurs 0 with header line.
data : po_no(10).
data : begin of it_head occurs 0,
ref(10),
bsart like ekko-bsart,
lifnr like ekko-lifnr,
ekorg like ekko-ekorg,
ekgrp like ekko-ekgrp,
bukrs like ekko-bukrs,
verkf like ekko-verkf,
telf1 like ekko-telf1,
ihrez like ekko-ihrez,
unsez like ekko-unsez,
kdatb(10),
kdate(10),
end of it_head.
data : begin of it_det occurs 0,
ref(10),
knttp like ekpo-knttp,
pstyp like ekpo-pstyp,
txz01 like ekpo-txz01,
matkl like ekpo-matkl,
werks like ekpo-werks,
afnam like ekpo-afnam,
ktext1 like esll-ktext1,
srvpos like esll-srvpos,
frmval1 like esll-frmval1,
frmval2 like esll-frmval2,
menge like esll-menge,
kostl like eskn-kostl,
sakto like eskn-sakto,
zzcode like eskn-zzcode,
kbetr like konv-kbetr,
end of it_det.
data : c_col1 TYPE i VALUE '0001',
c_col2 TYPE i VALUE '0002',
c_col3 TYPE i VALUE '0003',
c_col4 TYPE i VALUE '0004',
c_col5 TYPE i VALUE '0005',
c_col6 TYPE i VALUE '0006',
c_col7 TYPE i VALUE '0007',
c_col8 TYPE i VALUE '0008',
c_col9 TYPE i VALUE '0009',
c_col10 TYPE i VALUE '0010',
c_col11 TYPE i VALUE '0011',
c_col12 TYPE i VALUE '0012',
c_col13 TYPE i VALUE '0013',
c_col14 TYPE i VALUE '0014',
c_col15 TYPE i VALUE '0015',
c_col16 TYPE i VALUE '0016'.
data : v_currentrow type i,
v_currentrow1 type i.
data : itab_head like ALSMEX_TABLINE occurs 0 with header line,
itab_det like ALSMEX_TABLINE occurs 0 with header line.
data : file_head type RLGRAP-FILENAME,
file_item type RLGRAP-FILENAME.
file_head = 'C:Documents and SettingsDesktophead.xls'.
file_item = 'C:Documents and SettingsDesktopitem.xls'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file_head
i_begin_col = 1
i_begin_row = 1
i_end_col = 12
i_end_row = 50
tables
intern = itab_head
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file_item
i_begin_col = 1
i_begin_row = 1
i_end_col = 16
i_end_row = 50
tables
intern = itab_det
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF itab_head[] IS INITIAL.
WRITE:/ 'No Header Data Exists '.
STOP.
ELSE.
sort itab_head by row col.
read table itab_head index 1.
v_currentrow = itab_head-row.
loop at itab_head.
if itab_head-row ne v_currentrow.
APPEND it_head.
v_currentrow = itab_head-row.
ENDIF.
CASE itab_head-col.
WHEN c_col1.
it_head-ref = itab_head-value.
WHEN c_col2.
it_head-bsart = itab_head-value.
WHEN c_col3.
it_head-lifnr = itab_head-value.
WHEN c_col4.
it_head-ekorg = itab_head-value.
WHEN c_col5.
it_head-ekgrp = itab_head-value.
WHEN c_col6.
it_head-bukrs = itab_head-value.
WHEN c_col7.
it_head-verkf = itab_head-value.
WHEN c_col8.
it_head-telf1 = itab_head-value.
WHEN c_col9.
it_head-ihrez = itab_head-value.
WHEN c_col10.
it_head-unsez = itab_head-value.
WHEN c_col11.
it_head-kdatb = itab_head-value.
WHEN c_col12.
it_head-kdate = itab_head-value.
ENDCASE.
ENDLOOP.
APPEND it_head.
CLEAR it_head.
ENDIF.
IF itab_det[] IS INITIAL.
WRITE:/ 'No Item Data Exists '.
STOP.
ELSE.
sort itab_det by row col.
read table itab_det index 1.
v_currentrow1 = itab_det-row.
loop at itab_det.
if itab_det-row ne v_currentrow1.
APPEND it_det.
v_currentrow1 = itab_det-row.
ENDIF.
CASE itab_det-col.
WHEN c_col1.
it_det-ref = itab_det-value.
WHEN c_col2.
it_det-knttp = itab_det-value.
WHEN c_col3.
it_det-pstyp = itab_det-value.
WHEN c_col4.
it_det-txz01 = itab_det-value.
WHEN c_col5.
it_det-matkl = itab_det-value.
WHEN c_col6.
it_det-werks = itab_det-value.
WHEN c_col7.
it_det-afnam = itab_det-value.
WHEN c_col8.
it_det-srvpos = itab_det-value.
WHEN c_col9.
it_det-ktext1 = itab_det-value.
WHEN c_col10.
it_det-frmval1 = itab_det-value.
WHEN c_col11.
it_det-frmval2 = itab_det-value.
WHEN c_col12.
it_det-menge = itab_det-value.
WHEN c_col13.
it_det-kostl = itab_det-value.
WHEN c_col14.
it_det-sakto = itab_det-value.
WHEN c_col15.
it_det-zzcode = itab_det-value.
WHEN c_col16.
it_det-kbetr = itab_det-value.
ENDCASE.
ENDLOOP.
APPEND it_det.
CLEAR it_det.
ENDIF.
loop at it_head.
poheader-doc_type = it_head-bsart.
poheader-vendor = it_head-lifnr.
poheader-purch_org = it_head-ekorg.
poheader-pur_group = it_head-ekgrp.
poheader-comp_code = it_head-bukrs.
poheader-sales_pers = it_head-verkf.
poheader-telephone = it_head-telf1.
poheader-REF_1 = it_head-ihrez.
poheader-OUR_REF = it_head-unsez.
poheader-VPER_START = it_head-kdatb.
poheader-VPER_END = it_head-kdate.
loop at it_det where ref = it_head-ref.
poitem-acctasscat = it_det-knttp.
poitem-item_cat = it_det-pstyp.
poitem-short_text = it_det-txz01.
poitem-matl_group = it_det-matkl.
poitem-plant = it_det-werks.
poitem-PREQ_NAME = it_det-afnam.
POESLLC-SERVICE = it_det-srvpos.
POESLLC-SHORT_TEXT = it_det-ktext1.
POESLLC-FORM_VAL1 = it_det-frmval1.
POESLLC-FORM_VAL2 = it_det-frmval2.
POESLLC-QUANTITY = it_det-menge.
POACCOUNT-COSTCENTER = it_det-kostl.
POACCOUNT-GL_ACCOUNT = it_det-sakto.
POCONDHEADER-COND_TYPE = 'R000'.
POCONDHEADER-COND_VALUE = it_det-kbetr.
endloop.
endloop.
poheaderx-doc_type = 'X'.
poheaderx-vendor = 'X'.
poheaderx-purch_org = 'X'.
poheaderx-pur_group = 'X'.
poheaderx-comp_code = 'X'.
poheaderx-sales_pers = 'X'.
poheaderx-telephone = 'X'.
poheaderx-REF_1 = 'X'.
poheaderx-OUR_REF = 'X'.
poheaderx-VPER_START = 'X'.
poheaderx-VPER_END = 'X'.
poitemx-acctasscat = 'X'.
poitemx-item_cat = 'X'.
poitemx-short_text = 'X'.
poitemx-matl_group = 'X'.
poitemx-plant = 'X'.
poitemx-PREQ_NAME = 'X'.
*POESLLCx-SHORT_TEXT = 'X'.
POACCOUNTx-COSTCENTER = 'X'.
POACCOUNTx-GL_ACCOUNT = 'X'.
POCONDHEADER-cond_type = 'X'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = poheader
POHEADERX = poheaderx
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER = po_no
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = return
POITEM = poitem
POITEMX = poitemx
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT = poaccount
POACCOUNTPROFITSEGMENT =
POACCOUNTX = poaccountx
POCONDHEADER = pocondheader
POCONDHEADERX = pocondheaderx
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES = poesllc
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
if sy-subrc = 0.
loop at return.
write return-MESSAGE_V1.
write po_no.
endloop.
endif.
Also check this link
[Service Order through BAPI|Service PO creation with BAPI; -
Problem with direct input program while uploading data into database
TABLES: BGR00, " Mappensatz
BMM00, " MM01/MM02 BTCI-Kopfdaten
BMMH1, " MM01/MM02 Hauptdaten
BMMH2, " Länderdaten (Steuern)
BMMH3, " Prognosewerte
BMMH4, " Verbrauchswerte
BMMH5, " Kurztexte
BMMH6, " Mengeneinheiten
BMMH7, " Langtexte
BMMH8. " Referentielle EAN's
Satztypen
DATA: MAPPENSATZ LIKE BMM00-STYPE VALUE '0',
KOPFSATZ LIKE BMM00-STYPE VALUE '1',
HAUPTSATZ LIKE BMM00-STYPE VALUE '2',
KUN_SATZ LIKE BMM00-STYPE VALUE 'Z',
LANDSATZ LIKE BMM00-STYPE VALUE '3',
PROGSATZ LIKE BMM00-STYPE VALUE '4',
VERBSATZ LIKE BMM00-STYPE VALUE '5',
KTEXTSATZ LIKE BMM00-STYPE VALUE '6',
MESATZ LIKE BMM00-STYPE VALUE '7',
TEXTSATZ LIKE BMM00-STYPE VALUE '8',
EANSATZ LIKE BMM00-STYPE VALUE '9'.
Common Data Bereich fuer die extern aufgerufenen Routinen
Initialstrukturen
DATA: BEGIN OF COMMON PART RMMMBIMY.
DATA: BEGIN OF I_BMM00.
INCLUDE STRUCTURE BMM00. " Kopfdaten
DATA: END OF I_BMM00.
DATA: BEGIN OF I_BMMH1.
INCLUDE STRUCTURE BMMH1. " Haupdaten
DATA: END OF I_BMMH1.
DATA: BEGIN OF I_BMMH2.
INCLUDE STRUCTURE BMMH2. " Länderdaten
DATA: END OF I_BMMH2.
DATA: BEGIN OF I_BMMH3.
INCLUDE STRUCTURE BMMH3. " Prognosewerte
DATA: END OF I_BMMH3.
DATA: BEGIN OF I_BMMH4.
INCLUDE STRUCTURE BMMH4. " Verbrauchswerte
DATA: END OF I_BMMH4.
DATA: BEGIN OF I_BMMH5.
INCLUDE STRUCTURE BMMH5. " Kurztexte
DATA: END OF I_BMMH5.
DATA: BEGIN OF I_BMMH6.
INCLUDE STRUCTURE BMMH6. " Mengeneinheiten
DATA: END OF I_BMMH6.
DATA: BEGIN OF I_BMMH7.
INCLUDE STRUCTURE BMMH7. " Textzeilen
DATA: END OF I_BMMH7.
DATA: BEGIN OF I_BMMH8.
INCLUDE STRUCTURE BMMH8. " Referentielle EAN's
DATA: END OF I_BMMH8.
DATA: END OF COMMON PART.
DATA: WA LIKE TEDATA-DATA.
Einzelfelder
DATA: GROUP_COUNT(6) TYPE C, " Anzahl Mappen
TRANS_COUNT(6) TYPE C, " alte Definition für rmmmbim0
SATZ_COUNT LIKE MUEB_REST-TRANC, " Trans.zähler neu
H_IND_COUNT LIKE MUEB_REST-D_IND, " Index welches Feld zurücks.
SATZ2_COUNT(6) TYPE C. " Anz. Sätze je Trans. ohne Kopfsatz
DATA: XEOF(1) TYPE C, " X=End of File erreicht
XHAUPTSATZ_EXIST TYPE C, " X=Hauptsatz zum Kopf exi.
NODATA(1) TYPE C. " kein BI für dieses Feld
mk/15.08.94:
DATA: GROUP_OPEN(1) TYPE C. " X=Mappe schon geöffnet
*eject
Konstanten
DATA: C_NODATA(1) TYPE C VALUE '/'. " Default für NODATA
DATA: MATNR_ERW LIKE MARA-MATNR VALUE '0 '.
DATA: MATNR_ERW_INT LIKE MARA-MATNR. "internal sight of '0 '
DATA: MATNR_LAST LIKE MARA-MATNR. "Material number
mk/11.08.94 2.1H:
If this flag is initial, the database updates will be done directly
during background maintenance instead of using a separate update
task. (no usage of this flag in dialogue mode!)
DATA: DBUPDATE_VB(1) VALUE ' '. "note 306628
data: matsync type mat_sync. "wk/99a no update in dialog if called
***INCLUDE ZMUSD070.
TABLES: MARA, "Material Master: General Data
MARC, "Material Master: C Segment
MARD, "Material Master: St Loc/Batch
MBEW, "Material Valuation
MVKE, "Material Master: Sales Data
MLGN, "Material Data per Whse Number
MLAN, "Tax Classification: Material
T001W, "Plants/Branches
TBICU.
DATA: BEGIN OF VALUTAB OCCURS 0.
INCLUDE STRUCTURE RSPARAMS.
DATA: END OF VALUTAB.
DATA: BEGIN OF VARTECH.
INCLUDE STRUCTURE VARID.
DATA: END OF VARTECH.
DATA: PARMS LIKE ZXXDCONV.
DATA: REC_COUNT TYPE I,
REC_COUNT_BAD TYPE I,
ZJOBID LIKE TBIZU-JOBID,
ZJOBCOUNT LIKE TBIZU-JOBCOUNT,
ZMATNR LIKE MARA-MATNR,
ZTEXT(80) TYPE C.
CONSTANTS: LIT_ZERO(18) TYPE C VALUE '000000000000000000',
LIT_CHAR TYPE C VALUE '_',
LIT_CREATE LIKE BMM00-TCODE VALUE 'MM01',
LIT_CHANGE LIKE BMM00-TCODE VALUE 'MM02',
LIT_CHECK(1) TYPE C VALUE 'X'.
DATA: BEGIN OF INP_DATA OCCURS 0,
MATNR(18) TYPE C, " Material code
UMREN(6) TYPE C, " Denominator
MEINH(3) TYPE C, " Alternate UOM
UMREZ(6) TYPE C, " Numerator
END OF INP_DATA.
*eject
SELECTION-SCREEN BEGIN OF BLOCK INOUT WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (13) TEXT-004.
PARAMETERS: P_PC RADIOBUTTON GROUP SRC DEFAULT 'X'.
SELECTION-SCREEN COMMENT (6) TEXT-005.
PARAMETERS: P_UNIX RADIOBUTTON GROUP SRC.
SELECTION-SCREEN COMMENT (6) TEXT-006.
PARAMETERS: P_DS_TYP LIKE ZXXDCONV-DS_TYP
DEFAULT 'ASC'.
SELECTION-SCREEN END OF LINE.
*SELECT-OPTIONS: S_PATH FOR PARMS-PATH
NO INTERVALS
LOWER CASE.
PARAMETERS: P_PATH TYPE RLGRAP-FILENAME.
PARAMETERS: P_HDRLIN LIKE ZXXDCONV-HDR_LINES
DEFAULT 0,
P_JOBNAM LIKE TBICU_S-JOBNAME
MEMORY ID BM1,
P_DI_EXE AS CHECKBOX
DEFAULT LIT_CHECK,
P_MAPPE LIKE BGR00-GROUP
DEFAULT 'MRP_UOM_LOAD'
NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK INOUT.
*eject
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PATH.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_PATH'
CHANGING
FILE_NAME = S_PATH-LOW
FILE_NAME = P_PATH
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
AT SELECTION-SCREEN.
Set up parameter record
PARMS-UNIX = P_UNIX.
PARMS-PC = P_PC.
PARMS-DS_TYP = P_DS_TYP.
PARMS-JOBNAME = P_JOBNAM.
PARMS-MAPPE = P_MAPPE.
PARMS-HDR_LINES = P_HDRLIN.
*eject
Main Processing Routine *
START-OF-SELECTION.
Initialization
PERFORM 0000_HOUSEKEEPING.
Initialize transaction data in I_BM00
PERFORM 0500_INIT_BMM00.
Process input files
SORT S_PATH BY SIGN OPTION LOW.
MOVE S_PATH-LOW TO PARMS-PATH.
MOVE P_PATH TO PARMS-PATH.
LOOP AT S_PATH.
AT NEW LOW.
CLEAR INP_DATA.
REFRESH INP_DATA.
Read source data into internal table
PERFORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
Processs each record in internal table
ZTEXT = TEXT-007.
ZTEXT+13 = PARMS-DS_NAME.
PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
Initialize transaction data in I_BM00
PERFORM 0500_INIT_BMM00.
LOOP AT INP_DATA.
Reset tables for each record
BMM00 = I_BMM00.
BMMH1 = I_BMMH1.
BMMH6 = I_BMMH6.
Load structures with data
MOVE-CORRESPONDING INP_DATA TO BMM00.
PERFORM 2000_WRITE_OUTPUT USING BMM00.
MOVE-CORRESPONDING INP_DATA TO BMMH1.
PERFORM 2000_WRITE_OUTPUT USING BMMH1.
MOVE-CORRESPONDING INP_DATA TO BMMH6.
PERFORM 2000_WRITE_OUTPUT USING BMMH6.
REC_COUNT = REC_COUNT + 1.
ENDLOOP.
ENDAT.
ENDLOOP.
IF REC_COUNT GT 0
AND P_DI_EXE EQ LIT_CHECK.
PERFORM 3000_START_DI_JOB.
ENDIF.
WRITE: / TEXT-008,
REC_COUNT.
PERFORM 9000_END_OF_JOB.
*eject
Include containing common routines used by direct input programs
INCLUDE ZMUSD071.
*eject
FORM 0500_INIT_BMM00 *
Initialize I_BMM00 with transaction code and views selected *
FORM 0500_INIT_BMM00.
***this changes done by samson**
if not inp_data[] is initial.
select single matnr from mara INTO ZMATNR where matnr = inp_data-matnr.
if sy-subrc = 0.
I_BMM00-TCODE = LIT_CHANGE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
else.
I_BMM00-TCODE = LIT_CREATE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
endif.
endif.
**this changes above done by samson**
Transaction code
I_BMM00-TCODE = LIT_CHANGE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
ENDFORM.
INCLUDE ZMUSD069.
*eject
FORM 0000_HOUSEKEEPING *
Initialization routines *
FORM 0000_HOUSEKEEPING.
PERFORM 0010_LDS_NAME.
PERFORM 0020_DS_NAME.
PERFORM 0030_OPEN_FILE.
PERFORM 0040_INIT_STRUCTS.
ENDFORM.
*eject
FORM 0010_LDS_NAME *
Obtain logical file name from DI job details *
FORM 0010_LDS_NAME.
Check valid job name
SELECT SINGLE * FROM TBICU
WHERE JOBNAME EQ PARMS-JOBNAME.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'RS_VARIANT_VALUES_TECH_DATA'
EXPORTING
REPORT = TBICU-REPNAME
VARIANT = TBICU-VARIANT
IMPORTING
TECHN_DATA = VARTECH
TABLES
VARIANT_VALUES = VALUTAB
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
READ TABLE VALUTAB WITH KEY 'LDS_NAME'.
MOVE VALUTAB-LOW TO PARMS-LDS_NAME.
ELSE.
MESSAGE I001 WITH PARMS-JOBNAME.
MESSAGE A099.
ENDIF.
ELSE.
MESSAGE I000 WITH PARMS-JOBNAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 0040_INIT_STRUCTS *
Initialize structures for direct input records *
FORM 0040_INIT_STRUCTS.
Start of standard SAP initialization from example program RMMMBIME
*------- Write session record -
CLEAR BGR00.
BGR00-STYPE = MAPPENSATZ.
BGR00-GROUP = PARMS-MAPPE.
BGR00-NODATA = C_NODATA.
BGR00-MANDT = SY-MANDT.
BGR00-USNAM = SY-UNAME.
BGR00-START = BGR00-NODATA.
BGR00-XKEEP = BGR00-NODATA.
PERFORM 2000_WRITE_OUTPUT USING BGR00.
*----- Initialize structures -
NODATA = BGR00-NODATA.
PERFORM INIT_STRUKTUREN_ERZEUGEN(RMMMBIMI) USING NODATA.
End of standard SAP initialization from example program RMMMBIME
ENDFORM.
*eject.
FORM 3000_START_DI_JOB *
Start direct input job *
FORM 3000_START_DI_JOB.
ZTEXT = 'Starting '(021).
ZTEXT+9 = TBICU-JOBNAME.
PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
CALL FUNCTION 'BI_START_JOB'
EXPORTING
JOBID = ' '
JOBTEXT = TBICU-JOBNAME
REPNAME = TBICU-REPNAME
SERVER = TBICU-EXECSERVER
VARIANT = TBICU-VARIANT
NEW_JOB = 'X'
CONTINUE_JOB = ' '
START_IMMEDIATE = 'X'
DO_NOT_PRINT = 'X'
USERNAME = SY-UNAME
IMPORTING
JOBID = ZJOBID
JOBCOUNT = ZJOBCOUNT
EXCEPTIONS
JOB_OPEN_FAILED = 1
JOB_CLOSE_FAILED = 2
JOB_SUBMIT_FAILED = 3
WRONG_PARAMETERS = 4
JOB_DOES_NOT_EXIST = 5
WRONG_STARTTIME_GIVEN = 6
JOB_NOT_RELEASED = 7
WRONG_VARIANT = 8
NO_AUTHORITY = 9
DIALOG_CANCELLED = 10
JOB_ALREADY_EXISTS = 11
PERIODIC_NOT_ALLOWED = 12
ERROR_NUMBER_GET_NEXT = 13
OTHERS = 14.
IF SY-SUBRC EQ 0.
WRITE: / 'Direct input job'(022), TBICU-JOBNAME, 'started'.
ELSE.
WRITE: / 'Direct input failed with return code'(023), SY-SUBRC.
ENDIF.
FORM 0020_DS_NAME.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = PARMS-LDS_NAME
OPERATING_SYSTEM = SY-OPSYS
IMPORTING
FILE_NAME = PARMS-DS_NAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE E002 WITH PARMS-LDS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 0030_OPEN_FILE *
Open physical file for output *
FORM 0030_OPEN_FILE.
OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE. "thg191105
OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE
encoding default. "thg191105
IF SY-SUBRC NE 0.
MESSAGE E003 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 1000_GET_SOURCE_DATA *
Read source data into internal table *
--> INP_DATA " Name of internal table passed as parameter *
FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
CALL FUNCTION 'Z_FILE_UPLOAD'
EXPORTING
UNIX = PARMS-UNIX
PC = PARMS-PC
FILETYPE = PARMS-DS_TYP
FILENAME = PARMS-PATH
HDR_LINES = PARMS-HDR_LINES
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
INVALID_SOURCE = 8
OTHERS = 9.
ENDFORM.
*eject
FORM 2000_WRITE_OUTPUT *
Write record in standard SAP structure to UNIX file *
--> I_STRUCT " Name of record passed as parameter *
*FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY. "SRY28NOV05
TRANSFER I_STRUCT TO PARMS-DS_NAME.
IF SY-SUBRC NE 0.
MESSAGE E004 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
*& Form 2100_WS_DOWNLOAD
text *
--> p1 text
<-- p2 text
FORM 2100_WS_DOWNLOAD TABLES INP_DATA.
DATA: FILENAME LIKE RLGRAP-FILENAME. "SRY28NOV05
DATA: W_FILENAME TYPE STRING. "SRY28NOV05
DATA: W_FTYP(10) TYPE C VALUE 'DAT'. "SRY28NOV05
MOVE PARMS-DS_NAME TO FILENAME. "SRY28NOV05
MOVE PARMS-DS_NAME TO W_FILENAME. "SRY28NOV05
*BEGIN OF BLOCK COMMENT BY SRY28NOV05
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = FILENAME
FILETYPE = 'DAT'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
importing
filelength =
TABLES
DATA_TAB = INP_DATA
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
*END OF BLOCK COMMENT BY SRY28NOV05
*BEGIN OF BLOCK ADDED BY SRY28NOV05
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = W_FILENAME
FILETYPE = W_FTYP
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*END OF BLOCK ADDED BY SRY28NOV05
ENDFORM. " 2100_WS_DOWNLOAD
*eject
FORM 4000_PROGRESS_INDICATOR *
Write progress text to status bar *
--> TEXT " Text passed as parameter *
FORM 4000_PROGRESS_INDICATOR USING TEXT.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT
EXCEPTIONS
OTHERS = 1.
ENDFORM.
*eject.
FORM 9000_END_OF_JOB *
Close files on UNIX *
FORM 9000_END_OF_JOB.
CLOSE DATASET PARMS-DS_NAME.
ENDFORM.
FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
CALL FUNCTION 'Z_FILE_UPLOAD'
EXPORTING
UNIX = PARMS-UNIX
PC = PARMS-PC
FILETYPE = PARMS-DS_TYP
FILENAME = PARMS-PATH
HDR_LINES = PARMS-HDR_LINES
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
INVALID_SOURCE = 8
OTHERS = 9.
ENDFORM.
*eject
FORM 2000_WRITE_OUTPUT *
Write record in standard SAP structure to UNIX file *
--> I_STRUCT " Name of record passed as parameter *
*FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY. "SRY28NOV05
TRANSFER I_STRUCT TO PARMS-DS_NAME.
IF SY-SUBRC NE 0.
MESSAGE E004 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
*& Form 2100_WS_DOWNLOAD
text *
--> p1 text
<-- p2 text
FORM 2100_WS_DOWNLOAD TABLES INP_DATA.Hi,
Thnaks for your reply, This is my requirement.
Here my problem is i am trying to upload the data from flatfile which contain materil number, denominator, Actual UOM, Nominator field values.
Which is the data i need to upload into MM02 and MM01, if material number is new then it has to create the material, if material is already existing it has to update the UOM values.
here i am getting data into my internal table INP_DATA, from that i am trying to upload the data to database by using job name MRP_MATERIAL_MASTER_DATA_UPLOAD with direct input program RMDATIND.
when i execute my program i am getting success message all the records writtin from flatfile to application server. and job started message.
then if i go into sm37 screen there i execute the job it is also giving active message. if i refresh it it is showing job completed message.
then i look at job log status. there i found that for existing material it is expecting material type, for new material it is giving some gravity error.
So could u help me in this it will be gr8.
Thanks & Regards,
RamNV
Maybe you are looking for
-
What are the best graphics available for the Macbook Pro 13"
I am 13 years old and I am looking at a Macbook Pro. I am between the 15" and 13". The only thing stopping me from going straight to the 13" is the graphics. I hear they aren't that good. Is there anyway to get the graphics from the 15" and 17" or ju
-
Runtime errors : CONVT_CODEPAGE
Dear ABAPers, I have used a small abap report to filter the error records from orginal source file(.txt) and made a error free records in the new file and used GUI_DOWNLOAD FM to download same as .txt file. Now am trying to use the new .txt file to u
-
Message Mapping in HRAS - can it be used for ESS ?
We came across this functionality for EHP2 (after activating business function HCM_ASR_CI_1) called "message mapping" while implementing HCM processes and forms framework. It is available under HR Administrative services -->Tools in the IMG provided
-
Is it possible to get the containing table name of a UDT with ToCustomObj?
Hi, I got several UDTs that I use in various different tables, in order to update them I need to know which table they came from (I handle updates manually). I'm looking for a way to store the table name the UDT came from in the ToCustomObject method
-
We have 2 Mac Pros and 4 Xserve Raids-
I have 2 Mac Pros and 4 Xserve Raids and want to do a quick fix. I want to hook them all to gather so we can share assets for Final Cut Pro. We have a Fiber Switch and tons of cable. I know that I can't work on the same project file as the other mach