Application Development and Automation 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:Ā 
Read only

Configurable Material in Material Master (MM02) using bapi

Former Member
0 Likes
6,347

Hi Expert,

Kindly need your help,

I want to upload for  Plant Specific So that the program should able to create the Configurable Material in MRP3 based on the Material code and Plant in the text file. Other than Material code, Plant and Configurable material the rest will be Configure variant records. The Configure variant record is consist of Char description and Char Value and it must insert row. Is there any suggestion for BAPI and that i can used?

Below is the material information that i want to upload:

    

Source

Target

Length

View

Material Code

MARA-MATNR

18

All

Plant

MARC-WORKS

4

MRP3

Characteristic 1

CABNT-ATBEZ

30

MRP3

Characteristics Value 1

CAWN-ATWRT

30

MRP3

Characteristic 2

CABNT-ATBEZ

30

MRP3

Characteristics Value 2

CAWN-ATWRT

30

MRP3

Characteristic 3

CABNT-ATBEZ

30

MRP3

Characteristics Value 3

CAWN-ATWRT

30

MRP3

Characteristic 4

CABNT-ATBEZ

30

MRP3

Characteristics Value 4

CAWN-ATWRT

30

MRP3

Characteristic 5

CABNT-ATBEZ

30

MRP3

Characteristics Value 5

CAWN-ATWRT

30

MRP3

Until Characteristic 125

CABNT-ATBEZ

30

MRP3

Characteristic Value125

CAWN-ATWRT

30

MRP3


Thanks,

Liyana


8 REPLIES 8
Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,389

Look at those FM//BAPI and perform some seach at scn, as there are already some discussions/documents on those.

  • CLAF_CLASSIFICATION_OF_OBJECTS
  • BAPI_OBJCL_GETDETAIL
  • BAPI_OBJCL_CHANGE

Regards,

Raymond

Read only

0 Likes
4,389

Thanks Raymond for your quick reply.

Read only

Flavio
Active Contributor
0 Likes
4,389

Hi Liyana,

for the same requirement as yours, I have successfully used in the past the function module

'MATERIAL_SAVE_CONFIGURATION'


that has material and plant in the importing interface while, in the structure E1CUVAL, the characteristic name, description (language-dependent, can anyway be omitted) and characteristic value.can be passed.


If you may need any further info, I will be glad to assist.


Thank you and bye,


Flavio

Read only

Former Member
0 Likes
4,389

Hi Flavio,

Thanks for your reply,

How i can upload or make changes for ConfigurableMaterial using BAPI before i proceed to configure variant as shown below

Read only

Flavio
Active Contributor
0 Likes
4,389

Hi Liyana,

You are welcome!

To set the Configurable Material field, you can use the MATERIAL_MAINTAIN_DARK function module.

In the structure AMARC_UEB, the field STDPD is the one to set the Configurable material.

Commit Work after having successfully run the FM (please refer to its documentation).

Thank you and bye,

Flavio

Read only

Former Member
0 Likes
4,389

Below is thecode, but it does not populate any value for configurable Material, Please advise me if there got an information missing.

LOOP AT gt_details INTO gw_details.

     gt_amara_ueb-mandt = sy-mandt.

     gt_amara_ueb-matnr = gw_details-matnr.

     gt_amara_ueb-tcode = 'MM02'.

     gt_amara_ueb-tranc = gt_amara_ueb-tranc + 1.

     APPEND gt_amara_ueb.

     gt_amarc_ueb-mandt = sy-mandt.

     gt_amarc_ueb-matnr = gw_details-matnr.

     gt_amarc_ueb-werks = gw_details-werks.

     gt_amarc_ueb-stdpd = gw_details-stdpd.

     gt_amarc_ueb-tranc = gt_amarc_ueb-tranc + 1.

     APPEND gt_amarc_ueb.

   ENDLOOP.

   CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'

     EXPORTING

       sperrmodus                = 'E'

       max_errors                = 0

       p_kz_no_warn              = 'E'

       kz_prf                    = 'W'  "space

       kz_verw                   = 'X'

       kz_aend                   = 'X'

     IMPORTING

       matnr_last                = gv_matnr_last

       number_errors_transaction = gv_number_errors_transaction

     TABLES

       amara_ueb                 = gt_amara_ueb

*     amakt_ueb                 = gt_amakt_ueb

       amarc_ueb                 = gt_amarc_ueb

       amard_ueb                 = gt_amard_ueb

*     AMFHM_UEB                 =

*     amarm_ueb                 = gt_amarm_ueb

*     AMEA1_UEB                 =

*     ambew_ueb                 = gt_ambew_ueb

*     asteu_ueb                 = gt_asteu_ueb

*     astmm_ueb                 = gt_astmm_ueb

*     amlgn_ueb                 = gt_amlgn_ueb

*     amlgt_ueb                 = gt_amlgt_ueb

*     AMPGD_UEB                 =

*     AMPOP_UEB                 =

*     AMVEG_UEB                 =

*     AMVEU_UEB                 =

*     amvke_ueb                 = gt_amvke_ueb

*     ALTX1_UEB                 =

