‎2007 May 31 6:29 AM
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.
‎2007 May 31 6:36 AM
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
‎2007 May 31 6:49 AM
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.
‎2007 May 31 6:55 AM
try this
just v_variable(8) is enough
by default dat type will be character in abap
‎2007 May 31 6:59 AM
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'.