‎2008 May 25 12:38 PM
Hi,
I have to use the BAPI, BAPI_MATERIAL_SAVEDATA to extend the material to different plant specific views. I have to use the structure BAPI_MARC and other structures in order to do this. But the values to be passed to the structure BAPI_MARC are not fixed. These values will be maintained in a custom table against the structure name and field name for a particular plant.
In the program I have to extract the structure name and field name for a corresponding plant from custom table and fill the corresponding value in BAPI structure BAPI_MARC.
Now, internal table in the program is having these details.
How can I fill the bapi structure BAPI_MARC based on this information.
For example, if in custom table, value 0001 is maintained against the field PUR_GROUP, I have to fill the field PUR_GROUP in strcutre BAPI_MARC with 0001.
Hope I am clear in explaining the problem. Please let me know how to aciheve this?
Best Regards,
Kumar.
‎2008 May 25 1:03 PM
extract the custom table entries to a internal table .
(i assume that the internal table has two fields, NAME and VALUE and name holds PUR_GROUP and value holds 0001)
field-symbols: <fs> type BAPI_MARC ,
<field> type any .
loop at customitab into itab_wa.
assign component itab_wa-name of structure <fs> to <field> .
if <field> is assigned .
<field> = itab_wa-value .
endif .
endloop .
‎2008 May 25 1:03 PM
extract the custom table entries to a internal table .
(i assume that the internal table has two fields, NAME and VALUE and name holds PUR_GROUP and value holds 0001)
field-symbols: <fs> type BAPI_MARC ,
<field> type any .
loop at customitab into itab_wa.
assign component itab_wa-name of structure <fs> to <field> .
if <field> is assigned .
<field> = itab_wa-value .
endif .
endloop .
‎2008 May 25 1:20 PM
Hi,
Thanks for your reply. But assign is not succesful. Could you help me in solving this please?
Best Regards,
Kumar.
‎2008 May 25 1:24 PM
do you mean if <field> assigned is failing?
what is the value of itab_wa-name in the following stt.
assign component itab_wa-name of structure <fs> to <field> .
‎2008 May 25 1:28 PM
Hi,
I have tried to implement that in a sample program first. Please have a look at the code below.
DATA: BEGIN OF line,
col1 TYPE i,
col2 TYPE i,
col3 TYPE i,
END OF line.
DATA comp(4) TYPE c VALUE 'COL3'.
FIELD-SYMBOLS: <f1> TYPE ANY, <f3> TYPE ANY.
ASSIGN line TO <f1>.
ASSIGN COMPONENT comp OF STRUCTURE <f1> TO <f3>.
IF <f3> IS ASSIGNED.
ENDIF.
I checked in the debugging mode and the value of <f3> in debugging mode is 0, but not line-col3.
Best Regards,
Kumar
‎2008 May 25 1:34 PM
when <f3> is assinged, you are not assigning the field name to the field-symbol.
‎2008 May 25 1:40 PM
Hi,
I am not much familiar with field symbols. If you dont mind, could you please help me in getting the value line-col3 in field symbol <f3>? So, that if I assign some value to <f3>, it should get reflected in line-col3 field.
Thank you very much for your help.
Best Regards,
Kumar.