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.
Input screen has been designed with few fields:
Rest of the above data will be hardcoded.
Procedure:
- Design a project with the following layout. It contains two views.
2. Create a model with SalesModel name and use the BAPI ZINF_SALESORDER_CREATE to create sales order
3. Add it to the list of used models.
4. Go to InputView.
5. Create following context attribute. For Delievery date change the type as date from string.
6. Go to layout tab and right click on RootUIElementContainer and apply template. elect Form as below.
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.
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.
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.
14. Go to the method implementation. Do add following code
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 .
Repeat the above procedure for Order_Partners
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:
18. Give all required input parameters and click on submit.
19. Your output would like as:
Regards,
Jitendra Kansal