10-14-2008 9:25 AM
Hi All,
i have a structure p0041. It has some fields like dar01, dat01, dar02, dat02, dar03, dat03 etc etc...
i have to insert new values like '99' to darXX and '20081220' to datXX.
The problem is some records have dar01 and dat01 filled, some have dar01, dat01 , dar02 , dat02 filled like that.
In the first case i have to insert the new values to dar02 and dat02 respectively as (dar01, dat01 is filled) and for the second case i have to insert new values
to dar03 and dat03 respectively as upto dar02 dat 02 are filled here.
I know that i have to use field-symbols here to identify the field names to which the new values are to be inserted.
Please let me know how to achieve this.
Thanks & Regards,
Soumya.
10-14-2008 9:30 AM
Hi Soumya,
Check out the Below sample code.
CONCATENATE 'IT_FINAL-DMBTR' l_tabix INTO l_field_qty.
ASSIGN: COMPONENT 'DMBTR' OF STRUCTURE it1_mseg TO <fs>.
ASSIGN: l_field_qty TO <fs1>.
Thanks,
Chidanand
10-14-2008 9:39 AM
maybe like this
do.
lf_index = sy-index.
assign component lf_index of structure p0041 to <fs>.
if subrc >< 0.
exit.
endif.
if <fs> is initial.
<fs> = '99'.
add 1 to lf_index.
assign component lf_index of structure p0041 to <fs>.
<fs> = '20081220'.
exit.
endif.
enddo.
Thomas
10-14-2008 9:43 AM
Hi,
u can code like this...
DATA: F1(5) TYPE C VALUE 'DAR',
F2(10) TYPE C,
COUNT TYPE I.
FIELD-SYMBOLS: <FS>.
DO.
COUNT = COUNT + 1.
CONCATENATE F1 COUNT INTO F2.
CONDENSE F2.
ASSIGN COMPONENT F2 OF STRUCTURE P0041 TO <FS>.
IF <FS> IS ASSIGNED.
IF <FS> IS NOT INITIAL.
CONTINUE.
ELSE.
<FS> = NEW CODE.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
I think this code may help u....
Edited by: Sukriti Saha on Oct 14, 2008 10:44 AM