I want to sort the records.ie.to make loop inside loop.
for eg
Take first record from loop, compare 2,3,4,5,6th record in loop.
if record matches swap it or add the current record with matching record and save in internaltable.
how to do this..
X Y
HWZK000004 HWZK000002
HWZK000004 HWZK000002
HWZK000002 HWZK000003
HWZK000002 HWZK000003
HWZK000005 HWZK000004
HWZK000005 HWZK000004
HWZK000003 HWZK000005
HWZK000003 HWZK000005
it should be comparing Each "Y" value should
be compared with "X" value and do sorted as below.
SORT command is not usefull here i guess.
ambichan.
Hi Ambi,
First please clarify this, you said when records match you want to add the current and matching record and save it in the internal table - some more explanations.
Can you also brief about the comparison you are doing with X and Y.
DATA: BEGIN OF intab,
str(10) TYPE c,
END OF intab.
DATA: i_tab LIKE TABLE OF intab WITH HEADER LINE.
i_tab-str = 'HWZK000005'.
APPEND i_tab.
i_tab-str = 'HWZK000005'.
APPEND i_tab.
i_tab-str = 'HWZK000004'.
APPEND i_tab.
i_tab-str = 'HWZK000004'.
APPEND i_tab.
i_tab-str = 'HWZK000002'.
APPEND i_tab.
i_tab-str = 'HWZK000002'.
APPEND i_tab.
LOOP AT i_tab.
WRITE:/ i_tab-str.
ENDLOOP.
SORT i_tab BY str.
LOOP AT i_tab.
WRITE:/ i_tab-str.
ENDLOOP.
The above code will give sorted output.
Thanks and Regards,
Kathir
hey,
Actually let me tell u my requirment.
I have IMPORT Transport Request number in X column, and
Pretransport number in Y column as below .
note: filter of table record list is displayed below
X-Transport Req no Y-Pre Req Transport no,
HWZK000001 HWZK000000
HWZK000001 HWZK000000
HWZK000006 HWZK000003
HWZK000006 HWZK000003
HWZK000006 HWZK000003
HWZK000003 HWZK000005
HWZK000003 HWZK000005
HWZK000004 HWZK000002
HWZK000004 HWZK000002
HWZK000004 HWZK000002
HWZK000004 HWZK000002
HWZK000004 HWZK000002
HWZK000004 HWZK000002
HWZK000005 HWZK000004
HWZK000005 HWZK000004
HWZK000005 HWZK000004
HWZK000005 HWZK000004
HWZK000005 HWZK000004
HWZK000005 HWZK000004
I want to import this Tranposrt&Pre req transport number one by one
thru the FM.
While Import the above Transport Req no, rule is
"Y-Pre req transport no" should be first imported
then only "X-Transport Req no" will be imported
thru FM.
But problem here is. if "Y-pre Req Transport no" already
exists in "X-Transport Req No" column later then current
"Y-pre Req Transport no" cant be imported.
Every Y column pretransport no should be imported before is the
main logic here.
so what i have planned is lets first make continuity
of these nos as X should continue with Y, and Y- should continue with X values
continuosulty till this loop get end.
So that we can easily import as per the sequece no.
My output of import sequence should be as follows.
HWZK000001 KANRI0001 HWZK000000
HWZK000001 KANRI0001 HWZK000000
HWZK000004 KANRI0001 HWZK000002
HWZK000004 KANRI0001 HWZK000002
HWZK000004 KANRI0001 HWZK000002
HWZK000004 KANRI0001 HWZK000002
HWZK000004 KANRI0001 HWZK000002
HWZK000004 KANRI0001 HWZK000002
HWZK000005 KANRI0001 HWZK000004
HWZK000005 KANRI0001 HWZK000004
HWZK000005 KANRI0001 HWZK000004
HWZK000005 KANRI0001 HWZK000004
HWZK000005 KANRI0001 HWZK000004
HWZK000005 KANRI0001 HWZK000004
HWZK000003 KANRI0001 HWZK000005
HWZK000003 KANRI0001 HWZK000005
HWZK000006 KANRI0001 HWZK000003
HWZK000006 KANRI0001 HWZK000003
HWZK000006 KANRI0001 HWZK000003
if u need more explanation pls let me know.
I dont know how to sort this in loop technically.
ambichan.
could it be that you were trying to remove duplicates?
Have a look on the "delete adjacent duplicates" statement.
Christian
hai,
its not deleting case.
I want above output sorted in this below order.
HWZK000004 HWZK000002
HWZK000004 HWZK000002
HWZK000005 HWZK000004
HWZK000005 HWZK000004
HWZK000003 HWZK000005
HWZK000003 HWZK000005
HWZK000002 HWZK000003
HWZK000002 HWZK000003
i think if i know how to use loop inside the loop
,compare and then put the required record in seperated
internal table. i can solve this problem.
but i dont know coding loopp inside loop is good or not.
ambichan.
Add a comment