Tuesday, February 1, 2011

Integration script to create a sales order as well as delivery

Purpose: This document details about how to create an Integration Script to Create a Sales Order as well as Delivery. As this script is associated with more than one transaction we are calling it as an Integration Script. With the integration test script we can test the business scenarios like Sales process (Create Order, Release Order, Create delivery, Pick & Pack, PGI, Invoice creation, Release invoice). We can enhance this Integration script for Creating Billing Document and other unit scripts based on our requirement. There is no restriction on the number of unit scripts to be used in an Integration Script.

For starting development of this script first you must develop 2 unit scripts. One is for Creating Sales Order (VA01) and other is for Creating Delivery (VL01N) with the Sales Order reference. To create a test script, you can refer to:

We need not create Test Data and Test Configuration for the above Unit Scripts. Because we will run those scripts using Integration Script.

Here I am considering the Unit Scripts as below.



Transaction: SECATT

Here are the steps to follow.

Step 1: Go to transaction SECATT

Choose Radio Button Test Script and give some name like YINT_VA01_VL01N_SALESCYCLE_TS (In general we will follow the naming convention Z/Y-INT_first 2 tcodes used_desc. of script_TS (TS for test script)).

Click the create button as shown in above screen shot.

Step 2: In the next screen give some description for the scenario and also specify related component. We can choose the area related to the transaction we are using from F4 help. In this case I have chosen Sales component.

Now save the script as local object or use the relevant package.

Step 3: Now select the tab Editor.

Write proper comments and place the cursor in the next line and click the button ”Pattern” as shown in the below screen shot.

Step 4: The below pop-up will come and choose command REF.

In the test script name give the ‘Sales Order’ script name and press enter, system will propose the interface name (if you want you can change the interface name) and press enter.

Now our script will look like this.

Step 5: In the REF command first parameter is script name and second one is Interface for that script.

Now double click on the interface name YSD_CREATE_SALESORDER_TS_1. (We can give this name as our wish in the step 4).

Now the screen will look like this.

Step 6: Double Click on Importing.

It will show all the Importing parameters in “Sales Order” script.

Create parameters in integration script and link those with this interface importing parameters.

Step 7: Save the script. Now observe that here is Exporting Parameters also there. Double click that Exporting.

It shows Sales Order number will be exported from Sales Order script.

Here we can have a brief look at how to capture Sales Order number and export that from “Sales Order” script.

If we can observe the sales recording in one screen we will get a message like “Sales Order created” like that. That will be recorded in script as message, like below

Use the commend MESSAGE—ENDMESSAGE to capture the messages occurred during the execution. Below is the code to capture the same.

Here E_VEBLN is a parameter of type ‘E’.

Step 8: Now come to the integration script again.

We have to take the exported sales order number into our integration script and use the same as a parameter to delivery Script.

So create a variable V_VBELN type V.

And specify the variable name in Exporting parameter of Sales Order script interface as shown below.

With the above step we are completed with integrating “Sales Order” script in our main script.

Step 9: Now we will integrate “Delivery” script.

Now place the cursor in the next line of REF and click pattern button again.

This time give the Delivery test script name.

Press enter

Our script will look like this now.

Step 10: Double click on the YSD_CREATE_DELIVERY_TS_1 (Interface).

Here is the importing parameters list.

We are already having Sales order number in a variable called V_VBELN. SO give the same there. For shipping point create one import parameter.

Also for exporting delivery, create one more variable V_DELIVERY.

Save the script. Now we are done with the integration.

Step 11: Now we will see some data validations etc...

We can through an error and stop script execution if any of the Mandatory parameters are not specified.

For that we can write code like this.

Step 12: One more validation is, if Sales Order is created successfully then only we should call Delivery script. Otherwise we can skip that step.

For that we can write logic as below.

Save the script and come out.

With this we are done with the creation of Integration script. Now we have to create test data as well as Test Configuration.

For that we can follow the same steps as shown in the previous tutorials.

Create Test Data container

Create "Test Configuration"

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)


Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive