Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Create a new line item in sales order

Former Member
0 Kudos
115

Hi,

I have to create a new line item in a sales order. The scenario is that if we donot find the desired quantity from a plant. Then we have to go ahead and pick the remaining quantity from another plant and automatically create a new line item.The new plant is picked from a custom table so u need not worry about it.

According to me I will have to use the BAPI for it but one constraint is that while creating a sales order the order number assignment is not done until saved. So what can be done in the case if its a new document.

Kindly let me know if there is any appropriate user exit or if someone has worked on a similar requirement.

thanks

Varun

4 REPLIES 4

Former Member
0 Kudos
64

Hi Varun,

If I understand right, <b>you can check the available qty for a material in a plant</b> and based on the qty of the order to be created, you can as well create a new item record in the internal table which you pass to the BAPI.

Regards,

Raj

Former Member
0 Kudos
64

Varun,

You can try using the userexit for checking or modifying line items such as:

1. USEREXIT_MOVE_FIELD_TO_VBAP

2. USEREXIT_CHECK_VBAP

3. USEREXIT_FILL_VBAP_FROM_HVBAP

All these user exits will be available in the include progams MV45AFZA, MV45AFZB, MV45AFZC, MV45AFZZ etc.

Thanks

Kannan

0 Kudos
64

Hi,

Thanks for your response. I have tried to use these exits already but the problem dat comes here is dat when we try to use the BAPI we donot have any sales document created in the first instance(i.e. while creating an order) so the BAPI returns error and when i tried to populate the itabs in the program directly the new values just wont get processed.

I think like: in case its a new document and we face this scenario I can just terminate the document creation and create a new document using the BAPI with proper plant assignments.But i am doubtful about the stability of this process.

Kindly comment.

Thanks

Varun

Former Member
0 Kudos
64

Hi Varun,

I have a problem similar to yours, where I need to add a new line item in the sales order based on certain quantity checks. This quantity check is carried out in the variant configuration value assignment screen. And while returning from this screen to the item overview screen, i need to add line items if required.

Do let me know if u managed to solve your problem.

Thanks,

Shreya.