Skip to Content
Author's profile photo Jitendra Kansal

Generating Sales Order No From SAP Backend Using Function Module

Hi,

 

Tools used in developing this application are:

 

S/W Environment: SAP ECC 6.0, NWDS 7.0.

 

This application shows how an order number can be generated by passing certain required (below) parameters.

1.PNG

 

Input screen has been designed with few fields:

 

1.PNG

 

 

Rest of the above data will be hardcoded.

 

 

 

Procedure:

 

  1. Design a project with the following layout. It contains two views.

 

1.PNG

 

2. Create a model with SalesModel name  and use the BAPI ZINF_SALESORDER_CREATE to create sales order

 

1.PNG

 

 

 

3. Add it to the list of used models.

 

1.PNG

 

 

4. Go to InputView.

 

5. Create following context attribute. For Delievery date change the type as date from string.

 

1.PNG

 

 

6. Go to layout tab and right click on RootUIElementContainer and apply template. elect Form as below.

 

1.PNG

 

 

 

7. Create a button Submit on first view and corresponding action.

 

8. Create a method salesOrderGeneration in the controller.

 

9. Add view dependency with component controller. (Refer properties tab of View)

 

10. Go to submit button implementation and do add following code.

 

1.PNG

 

11. Go to component controller

Create a model node ZINF_SALESORDER_CREATE and do model bonding with Zinf_Salesorder_Create_Input.Select the required fields as shown below.

 

1.PNG    1.PNG

 

 

12. Go to context tab of controller and change cardinality of Zinf_Salesorder_Create_Input as 1:1

 

13. Create following attributes in component controller and do context binding with inputView and change type for date attribute as date.

 

1.PNG

14. Go to the method implementation. Do add following code

 

1.PNG

 

 

 

Here are few fields which are hard coded and few are taken from the view based on user input.

 

 

And finally we are binding the Order_Header_In with corresponding model element.

 

 

bapi_input.setOrder_Header_In(elebapisdhd1);

 

 

Repeat above for Order_Items_In .

 

 

1.PNG

 

 

 

Repeat the above procedure for Order_Partners

 

1.PNG

 

 

15. Go to Sales No view.Create a context attribute salesDocumentNo and bind it with attribute in controller.

16. Insert a text view and bind it’s text to context attribute.

17.Deploy the application. You will see the first screen as below:

 

1.PNG

 

18. Give all required input parameters and click on submit.

1.PNG

 

19. Your output would like as:

 

1.PNG

 

Regards,

Jitendra Kansal

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.