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: 

assigning values to dynamic fields of a workarea

sap_user62
Active Participant
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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.

0 Kudos

Did you got the solution?