‎2008 Aug 12 4:28 PM
Hi friends plz go through my requirement and provide me a solution for it.
data :
wa_t343j type t343j.
start-of-selection.
select single *
into wa_t343j
from t343j
WHERE lgnum = 'XYZ' and
lgtyp = 'ABC'.
In the work area wa_t343j iam getting the following values
lgnum lgtyp ste01 ste02 ste03 st304 ste05 ste06 ste07 ste08
XYZ ABC 5 3 1 2 4
now my requiremnt is i want this value in a sepearte internal table in the below format.
data :
begin of it_temp,
index type i,
field type ltap-vlpla,
value type ltap-vlpla,
end of it_temp.
Internal table it_temp
Index field value
1 LGNUM XYZ
2 LGTYP ABC
3 STE01 5
4 STE02
9 STE07 4
10 STE08
i need those values in this format.
Thanks in advance,
Regards,
Kumar.
Edited by: satish abap on Aug 12, 2008 8:59 PM
‎2008 Aug 12 4:52 PM
Do something like this..
Types : begin of tt_temp,
index type i,
field type char30,
value type char30,
end of tt_temp.
data: it_temp type table of tt_temp.
data: wa_temp like line of it_temp.
data: it_fieldlist type table of rstrucinfo.
data: wa_fieldlist like line of it_fieldlist.
data: lv_repid type sy-repid.
FIELD-SYMBOLS: <fs> type any.
lv_repid = sy-repid.
call function 'GET_COMPONENT_LIST'
exporting
program = lv_repid
fieldname = 'wa_t343j'
tables
components = it_fieldlist.
Loop at it_fieldlist into wa_fieldlist.
clear wa_temp.
wa_temp-index = sy-tabix.
wa_temp-field = wa_fieldlist-compname.
assign COMPONENT wa_temp-field of STRUCTURE wa_t343j to <fs>.
wa_temp-value = <fs>.
append wa_temp to it_temp.
endloop.Regards,
Rich Heilman
‎2008 Aug 12 4:33 PM
Have you tried reading directly into the new internal table with the INTO CORRESPONDING FIELDS OF TABLE statement?
‎2008 Aug 12 4:33 PM
try out...
read table (workarea) itab1
it1-field1 = 1.
it1-field2 = 'lgnum'.
it1-field3 = itab1-lgnum.
append it1.
do this for all fields....
‎2008 Aug 12 4:35 PM
Hi,
try this...
in your work area you have the data.
take the first field
count = count + 1.
MOVE count to it_temp-index.
MOVe 'LGNUM' to it_temp-field.
MOVe wa_t343j-lgnum to it_temp-value.
append it_temp.
clear: it_temp.
do the same thing for all the fields.
Regards,
Venkatesh.
‎2008 Aug 12 4:52 PM
Do something like this..
Types : begin of tt_temp,
index type i,
field type char30,
value type char30,
end of tt_temp.
data: it_temp type table of tt_temp.
data: wa_temp like line of it_temp.
data: it_fieldlist type table of rstrucinfo.
data: wa_fieldlist like line of it_fieldlist.
data: lv_repid type sy-repid.
FIELD-SYMBOLS: <fs> type any.
lv_repid = sy-repid.
call function 'GET_COMPONENT_LIST'
exporting
program = lv_repid
fieldname = 'wa_t343j'
tables
components = it_fieldlist.
Loop at it_fieldlist into wa_fieldlist.
clear wa_temp.
wa_temp-index = sy-tabix.
wa_temp-field = wa_fieldlist-compname.
assign COMPONENT wa_temp-field of STRUCTURE wa_t343j to <fs>.
wa_temp-value = <fs>.
append wa_temp to it_temp.
endloop.Regards,
Rich Heilman
‎2008 Aug 12 5:09 PM
Thanks
Rich Heilman .
with your valuable code iam able to move forward in solving my clients requirement.
Regards,
Satish.
‎2008 Aug 12 5:12 PM
‎2008 Aug 12 5:30 PM
ok sure Rich.
I have just posted one more question regardind looping T_QMAT internal table of LT03 transcation.
Just go through it and plz provide a solution for it Rich.