Creating ITS application and handling ITS URL with Custom values passed as Parameters

...Previous

Click on the tab ‘Handler List’ and enter the class CL_HTTP_EXT_ITS. In the case of ztest_its, I have copied the existing class and added some functionality.

The copied class is ZCL_HTTP_EXT_ITS. It has the standard method “IF_HTTP_EXTENSION~HANDLE_REQUEST” which identifies the application name from the URL and executes the appropriate transaction.

I added the following code to capture my desired parameters from the URL. The l_query_string field will return the query string parameters passed by the ITS URL.

l_query_string  type string.

l_query_string = server->request->get_header_field( '~QUERY_STRING' ).

split l_query_string at '&' into  wa_para1 wa_para2 wa_para3
wa_para4.

Set parameter ID 'ZBC' field wa_para2.

When this method calls the transaction, the PBO module of the transaction fetches the wa_para2 from memory ID ‘ZBC’ and a select command uses the parameter value to get populate the screen fields. Once the fields are populated, the PBO module passes control to the HTML page which displays the screen on the web page with the values fetched from the database on the basis of the parameters received from the URL.

Save and activate the service.

The ITS URL looks like:

Error! Hyperlink reference not valid.

If we pass our parameter, the URL becomes:

http://<host_name:port>/sap/bc/gui/sap/its/ztest_is?sap-client=017&ZSAPTS-TRANS_NO= CXD9000123

Note that in the above URL everything after ‘?’ is considered as parameter by the HTTP server. The parameters are separated by ‘&’.

In our scenario we required the second parameter i.e. ZSAPTS-TRANS_NO= CXD9000123, so we captured this parameter in the variable para2 (see handler code above).

The ITS application is ready to run from the browser.

            Now, we can send URLs such as given below in mails to respective approver/user:

http://<host_name:port>/sap/bc/gui/sap/its/ztest_is?sap-client=017&ZSAPTS-TRANS_NO= CXD9000123

 When the user clicks the URL, the ITS page will open with all the data on the screen as the handler would fetch data from SAP on the basis of the parameters passed by the URL.

See the resulting page below:

Fig 9 – Resulting screen with pre populated values (Notice the URL parameter also)

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image