Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI for the transaction MM02 for Production Version: Mass Processing

Former Member
0 Kudos

Hi,

Could someone tell me a relevant BAPI for the transaction MM02 for Production Version: Mass Processing?

Nalina

1 ACCEPTED SOLUTION

former_member438956
Active Participant
0 Kudos

Hi Nalina,

Instead of going with BAPI go for BDC as I have done the same when uploading REM data and uploaded huge amount of data with no errors.

The template for uploading is :

MATNR WERKS SAUFT SFEPR VERID TEXT1 PLNTY PLNNR ALNAL STLAL STLAN MDV01 ELPRO ALORT

Regards,

Anil N.

6 REPLIES 6

Former Member
0 Kudos

Hi,

please try BAPI_MATERIAL_SAVEREPLICA.

Kind regards,

Peter

Former Member
0 Kudos

Hello,

You can use the following BAPI's

1) /SAPMP/BAPI_MATERIAL_SAVEDATA -Create and change of Material Master Data.

2) BAPI_MATERIAL_EDIT - To change a material

3)BAPI_MATERIAL_GETALL - To get all the material No.

4)BAPI_MATERIAL_SAVEREPLICA - To change material master data.

former_member438956
Active Participant
0 Kudos

Hi Nalina,

Instead of going with BAPI go for BDC as I have done the same when uploading REM data and uploaded huge amount of data with no errors.

The template for uploading is :

MATNR WERKS SAUFT SFEPR VERID TEXT1 PLNTY PLNNR ALNAL STLAL STLAN MDV01 ELPRO ALORT

Regards,

Anil N.

0 Kudos

Hi Anil Nautiyal,

If you dont mind, could you send me that BDC Upload program codin please?

Nalina

0 Kudos

Hi Nalina,

I cannot paste the entire code as the message size cannot exceed more than 15000 characters. So I am giving only the BDC part wherein the logic has been written. input the file with value as per the template specified in the previous post.


  LOOP AT it_data INTO wa_data.

    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0060'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'RMMG1-MATNR'
                                  wa_data-matnr.

    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0070'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(06)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.

    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            input  = wa_data-matnr
          IMPORTING
            output = wa_data-matnr.

    select single * from mara where matnr =  wa_data-matnr.

    if sy-subrc <> 0.
        flag = 1.

        wa_messages-msgtyp = 'E'.
        wa_messages-matnr = wa_data-matnr.
        wa_messages-werks = wa_data-werks.
*        wa_messages-message = wa_data-matnr + ' ' + text-005.
        concatenate wa_data-matnr 'does not exist in table mara.' into wa_messages-message separated by space.
        APPEND wa_messages TO it_messages.
        CLEAR wa_messages.

    else.

      CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW'
                EXPORTING
                  material                  = wa_data-matnr                 "Material to which char.values are attached
                  materialart               = mara-mtart                 "Material type
                  selection                 = 'D'                           "Indicator for MRP3 view
                  tcode                     = 'MM02'                        "Transaction code
                TABLES
                  btci_d0070                = it_bdcdata1                   "Internal table from which position of MRP3 view can be found out
                EXCEPTIONS
                  material_not_found        = 1
                  material_number_missing   = 2
                  material_type_missing     = 3
                  material_type_not_found   = 4
                  no_active_dynpro_selected = 5
                  no_authority              = 6
                  OTHERS                    = 7.

              IF sy-subrc <> 0.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ENDIF.

               LOOP AT it_bdcdata1 INTO wa_bdcdata1 WHERE fval = 'X'.

*Take the position no.of MRP4 view
                var_view = wa_bdcdata1-fnam+17(2).

                sel_view = var_view.
                CONDENSE sel_view NO-GAPS.
                ctr = ctr + 1.


                IF ctr EQ 4.
                  CONCATENATE 'MSICHTAUSW-KZSEL(0' sel_view ')' INTO view.

                  PERFORM bdc_field       USING view 'X'.

                  CLEAR ctr.
                  EXIT.
                ENDIF.

                CLEAR view.
                CLEAR wa_bdcdata1.
              ENDLOOP.

