Hello,
For creating sales order we have created one custom BAPI and inside this custom BAPI we are calling standard BAPI "BAPI_SALESORDER_CREATEFROMDAT2" to create sales order.
Inside our custom BAPI we have written below SORT statement on table ORDER_ITEM_LINE whose table type is BAPISDITM:
SORT order_item_line BY itm_number.
I am facing issue when the number of records in table ORDER_ITEM_LINE is equal to more than 22 and content of ITM_NUMBER field for all 22 records is INITIAL.
Below is the ORDER_ITEM_LINE content screenshot, before the execution of SORT statement. Here we can see that field ITM_NUMBER content is INITIAL for all 22 records, even next field HG_LV_ITEM content is INITIAL & field PO_ITM_NO is having some values:
Below is the ORDER_ITEM_LINE content screenshot after the execution of SORT statement. Here we can see that even though we have sorted table ORDER_ITEM_LINE by field ITM_NUMBER, system sorted the table in exact reverse order(please see content of field PO_ITM_NO which got reversed sorted):
Please note that if the number of records inside table ORDER_ITEM_LINE is less than or equal to 21, then system is not sorting the table. System is sorting table only when number of records is more than or equal to 22 records.
It would be very helpful, if you can help me to know why system is behaving like this when number of records is more than 22.
Thanks & Regards,
Pradip Ojha