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

Internal table fields

Former Member
0 Likes
543

can i take my internal table names as variable.

i have a scenario like i have a internal table of type pa0008 say i0008. now i m applying a do loop on p0008 getting all wages for a partcular person. now i want to enter the ammount corresponding to all wage types in i0008. i want to do it in loop. like if the amount is coming from beto1 then it shoul go in i0008-bet01 if it is coming from bet02 then it shuld go into i0008-bet02 like wise for all. m using a 'MOVE' statment for transferring in i0008. now i want to take fields of i0008 in a variable like if loop index is 1 then field shud be bet01, if index 2 field shud be bet02 like wise.can i get name of field of internal table at run time in variable and use it for transferring data.

4 REPLIES 4
Read only

Former Member
0 Likes
512

Hi,

Try this..using ASSIGN COMPONENT.

FIELD-SYMBOLS <fs>.

Use the function module GET_COMPONENT_LIST to get the fieldnames of the internal table...And then store it in the internal table ITAB.

DESCRIBLE TABLE ITAB.

DATA: V_NUMC(2) TYPE N.

DO sy-tfill TIMES.

V_NUMC = SY-INDEX.

CONCATENATE 'BET' V_NUMC TO V_VARIABLE.

ASSIGN COMPONENT (V_VARIABLE) OF STRUCTURE I0008 TO <FS>.

ENDDO.

Thanks,

Naren

Read only

0 Likes
512

Thanks Naren,

i tried it, but it is not accepting v_variable.

it says, field v_variable is unknown. i declared it as

data: v_variable(8) type c.

Read only

0 Likes
512

try this

just v_variable(8) is enough

by default dat type will be character in abap

Read only

0 Likes
512

naren,,

but its is not recognising it as field if i use

assign component (v_variable) of structure i0008 to <fs>.

tell me watelse i can do.

what is the significance of module 'GET_COMPONENT_LIST'.