‎2010 Jan 07 11:30 AM
Hi ,
I am facing one problem with field symbol actually there is a internal table where i have 16 fields like 'WOG001' , 'WOG002' and so on . This 001 is the period which the user will enter in the selection criteria . For that i have put a DO ENDO .
HERE IS THE CODE ..
do l_period times
LOOP AT T_COSP INTO WA_COSP
CONCATENATE 'WA_FINAL-' 'WOG' L_RUNPERIOD INTO TEXT_WA.
CONDENSE TEXT_WA.
ASSIGN (TEXT_WA) TO <FS>.
CONCATENATE 'WA_COSP1-' 'WOG' L_RUNPERIOD INTO TEXT_WA1.
CONDENSE TEXT_WA1.
ASSIGN (TEXT_WA1) TO <FS_WA>.
MOVE <FS_WA> TO <FS>.
UNASSIGN <FS>.
UNASSIGN <FS_WA>.
append <wa_final> to <t_final>
endloop.
enddo.
By this i m trying to do like if period is 001 so
WA_FINAL-WOG001 = WA_COSP-WOG001.
AND SO ON...
THIS IS SHOWING ME DUMP .
IS THERE ANYWAY TO SOLVE THIS
REGARDS
NIKHIL ARYA .
‎2010 Jan 07 11:49 AM
Hi nikhil,
This should normally work. Just make sure a couple of things.
1.
CONCATENATE 'WA_FINAL-' 'WOG' L_RUNPERIOD INTO TEXT_WA.
CONDENSE TEXT_WA
If make sure the value of L_RUNPERIOD is 001 only and not preceded by spaces.
If yes, then condense L_RUNPERIOD before CONDENSE TEXT_WA.
2. Just copy paste to get the feel.
The variable HELLO2 gets populate from HELLO1 using this concept.
in debugging, just make sure the FULL VARIABLE Name, in CAPITALS is ok and does not have any spaces to the left or in between.
report abc.
field-symbols : <FS1>.
field-symbols : <FS2>.
data : HELLO1(10) type c value 'amit'.
data : HELLO2(10) type c value ''.
data : varname1(30) type c.
data : varname2(30) type c.
varname1 = 'HELLO1'.
varname2 = 'HELLO2'.
assign (varname1) to <fs1>.
assign (varname2) to <fs2>.
move <fs1> to <fs2>.
write hello2.
regards,
amit m.
Edited by: Amit Mittal on Jan 7, 2010 5:19 PM
‎2010 Jan 07 11:57 AM
Hi amit ,
thanks amit for the reply .
DATA : TEXT_WA(16) TYPE C,
TEXT_WA1(16) TYPE C.
FIELD-SYMBOLS : <FIELD1>,
<FS> TYPE ANY ,
<FS_WA> TYPE ANY.
L_RUNPERIOD = S_PERIOD-LOW.
IT IS NOTHING I M PUTTING THE LOW RANGE IN THAT AND INCREMENTING IT BEFORE THE ENDDO STATEMENT .
AND TO BE FRANK I DIDNT GET UR SOLUTION CAN U EXPLAIN IT ONCE MORE ..
THANKS
NIKHIL.
‎2010 Jan 07 12:37 PM
Hi again,
My point is the variable TEXT_WA.
I suppose you r getting error at the following line (in debugging)
ASSIGN (TEXT_WA) TO <FS>
Before this line, just make sure what the variable TEXT_WA contains. It should EXACTLY contain
the field you mentioned, in full, in capitals.
eg. TABLENAME-FIELDNAME
It should be without spaces in between or to the left.
Generally such error occurs when the variable name is not correct.
Hope this helps.
regards,
amit m.
‎2010 Jan 07 11:54 AM
Hi
which dump?
How do u fill L_RUNPERIOD?
CLEAR L_RUNPERIOD.
DO 16 TIMES.
L_RUNPERIOD = L_RUNPERIOD + 1.
CONCATENATE 'WA_FINAL-' 'WOG' L_RUNPERIOD INTO TEXT_WA.
CONDENSE TEXT_WA.
ASSIGN (TEXT_WA) TO <FS>.
CONCATENATE 'WA_COSP1-' 'WOG' L_RUNPERIOD INTO TEXT_WA1.
CONDENSE TEXT_WA1.
ASSIGN (TEXT_WA1) TO <FS_WA>.
MOVE <FS_WA> TO <FS>.
ENDDO.
‎2010 Jan 07 12:02 PM
Hello,
for assigning a component of a structured variable as in your code, you have to use the following syntax:
ASSIGN COMPONENT comp_name OF STRUCTURE (struct_name) TO <field_symbol>.Check the online help of the ASSIGN statement for details.
Regards,
David