Uploading The Master Records (MM01) To SAP System Using Call Transaction Method (Excel Flat File)
Uploading The Master Records (MM01) To SAP System Using Call Transaction Method (Excel Flat File)
Steps :
Get the flat file from the customer. Flat file might be excel .
sapabapdatatempt.blogspot.com/p/blog-page_2.html 1/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
Enter the recording name and enter the transaction code (MM01).
sapabapdatatempt.blogspot.com/p/blog-page_2.html 2/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
sapabapdatatempt.blogspot.com/p/blog-page_2.html 3/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
Press Enter.
sapabapdatatempt.blogspot.com/p/blog-page_2.html 5/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
Press Enter.
Click on Yes.
N t Thi i i il t t f BDCDATA
sapabapdatatempt.blogspot.com/p/blog-page_2.html 6/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
Note :This is similar structure of BDCDATA.
sapabapdatatempt.blogspot.com/p/blog-page_2.html 7/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
sapabapdatatempt.blogspot.com/p/blog-page_2.html 8/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
Click on Continue.
Enter Title and select attribute type as Executable program.
Source Code
sapabapdatatempt.blogspot.com/p/blog-page_2.html 9/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
report ZMM_BDC_CALL
no standard page heading line-size 255.
TYPES : BEGIN OF TY_MAT,
MATNR(18) TYPE C,
MBRSH TYPE C,
MTART(4) TYPE C,
MAKTX(40) TYPE C,
MEINS(3) TYPE C,
END OF TY_MAT.
DATA: WA_MAT TYPE TY_MAT,
IT_MAT TYPE TABLE OF TY_MAT.
data: bdcdata like bdcdata occurs 0 with header line.
* messages of call transaction
data: messtab like bdcmsgcoll occurs 0 with header line.
PARAMETERS : FILE(120) TYPE C.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.
PERFORM SEARCH_FILE CHANGING FILE.
START-OF-SELECTION.
PERFORM GET_DATA_FROM_FILE USING FILE CHANGING IT_MAT.
*include bdcrecx1.
PERFORM BDC_OPERATION.
PERFORM DISPLAY_MESS USING messtab[].
sapabapdatatempt.blogspot.com/p/blog-page_2.html 10/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
*&---------------------------------------------------------------------*
*& Form SEARCH_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_FILE text
*----------------------------------------------------------------------*
form SEARCH_FILE changing p_file.
DATA : FILE_NAME TYPE IBIPPARMS-PATH.
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SY-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
FILE_NAME = FILE_NAME
.
P_FILE = FILE_NAME.
endform. " SEARCH_FILE
*&---------------------------------------------------------------------*
*& Form GET_DATA_FROM_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FILE text
* <--P_IT_MAT text
*----------------------------------------------------------------------*
form GET_DATA_FROM_FILE using p_file
changing p_it_mat LIKE IT_MAT.
DATA : I_TAB_RAW_DATA TYPE TRUXS_T_TEXT_DATA ,
I_FILENAME TYPE RLGRAP-FILENAME.
exporting
* I_FIELD_SEPERATOR =
sapabapdatatempt.blogspot.com/p/blog-page_2.html 11/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
* I_LINE_HEADER =
i_tab_raw_data = I_TAB_RAW_DATA
i_filename = I_FILENAME
tables
i_tab_converted_data = p_it_mat
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
endform. " GET_DATA_FROM_FILE
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform.
*&---------------------------------------------------------------------*
sapabapdatatempt.blogspot.com/p/blog-page_2.html 12/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
*& Form BDC_OPERATION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form BDC_OPERATION .
LOOP AT IT_MAT INTO WA_MAT.
REFRESH BDCDATA[].
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_MAT-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
WA_MAT-MBRSH.
perform bdc_field using 'RMMG1-MTART'
WA_MAT-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'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
WA_MAT-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
WA_MAT-MEINS.
perform bdc_field using 'MARA-MTPOS_MARA'
sapabapdatatempt.blogspot.com/p/blog-page_2.html 13/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
'NORM'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'MM01' USING bdcdata[] UPDATE 'S'
MODE 'A'
MESSAGES INTO messtab.
ENDLOOP.
endform. " BDC_OPERATION
*&---------------------------------------------------------------------*
*& Form DISPLAY_MESS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MESSTAB text
*----------------------------------------------------------------------*
form DISPLAY_MESS using p_messtab LIKE messtab[].
DATA : MSG TYPE STRING.
DATA : WA LIKE LINE OF p_messtab.
LOOP AT p_messtab INTO WA.
call function 'FORMAT_MESSAGE'
EXPORTING
ID = WA-MSGID
LANG = SY-LANGU
NO = WA-MSGNR
V1 = WA-MSGV1
V2 = WA-MSGV2
V3 = WA-MSGV3
V4 = WA-MSGV4
IMPORTING
MSG = MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
sapabapdatatempt.blogspot.com/p/blog-page_2.html 14/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
WRITE : / MSG.
CLEAR WA.
ENDLOOP.
endform. " DISPLAY_MESS
Input
Click on Execute.
sapabapdatatempt.blogspot.com/p/blog-page_2.html 15/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
Click on Allow.
Output
sapabapdatatempt.blogspot.com/p/blog-page_2.html 16/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
*&---------------------------------------------------------------------*
*& Report ZFAE_ALV *& *&---------------------------------------------------------------
------* *& *& *&---------------------------------------------------------------------* …
READ MORE
ALV INTRODUCTION
THE SAP LIST VIEWER :- --> It is a generic tool that outputs data in
a table forms (rows & columns), with integrated functions to manipulate output
(sort,totals, filter, column order, hide, etc.) and export it (excel, csv file,crystal …
READ MORE
READ MORE
Powered by Blogger
sapabapdatatempt.blogspot.com/p/blog-page_2.html 17/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
views
Archive
Report Abuse
sapabapdatatempt.blogspot.com/p/blog-page_2.html 18/18