2012 Oct 22 2:01 PM
Hi experts,
I have some issue regarding to field mapping between dictionary structure and bapi structure. So basically here is the problem, the problem lies between structure MARC and BAPIE1MARC.
DATA: lwa_plantdata TYPE bapie1marc.
wmarc TYPE marc.
So, I want to move-corresponding(mapping) fields between these 2 structures, but I cannot use MOVE-CORRESPONDING syntax as fieldname are different between a BAPI structure and standard structure in dictionary. Furthermore, this is happen in a dynamic condition and below is part of the codes in which I want to extend the material to various plants using BAPI_MATERIAL_SAVEREPLICA.
Any idea on how to achieve this particularly on what I want to do in the arrow line?
* Loop at each extended plant
LOOP AT lt_werks INTO lwa_werks.
* Populate plant info
lwa_plantdata-function = lc_upd.
lwa_plantdata-material = wmarc-matnr.
lwa_plantdata-plant = lwa_werks-werks.
LOOP AT lt_tab_fieldname INTO lwa_tab_fieldname. "defined fields
ASSIGN lwa_tab_fieldname-fieldname_ext TO <lfs_fieldname>. "will store the fieldname which refer to MARC
ASSIGN COMPONENT <lfs_fieldname> OF STRUCTURE wmarc TO <lfs_fieldval>.
----------------> "lwa_plantdata-<CORRESPONDING FIELD NAME WHICH REFER TO WMARC field> = <lfs_fieldval>.
ENDLOOP.
APPEND lwa_plantdata TO lt_plantdata.
lwa_plantdatax-function = lc_upd.
lwa_plantdatax-material = wmarc-matnr.
lwa_plantdatax-plant = lwa_werks-werks.
LOOP AT lt_tab_fieldname INTO lwa_tab_fieldname.
ENDLOOP.
APPEND lwa_plantdatax TO lt_plantdatax.
ENDLOOP.
Hi experts,
I have some issue regarding to field mapping between dictionary structure and bapi structure. So basically here is the problem, the problem lies between structure MARC and BAPIE1MARC.
DATA: lwa_plantdata TYPE bapie1marc.
wmarc TYPE marc.
So, I want to move-corresponding(mapping) fields between these 2 structures, but I cannot use MOVE-CORRESPONDING syntax as fieldname are different between a BAPI structure and standard structure in dictionary. Furthermore, this is happen in a dynamic condition and below is part of the codes in which I want to extend the material to various plants using BAPI_MATERIAL_SAVEREPLICA.
Any idea on how to achieve this particularly on what I want to do in the arrow line?
* Loop at each extended plant
LOOP AT lt_werks INTO lwa_werks.
* Populate plant info
lwa_plantdata-function = lc_upd.
lwa_plantdata-material = wmarc-matnr.
lwa_plantdata-plant = lwa_werks-werks.
LOOP AT lt_tab_fieldname INTO lwa_tab_fieldname. "defined fields
ASSIGN lwa_tab_fieldname-fieldname_ext TO <lfs_fieldname>. "will store the fieldname which refer to MARC
ASSIGN COMPONENT <lfs_fieldname> OF STRUCTURE wmarc TO <lfs_fieldval>.
----------------> "lwa_plantdata-<CORRESPONDING FIELD NAME WHICH REFER TO WMARC field> = <lfs_fieldval>.
ENDLOOP.
APPEND lwa_plantdata TO lt_plantdata.
lwa_plantdatax-function = lc_upd.
lwa_plantdatax-material = wmarc-matnr.
lwa_plantdatax-plant = lwa_werks-werks.
LOOP AT lt_tab_fieldname INTO lwa_tab_fieldname.
ENDLOOP.
APPEND lwa_plantdatax TO lt_plantdatax.
ENDLOOP.
2012 Oct 22 2:49 PM
2012 Oct 22 4:39 PM
You could try to use MAP2I_BAPI_MARC_TO_MARC_UEB.
1. Move-corresponding lwa_plantdata to FM importing structure BAPI_MARC
2. call the FM
3. Move-corresponding MARC_UEB to wmarc.
Hope this helps.
2012 Oct 22 7:14 PM
Perform a where-used on BAPI structure, you may find a MAP* FM to map corresponding data, when none found, transaction BDBS can help you to generate a Z-mapping FM.
Read documentation like Converting Between Int. and Ext. Data Formats and Structures.
Regards,
Raymond
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |