0% found this document useful (0 votes)
58 views18 pages

Uploading The Master Records (MM01) To SAP System Using Call Transaction Method (Excel Flat File)

The document describes the steps to upload master records from an Excel flat file to SAP using transaction code MM01 and a call transaction program. The steps include recording a sample MM01 transaction, creating an ABAP program to call the transaction for each record, mapping the Excel data to internal tables, and executing the BDC calls to upload the records to SAP. The program uses function modules to convert the Excel file to internal tables and execute the recorded transaction for each record.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views18 pages

Uploading The Master Records (MM01) To SAP System Using Call Transaction Method (Excel Flat File)

The document describes the steps to upload master records from an Excel flat file to SAP using transaction code MM01 and a call transaction program. The steps include recording a sample MM01 transaction, creating an ABAP program to call the transaction for each record, mapping the Excel data to internal tables, and executing the BDC calls to upload the records to SAP. The program uses function modules to convert the Excel file to internal tables and execute the recorded transaction for each record.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)

SAP(SYSTEM APPLICATIONS & PRODUCTS IN DATA


PROCESSING)

LEARN SAP ABAP !!





HOME SAP PROCESS SAP-ABAP SAPSAP-OOABAP

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 .

Get a sample recording with the help of  transaction Code SHDB .

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)

Screen look like this.

Click on new recording.

 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)

Click on Start Recording.

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)

Create a master record without single error as per required fields.


Ex: MM01 .. 
Enter the Material number , Industry Sector , Material Type.

Press Enter.

Select the View and click on Continue


sapabapdatatempt.blogspot.com/p/blog-page_2.html 4/18
6/23/2021 Uploading the Master records(MM01) to SAP System using Call Transaction method ( Excel flat file)
Select the View and click on Continue.

Enter material description and base unit of measure.

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.

 Click on save and click on Back.

Select the recording and click on program.

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)

Enter the program name starts with Z or Y <program name >.


Click on Transfer from recording .

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.

Click on Source Code.


Save Package or Local package.

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.

call function 'TEXT_CONVERT_XLS_TO_SAP'    * To upload Excel file data.

  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

Save ->Check -> Activate -> Execute.

Input

Click on F4 and choose the Excel file.

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.

Keep on Clicking  Ok_code button.

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)

Enter your comment...

Popular posts from this blog

FOR ALL ENTRIES (FAE) -4 TABLES USING ALV_GRID_DISPLAY

*&---------------------------------------------------------------------*
*& 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

SAP MM Tables Link and Flow MM flow is processing  between business


organisation and Vendor: 1...Purchase Requisition --- T.code ---ME51 2...Source
List -----T.code-----ME41 3...Request for Quation (RFQ)---T.code--ME21N  (To …

READ MORE


Powered by Blogger

Theme images by mattjeacock

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

You might also like