‎2009 Jan 14 5:28 PM
Hi Everyone,
I am trying to use VL10D to issue purchase items due for delivery and while doing so I want to sort them based on the storage bin(LGPBE).
I am trying to achieve this by using BADI : LE_SHP_DELIVERY_PROC and method : SAVE_DOCUMENT_PREPARE.
The coding part is simple as I am just using a sort statement.
sort ct_xlips by lgpbe.When I am debugging it shows me that ct_xlips has been sorted but I dont see any changes in my final result. Can anyone help me in this regard.
Thanks
Kumar.
‎2009 Jan 14 8:32 PM
Hi Kumar,
Please post the entire source code for review.
Thanks!
‎2009 Jan 14 8:34 PM
method IF_EX_LE_SHP_DELIVERY_PROC~SAVE_DOCUMENT_PREPARE.
data : lt_lips TYPE TABLE OF LIPSVB.
DATA : wa_lips TYPE LIPSVB.
DATA : l_lgpbe TYPE lgpbe.
loop at ct_xlips into wa_lips.
select single lgpla from mlgt into l_lgpbe
where matnr = wa_lips-matnr
and lgnum = wa_lips-lgnum.
wa_lips-lgpbe = l_lgpbe.
APPEND wa_lips to lt_lips.
ENDLOOP.
sort lt_lips by lgpbe.
clear ct_xlips.
CLEAR wa_lips.
loop at lt_lips INTO wa_lips.
APPEND wa_lips to ct_xlips.
ENDLOOP.
endmethod.
‎2009 Jan 15 9:42 AM
Hi,
What do you actually mean by "Final Result"?
If you mean to say that in the output of VL10D trasaction, LIPS data is not sorted according to your sorting criteria then it is because standard SAP always sorts Line Item data based on the Primary keys and/or Item Number.
This might be the probable reason why in the final result you are not getting the output in the desired order.
Regards,
Abhisek.
‎2009 Jan 15 2:49 PM
@Abraham and Abhishek
The main problem is the output gets printed in a smartform and I want the items on the smartform to get sorted based on the storage bin. The structure on the smartform doesnt allow me to do that and it gives me an error saying that IS_DLV_DELNOTE is of type Sorted and I cannot sort it. So I was trying to sort it before it even goes there. Maybe my approach itself is wrong.
Thanks
Kumar.
‎2009 Jan 15 7:46 AM
Have you try to debug and check whether there is another sort statement in SAP standard program after your BADI is called? Maybe SAP already has its own sorting for the table that is executed after the BADI.
Regards,
Abraham
‎2009 Jan 21 4:19 PM