Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

che_eky
Active Contributor
0 Kudos

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.

5 REPLIES 5

Former Member
0 Kudos

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

Former Member
0 Kudos

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

che_eky
Active Contributor
0 Kudos

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.

varma_narayana
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

<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....