After the open_group statement, start looping your program. Loop at itab. 'start looping through all all records from file. Use the table below to replace the BDC Field values with the values from the internal table: BDC Field Name Original Value Change to Value RF02K-LIFNR ZBDCTESTXX itab-vendor. BDC Call transaction for Material Master MM01 Last Updated: July 3rd 2017 by Ashok Kumar Reddy BDC call transaction method for migrating Material Master data using MM01 transaction.
BDCCLOSEGROUP: To close the session. 1) The first step in the program is to do the recording.
Recording is the process in which we record the steps by means of codes. So after doing recording a file will be generated. We use this file or I should say codes in our program. Then the question arises that why we need to do the recording and get the file?? The answer is that bdc is done when we have to upload a large no of data in sap like 1000’s or more, and creating these many entries one by one manually is not possible.so in bdc what we do is we create one entry manually and record the process. This recording is used in the program in a loop to make rest of the entries.just the values will be different each time. So for creating a recording the do following steps- A) Go to transaction “ SHDB”.
You will get following screen. 2) Now we have to do the coding part.
The first thing that is to be done is that at the top one include will be there naming “BDCRECX1” this is standard include. We will not use this perform so we will get the useful things from this perform and will delete this perform.
We will also delete the parameter “ DATASET” as we will not use it. So We have to go inside the include and scroll to bottom. There bottom two performs we have to copy and paste in the main program. Then delete the include. In one perform there will be “ NO DATA” delete it and give ‘ ‘. As highlighted.
TYPES: BEGIN OF tyexcel, mbrsh TYPE mbrsh, mtart TYPE mtart, maktx TYPE maktx, matkl TYPE matkl, meins TYPE meins, END OF tyexcel. DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE. DATA: gvname TYPE rlgrap-filename, gitupl TYPE STANDARD TABLE OF tyexcel, gwaupl TYPE tyexcel. CALL FUNCTION 'F4FILENAME' EXPORTING programname = syst-cprog dynpronumber = syst-dynnr. FIELDNAME = ' ' IMPORTING filename = pfile. CALL FUNCTION 'TEXTCONVERTXLSTOSAP' EXPORTING. IFIELDSEPERATOR =.
Perform bdcdynpro using 'SAPLMGMM' '0060'. Perform bdcfield using 'BDCCURSOR' 'RMMG1-MTART'. Perform bdcfield using 'BDCOKCODE' '/00'. Perform bdcfield using 'RMMG1-MBRSH' gwaupl-mbrsh. Perform bdcfield using 'RMMG1-MTART' gwaupl-mtart. Perform bdcdynpro using 'SAPLMGMM' '0070'.
Perform bdcfield using 'BDCCURSOR' 'MSICHTAUSW-DYTXT(01)'. Perform bdcfield using 'BDCOKCODE' '=ENTR'. Perform bdcfield using 'MSICHTAUSW-KZSEL(01)' 'X'. Perform bdcdynpro using 'SAPLMGMM' '4004'.
Perform bdcfield using 'BDCOKCODE' '/00'. Perform bdcfield using 'MAKT-MAKTX' gwaupl-maktx. Perform bdcfield using 'BDCCURSOR' 'MARA-MATKL'.
Perform bdcfield using 'MARA-MEINS' gwaupl-meins. Perform bdcfield using 'MARA-MATKL' gwaupl-matkl.
Perform bdcdynpro using 'SAPLSPO1' '0300'. Perform bdcfield using 'BDCOKCODE' '=YES'. CALL FUNCTION 'BDCINSERT' EXPORTING TCODE = 'MM01'.