05-10-2013 5:34 PM
Hello Friends,
I have the following requirement, My apologies if I put in the wrong forum.
I need to populate a internal table workarea, where the field names of the workarea are stored in another internal table
eg: IT_GLACCOUNT_TAB TYPE STANDARD TABLE OF /BI0/PGL_ACCOUNT,
IWA_GLACCOUNT_TAB TYPE /BI0/PGL_ACCOUNT
TYPES: BEGIN OF I_ATTRIBUTES_HEADER,
EPMNODE TYPE C LENGTH 50,
BWNODE TYPE C LENGTH 50,
TECHBWNODE TYPE C LENGTH 50,
END OF I_ATTRIBUTES_HEADER. -- this would contain the technical names of the attributes for eg
EPMNODE BWNODE TECHBWNODE
glaccount 0gl_account glaccount
acct_type zaccttype /bic/zaccttype
I should not write
iwa_glaccount_tab-glaccount = '110001'
instead glaccount field name should be read from the intenal table above inside the loop
eg:
loop into...
iwa_glaccount_tab-"here I should have the dynamic field populated from internal table" = '110001'
endloop
05-10-2013 5:40 PM
Hi,
I think you can accomplish this via field symbols e.g.
FIELD-SYMBOLS <fs> TYPE ANY STANDARD TABLE.
ASSIGN itab TO <fs>.
READ TABLE <fs> WITH TABLE KEY = <KEY FIELD> INTO wa
05-10-2013 5:40 PM
Hi,
I think you can accomplish this via field symbols e.g.
FIELD-SYMBOLS <fs> TYPE ANY STANDARD TABLE.
ASSIGN itab TO <fs>.
READ TABLE <fs> WITH TABLE KEY = <KEY FIELD> INTO wa
05-10-2013 6:37 PM
Hi,
You can do this using field symbol.
FIELD-SYMBOLS:
<fs_itab> TYPE ANY, "Holds a details of attribute
<fs_field> TYPE ANY. " Holds attribute name
DATA:
it_fields TYPE TABLE OF i_attributes_header,
wa_fields TYPE i_attributes_header.
LOOP AT it_field INTO wa_fields.
ASSIGN COMPONENT wa_fields-epmnode OF STRUCTURE iwa_glaccount_tab TO <fs_itab>.
<fs_itab> = "your_value".
ENDLOOP.
Hope you got
05-10-2013 6:43 PM
Thanks Satish,
I got the value, what I was not able to figure out is to assign to the workarea.
Because the workarea fields also need to come from the same internal table
like
iwa_glaccount_tab-glaccount = 'my value'
now glaccount also should come from the table, I was not able to write to make it dynamic.
05-10-2013 7:17 PM