0% found this document useful (0 votes)
2 views

source+code (37)ABAP

This document outlines an ABAP program for uploading material data from a text file into the SAP system. It includes specific data structure definitions, parameters, and function calls for handling the upload process. The program processes each record by splitting the input data and performing a series of BDC (Batch Data Communication) operations to create material master records.

Uploaded by

greeshmakuderu2
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

source+code (37)ABAP

This document outlines an ABAP program for uploading material data from a text file into the SAP system. It includes specific data structure definitions, parameters, and function calls for handling the upload process. The program processes each record by splitting the input data and performing a series of BDC (Batch Data Communication) operations to create material master records.

Uploaded by

greeshmakuderu2
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

report ZDBDC6

no standard page heading line-size 255.

* Include bdcrecx1_s:
* The call transaction using is called WITH AUTHORITY-CHECK!
* If you have own auth.-checks you can use include bdcrecx1 instead.
include bdcrecx1_s.

parameters: dataset(132) lower case.


*** DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
*
* If it is nessesary to change the data section use the rules:
* 1.) Each definition of a field exists of two lines
* 2.) The first line shows exactly the comment
* '* data element: ' followed with the data element
* which describes the field.
* If you don't have a data element use the
* comment without a data element name
* 3.) The second line shows the fieldname of the
* structure, the fieldname must consist of
* a fieldname and optional the character '_' and
* three numbers and the field length in brackets
* 4.) Each field must be type C.
*
*** Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
* data element: MATNR
MATNR_001(040),
* data element: MBRSH
MBRSH_002(001),
* data element: MTART
MTART_003(004),
* data element: XFELD
KZSEL_01_004(001),
* data element: MAKTX
MAKTX_005(040),
* data element: MEINS
MEINS_006(003),
end of record.

*** End generated data section ***

TYPES : BEGIN OF TY_TEMP,


STRING TYPE STRING,
END OF TY_TEMP.

TYPES : BEGIN OF TY_MARA,


MATNR TYPE RMMG1-MATNR,
MBRSH TYPE RMMG1-MBRSH,
MTART TYPE RMMG1-MTART,
MAKTX TYPE MAKT-MAKTX,
MEINS TYPE MARA-MEINS,
END OF TY_MARA.

DATA : IT_TEMP TYPE TABLE OF TY_TEMP,


WA_TEMP TYPE TY_TEMP,
IT_MARA TYPE TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'


EXPORTING
filename = 'C:\Users\s20abap24\Desktop\MARA_MAKT.TXT'
tables
data_tab = IT_TEMP.

IF IT_TEMP IS NOT INITIAL.


LOOP AT IT_TEMP INTO WA_TEMP.
CLEAR WA_MARA.
SPLIT WA_TEMP-STRING AT ',' INTO WA_MARA-MATNR WA_MARA-MBRSH WA_MARA-
MTART WA_MARA-MAKTX WA_MARA-MEINS.
APPEND WA_MARA TO IT_MARA.
ENDLOOP.
ENDIF.

*perform open_dataset using dataset.


perform open_group.

LOOP AT IT_MARA INTO WA_MARA.

perform bdc_dynpro using 'SAPLMGMM' '0060'.


perform bdc_field using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-MATNR'
WA_MARA-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
WA_MARA-MBRSH.
perform bdc_field using 'RMMG1-MTART'
WA_MARA-MTART.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
WA_MARA-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
WA_MARA-MEINS.
perform bdc_transaction using 'MM01'.

ENDLOOP.

perform close_group.

You might also like