2016 Mar 29 7:43 AM
Hi,
I have a TMG and tcode for it.
I'm sorting the table based on material by adding code in PBO.
gt_table[] = extract[].
sort gt_table by matnr.
extract[] = gt_table[].
Sorting works fine.
But, when I try to add new entry to the table, it all goes to display mode.
I tried using check before the sorting code. (if sy-ucomm <> 'NEWL').
But during save sy-ucomm goes initial.
Is there anyother way to sort?
Thanks in advance
2016 Mar 29 10:56 AM
Hi,
if sy-ucomm NE 'NEWL' AND
sy-ucomm NE 'SAVE' AND
sy-ucomm NE 'DELE'.
gt_table[] = extract[].
sort gt_table by matnr.
extract[] = gt_table[].
endif.
try using above code. It may be helpful. In case of these OK codes, MATNRS in Extract[] are displayed as "L'.
So if sorted, there is an inconsistency and everything goes blank. So I just made a workaround by excluding these OK codes. This is just a guidance and I sincerely suggest you to test all kind of scenarios in your requirement before really using this workaround.
Regards
Pallavi
Hi,
if sy-ucomm NE 'NEWL' AND
sy-ucomm NE 'SAVE' AND
sy-ucomm NE 'DELE'.
gt_table[] = extract[].
sort gt_table by matnr.
extract[] = gt_table[].
endif.
try using above code. It may be helpful. In case of these OK codes, MATNRS in Extract[] are displayed as "L'.
So if sorted, there is an inconsistency and everything goes blank. So I just made a workaround by excluding these OK codes. This is just a guidance and I sincerely suggest you to test all kind of scenarios in your requirement before really using this workaround.
Regards
Pallavi
2016 Mar 29 10:18 AM
2016 Mar 29 10:27 AM
2016 Mar 30 8:23 AM
Thanks for your reply.
My case is little different so it didn't work.
2016 Mar 29 10:56 AM
Hi,
if sy-ucomm NE 'NEWL' AND
sy-ucomm NE 'SAVE' AND
sy-ucomm NE 'DELE'.
gt_table[] = extract[].
sort gt_table by matnr.
extract[] = gt_table[].
endif.
try using above code. It may be helpful. In case of these OK codes, MATNRS in Extract[] are displayed as "L'.
So if sorted, there is an inconsistency and everything goes blank. So I just made a workaround by excluding these OK codes. This is just a guidance and I sincerely suggest you to test all kind of scenarios in your requirement before really using this workaround.
Regards
Pallavi
2016 Mar 29 11:35 AM
Hi pallavi,
What If I enter a new entry and click on enter? ok code will be space.
And when I run the tcode, ok code will be space.
so cant really use it
2016 Mar 30 8:10 AM
Hi sriram,
gt_ztest_pal1[] = extract[].
DELETE gt_ztest_pal1[] WHERE matnr EQ space. "MATNR will be space for any action other than display
SORT gt_ztest_pal1[] BY matnr. "sort the remaining
LOOP AT gt_ztest_pal1.
LOOP AT extract.
lv_temp = extract.
IF lv_temp+3(18) EQ gt_ztest_pal1-matnr.
DELETE extract. "Delete records which are being manipulated(add or del)
ENDIF.
ENDLOOP.
ENDLOOP.
INSERT LINES OF gt_ztest_pal1 INTO extract[] INDEX 1."insert sorted lines from index 1 .
Hope this code will help you, this code doesn't require to check on any UCOMM .
Code is not in pro with the performance(loop with in the loop), couldn't spend much time on this.
Please take care of this in case if you are using.
Regards
Pallavi
2016 Mar 30 8:23 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |