The Assignation of the actual line nos to items in Transactions are very important. And they are also very important in case of Bill of Materials. Since its all standard we never tend to worry about this.But there are requirements for e.g.
- When you need to create structured products yourself based on a custom logic. In this case the responsibility of allocating proper line nos would fall with you.
- Based on certain events , you would need to add a new product to the Items , then also you need to take care of the lines nos.
At this point of time some of the scenarios may look a bit weird but they are a real possibility and then the line nos are not assigned properly.
The actual assignment of line nos happen through the call back functions. The function module CRM_ORDERADM_I_ITEM_NUMBER_EC is responsible for this. The assignation is done in the FM.
Now if you need to add some custom logic to find out the increment in which the item nos are changed , then you can do using the following code
call function 'CRM_ORDER_PROC_TYPE_SELECT_CB' exporting iv_process_type = lv_process_type importing es_proc_type = ls_crm_proc_type exceptions entry_not_found = 1 text_entry_not_found = 2 others = 3.
The field incr_item_proc in the structure ls_crm_proc_type will contain the increments defined in the customizing. Now if you want to play around with this information to assign the item nos as you wish to. But you have to make sure
- If you want to have the standard function module assign the item nos , then your code should run before the standard callback FM is called. But in this case you would not be able to establish the parent child relation yourself because the line nos are not assigned.
- Then in that case you have to write the custom logic for assigning the item nos. You can read the increments as defined in customizing then act accordingly.