*CONCATENATE 'MSICHTAUSW-KZSEL(' zchar ')' INTO VAR1.
*    PERFORM bdc_field       USING var1    "'MSICHTAUSW-KZSEL ( zchar )'
*                              'X'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0080'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RMMG1-WERKS'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM bdc_field       USING 'RMMG1-WERKS'
                                  wa_data-werks.

    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=PB03'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARC-SFEPR'.
    PERFORM bdc_field       USING 'MARC-SAUFT'
                                  wa_data-sauft.

    PERFORM bdc_field       USING 'MARC-ALTSL'
                                  '2'.


    PERFORM bdc_field       USING 'MARC-SFEPR'
                                  wa_data-sfepr.

    PERFORM bdc_dynpro      USING 'SAPLMDIA' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MKAL-TEXT1(01)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.

    PERFORM bdc_field       USING 'MKAL-VERID(01)'
                                  wa_data-verid.

    PERFORM bdc_field       USING 'MKAL-TEXT1(01)'
                                  wa_data-text1.

    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=PB03'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.

    PERFORM bdc_dynpro      USING 'SAPLMDIA' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MKAL-TEXT1(01)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=DETA'.

    PERFORM bdc_dynpro      USING 'SAPLMDIA' '0200'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MKAL-ALORT'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=PRFG'.
    PERFORM bdc_field       USING 'MKAL-PLNTY'
                                  wa_data-plnty.
    PERFORM bdc_field       USING 'MKAL-PLNNR'
                                  wa_data-plnnr.
    PERFORM bdc_field       USING 'MKAL-ALNAL'
                                  wa_data-alnal.
    PERFORM bdc_field       USING 'MKAL-STLAL'
                                  wa_data-stlal.
    PERFORM bdc_field       USING 'MKAL-SERKZ'
                                  wa_data-sauft.

    PERFORM bdc_field       USING 'MKAL-STLAN'
                                  wa_data-stlan.
    PERFORM bdc_field       USING 'MKAL-MDV01'
                                  wa_data-mdv01.
    PERFORM bdc_field       USING 'MKAL-ELPRO'
                                  wa_data-elpro.
    PERFORM bdc_field       USING 'MKAL-ALORT'
                                  wa_data-alort.

    PERFORM bdc_dynpro      USING 'SAPMSSY0' '0120'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  '01/02'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=RW'.

    PERFORM bdc_dynpro      USING 'SAPLMDIA' '0200'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MKAL-TEXT1'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.

    PERFORM bdc_dynpro      USING 'SAPLMDIA' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RM03T-AKTZL'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.

    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=BU'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.

    IF p_modea = 'X'.
      l_option = 'A'.
    ELSEIF p_modee = 'X'.
      l_option = 'E'.
    ELSEIF p_moden = 'X'.
      l_option = 'N'.
    ENDIF.

    CALL TRANSACTION 'MM02' USING it_bdcdata MODE l_option
          UPDATE 'S' MESSAGES INTO it_bdcmsg.

    REFRESH it_bdcdata.

    PERFORM write_msg using wa_data-matnr.

Hope it will solve ur problem.

Regards,

Anil N.

Former Member
0 Kudos

Hi,

use the following steps to find a BAPI for any transaction

1.Open transaction SE24.

2.Now open the object CL_EXITHANDLER in display mode.

3.Go to the method tab and double click on the method GET_INSTANCE.

4.Put a break point on cl_exithandler=>get_class_name_by_interface.

5.Now execute the transaction you want to find BAPI for, it will take you to the above method.

6.Write EXIT_HANDLER in fieldnames and hit enter, it will tell you the BAPI used for your transaction.

7.Hit F8 and it will tell you all the BAPIu2019s for your transaction.

Regards

Rajesh Kumar