10-31-2007 9:10 AM
hi i m using fm 'ALSM_EXCEL_TO_INTERNAL_TABLE'
i am getting data in the format
ROW COL VALUE
0001 0001 178
0001 0002 12
0001 0003 PAC1
0001 0004 DESC
0001 0005 DIV1
0002 0001 178
0002 0002 15
0002 0003 PAC2
0002 0004 DESC
0002 0005 DIV2
and want to convert that data in internal table in this format
178 12 PAC1 DESC DIV1
178 15 PAC2 DESC DIV2
Thanks
10-31-2007 10:35 AM
The following psuedo code logic should help you:
Say the table returned from the FM is called l_it_data.
Define a table with your required colulmns:
begin of l_it_result
col1,
col2,
col3,
col4,
col5,
end of l_it_result
sort l_it_data by ROW.
loop at l_it_data into l_wa_data.
case l_wa_data-col.
when '0001'
l_wa_result-col1 = l_wa_data-value.
when '0002'
l_wa_result-col2 = l_wa_data-value.
when '0003'
l_wa_result-col3 = l_wa_data-value.
when '0004'
l_wa_result-col4 = l_wa_data-value.
when '0005'
l_wa_result-col5 = l_wa_data-value.
endcase.
at end of row.
append l_wa_result to l_it_result.
endat.
endloop.
10-31-2007 10:19 AM
hi lucky,
you mean to say is u want to print the internal table data, in the format given by you .
kindly comeback with your clarification
10-31-2007 10:28 AM
Hi Lucky,
Instead of using the given FM, use the FM TEXT_CONVERT_XLS_TO_SAP.
This will upload the file in the internal table, the way u want..
Thank you.
Reward points if found useful
10-31-2007 10:35 AM
The following psuedo code logic should help you:
Say the table returned from the FM is called l_it_data.
Define a table with your required colulmns:
begin of l_it_result
col1,
col2,
col3,
col4,
col5,
end of l_it_result
sort l_it_data by ROW.
loop at l_it_data into l_wa_data.
case l_wa_data-col.
when '0001'
l_wa_result-col1 = l_wa_data-value.
when '0002'
l_wa_result-col2 = l_wa_data-value.
when '0003'
l_wa_result-col3 = l_wa_data-value.
when '0004'
l_wa_result-col4 = l_wa_data-value.
when '0005'
l_wa_result-col5 = l_wa_data-value.
endcase.
at end of row.
append l_wa_result to l_it_result.
endat.
endloop.
10-31-2007 10:40 AM
Hi..
You can use the FM GUI_Upload to get the data in this format into the internal table directly, instead of calling the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE'.
reward if Helpful.
10-31-2007 10:56 AM
<b>Hi lucky</b>
Use this function module...
<b>FILE_READ_AND_CONVERT_SAP_DATA.</b>
WILL CONVERT THE DATA INTO INTERNAL TABLE.
REWARDS IF HELPFUL....