10-20-2008 11:42 AM
hi friends,
how to split one column data to two columns.
here in one column i have docment numbers i.e material doc and invoice document nos. so i want to split as material doc into material doc columns and invoice document no into invoice columns. here transaction type event for material doc is '1' and transaction type event for invoice doc is '2' .
So here material doc's are greater than or less than the invoice doc's numbers .I what basis i can split the records from one columns to two columns from an internal table.
internal table data:
po item transaction_event document
100000 1 1 560000001
100000 1 1 560000002
100000 1 2 620000004
100000 1 2 620000006
100000 1 2 620000007
so i want these into final table : itab as
po item mat_doc inv_doc
100000 1 560000001 620000004
100000 1 560000002 620000006
100000 1 620000007
10-20-2008 1:13 PM
Hi Prasad,
Declare one more internal table it_final_temp with all the fields fields.
sort it_final on material doc number.
Loop at it_final into wa_final.
v_tabix = sy_tabix + 1.
Read table it_final into wa_final1 index tabix.
if wa_final-mat_doc = wa_final1-mat_doc.
move: < required fields of wa_final and wa_final1 into wa_final_temp>.
Append wa_final_temp to it_final_temp.
else.
move only fields of wa_final to wa_final_temp.
Append wa_final_temp to It_final_temp.
endif.
Endloop.
Regards,
Avi
10-20-2008 11:50 AM
Hello,
Can you explain it cleary because the example which you give is not understanding.
Tell me at which condition we have move to other colum
10-20-2008 12:59 PM
Hi,
I got your requirement but i have a doubt that the invoice document is corresponding to some material document.
I mean how you will come to know which invoice doc is to be written in front of which material doc as in the example given by you.
Please revert back.
Regards
Natasha Garg
10-20-2008 1:07 PM
>
>
> po item mat_doc inv_doc
>
> 100000 1 560000001 620000004
> 100000 1 560000002 620000006
> 100000 1 620000007
You cannot have tables with variable amount of columns.
10-20-2008 1:13 PM
Hi Prasad,
Declare one more internal table it_final_temp with all the fields fields.
sort it_final on material doc number.
Loop at it_final into wa_final.
v_tabix = sy_tabix + 1.
Read table it_final into wa_final1 index tabix.
if wa_final-mat_doc = wa_final1-mat_doc.
move: < required fields of wa_final and wa_final1 into wa_final_temp>.
Append wa_final_temp to it_final_temp.
else.
move only fields of wa_final to wa_final_temp.
Append wa_final_temp to It_final_temp.
endif.
Endloop.
Regards,
Avi