‎2008 Dec 31 11:37 AM
hi,
i have a requirement in which i hav to upload file which has field names in the 1st row and the actual data starts from the second row..
for this i need to create two work areas w1(each field with 40 char length) to move field names of first row..and work area w2 (of actual length of data) to move actual data.
when coming to file there will be any number of fields like, it might contain 30 fields or 10 fields. for both the cases it should work.
and in the file the fields might be shuffled i.e., i did coding for field sequence f1 f2 f3 f4. and in future this might be f2 f4 f3 f1...
so i have to move field values from second row to 2nd work area based on the field name of work area w1..
we have to use case statement like
case w1-field
when indicator
w2-ind = file-ind
when company code
w2-bukrs = file-bukrs.....etc
like this i hav to use its seems
can anyone help me in getting this logic
‎2008 Dec 31 11:56 AM
hi
u can use as follows....
case seq
when 'seq1'
wa-fld1 = field1,
wa-fld2 = field2,
wa-fld3 = field3,
wa-fld4 = field4.
when 'seq2'
wa-fld1 = field2,
wa-fld2 = field4,
wa-fld3 = field1,
wa-fld4 = field3.
when 'seq3'
................ so on
where you have seq as parameter.
regards
sateesh kumar
‎2009 Jan 02 6:19 AM
hi,
i hav to fill second work area based on the field name of first work area.....
‎2009 Jan 02 8:53 AM
Hi,
For this requirement, you can use Field symbols.
Based on the value of the workarea1, assign the field name(field name in work area2) to a field symbol and pass the correspoding value to the field using the field symbol.Hope it will work.
Regards,
Prasana.
‎2009 Jan 02 10:28 AM
hi prasanna,
can u plz send the sample code for which u have explained.....
‎2009 Jan 02 10:58 AM
Hi,
say suppose wa1 is having fields f1,f2,f3 and wa2 is having g1,g2,g3,g4.
field-symbols: <fs1> type any.
<fs1> = 'wa1-'
if wa1-f1 eq 'a'.
concatenate <fs1> 'g4' into <fs1>.
assign (itab-fieldvalue) to <fs1>.
endif.
‎2009 Jan 02 11:06 AM
Sorry ignore the previous post. It was accidently sent.
Please refer the below code.
data: begin of wa1,
f1 type string,
f2 type string,
f3 type string,
end of wa1,
begin of wa2,
g1 type string,
g2 type string,
g3 type string,
g4 type string,
end of wa2.
start-of-selection.
field-symbols: <fs1> type any.
data: w_string type string.
assign 'wa2-' to <fs1>.
wa1-f1 = 'a'.
wa1-f2 = 'b'.
wa1-f3 = 'c'.
if wa1-f1 = 'a'.
concatenate <fs1> 'g2' into w_string.
assign (w_string) to <fs1>.
<fs1> = wa1-f3.
endif.
write: <fs1>.
Regards,
Prasana.
‎2009 Jan 02 10:44 AM
Hi,
Try with READ_BY_LINE parameter in FM then it reads 2nd row directly from fupload file.
Regards
Md.MahaboobKhan