*     AMPRW_UEB                 =

*     ae1cucfg_ueb              = gt_e1cucfg_ueb

*     ae1cuins_ueb              = gt_e1cuins_ueb

*     ae1cuval_ueb              = gt_e1cuval_ueb

*     ae1cucom_ueb              = gt_e1cucom_ueb

      amfieldres                 = gt_mfieldres

       amerrdat                  = gt_amerrdat

     EXCEPTIONS

       kstatus_empty             = 1

       tkstatus_empty            = 2

       t130m_error               = 3

       internal_error            = 4

       too_many_errors           = 5

       update_error              = 6

       error_propagate_header    = 7

       OTHERS                    = 8.

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


You kindness is much appreciated,

Liyana

Read only

0 Likes
4,389

Hi Liyana,

well, actually I am able to update the Configurable material field, basically using your code above.

I have just reworked it a little bit to adapt it to my sanbox system (material and config material hardcoded, just to make the test), here is the report:


REPORT zflatest.

DATA: gt_amara_ueb TYPE TABLE OF mara_ueb WITH HEADER LINE,

      gt_amarc_ueb TYPE TABLE OF marc_ueb WITH HEADER LINE,

      gv_matnr TYPE matnr.

*LOOP AT gt_details INTO gw_details.

     gv_matnr = '000000000004002050'.

     gt_amara_ueb-mandt = sy-mandt.

     gt_amara_ueb-matnr = gv_matnr.

     gt_amara_ueb-tcode = 'MM02'.

     gt_amara_ueb-tranc = gt_amara_ueb-tranc + 1.

     APPEND gt_amara_ueb.

     gt_amarc_ueb-mandt = sy-mandt.

     gt_amarc_ueb-matnr = gv_matnr.

     gt_amarc_ueb-werks = '4000'.

     gt_amarc_ueb-stdpd = 'C_GLTP'.

     gt_amarc_ueb-tranc = gt_amarc_ueb-tranc + 1.

     APPEND gt_amarc_ueb.

*ENDLOOP.

   CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'

     EXPORTING

       sperrmodus               = 'E'

       max_errors               = 0

       p_kz_no_warn             = 'E'

       kz_prf                   = 'W'  "space

       kz_verw                  = 'X'

       kz_aend                  = 'X'

     IMPORTING

       matnr_last               = gv_matnr

     TABLES

       amara_ueb                = gt_amara_ueb

       amarc_ueb                = gt_amarc_ueb

     EXCEPTIONS

       kstatus_empty            = 1

       tkstatus_empty           = 2

       t130m_error              = 3

       internal_error           = 4

       too_many_errors          = 5

       update_error             = 6

       error_propagate_header   = 7

       OTHERS                   = 8.

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

I have taken one material without Configurable material:

run the report, and here is the successful result:

I hope this could help in some way.

Thanks and bye,

Flavio

Read only

0 Likes
4,389

Hi Flavio,

Big thanks to you , program can run properly already,

If you've no problem, Can u please help me regarding configure variant records using 'FM MATERIAL_SAVE_CONFIGURATION'

I already write a program to configure variant records using above FM, but its not working,

Below is the code:

     lt_e1cuval-charc = gw_details-atnam01.

     lt_e1cuval-value = gw_details-atwrt01.

     APPEND lt_e1cuval.

     lt_e1cuval-charc = gw_details-atnam02.

     lt_e1cuval-value = gw_details-atwrt02.

     APPEND lt_e1cuval.

     lt_e1cuval-charc = gw_details-atnam03.

     lt_e1cuval-value = gw_details-atwrt03.

     APPEND lt_e1cuval.

     lt_e1cuval-charc = gw_details-atnam04.

     lt_e1cuval-value = gw_details-atwrt04.

     APPEND lt_e1cuval.

     lt_e1cuval-charc = gw_details-atnam05.

     lt_e1cuval-value = gw_details-atwrt05.

     APPEND lt_e1cuval.


*  2. Save Configuration with FM MATERIAL_SAVE_CONFIGURATION at client

*  and Plant level.

*---------- Client-specific configuration--------------------------------------

     CALL FUNCTION 'MATERIAL_SAVE_CONFIGURATION'

       EXPORTING

         material       = gw_details-matnr

                                            " conf_matl      = lv_matnr

       TABLES

         e1cucfg        = lt_e1cucfg

         e1cuins        = lt_e1cuins

         e1cuval        = lt_e1cuval

         e1cucom        = lt_e1cucom

         returnmessages = gt_returnmessages.


     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


*-----------Plant-specific configuration-----------------------------------------

*---Save the configuration for each plant-----------------------------------

     CALL FUNCTION 'MATERIAL_SAVE_CONFIGURATION'

       EXPORTING

         material        = gw_details-matnr

         plant           = gw_details-werks     "iv_plant

         conf_matl_plant = gw_details-stdpd

       TABLES

         e1cucfg_w       = lt_e1cucfg

         e1cuins_w       = lt_e1cuins

         e1cuval_w       = lt_e1cuval

         e1cucom_w       = lt_e1cucom

         returnmessages  = gt_returnmessages.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


Please assist,

Liyana