Almost every project I go to, this feature becomes the most attractive feature of the Web Intelligence reports we create for our customers. Clicking on a sales order or invoice to launch an ECC transaction and view or change that order or invoice while viewing the report is an added value feature that you can impress your customers with relatively little effort.
The secret of this feature resides in the structure of the URL. I will explain how to construct the URL by giving the following example:
It is important that the integrated ITS service default_host->sap->bc->gui->sap->its->WEBGUI within your ECC’s NetWeaver instance is active before you can call a WebGUI transaction. The server is your ECC one that you can find in the SAP Logon. You can also find the right port in transaction SICF. The transaction itself must also be enabled for WebGUI access in SE93.
The above example URL is calling transaction code CJ03 and filling the screen field PROJ-PSPID with the WBS number 300002903 and bypassing the selection screen by clicking on the Execute button. This is a static example but in real life, the number should be replaced by the column name in the Web Intelligence report.
As we will see later, these URLs can be constructed to pass on multiple values and click on a specific button on the selection screen in ECC and not necessarily always the Execute button.
The following is a step by step how to add a hyperlink to ECC in a Web Intelligence report:
- Get familiar with the business object that you want to call in ECC. A business object can be an invoice, order, customer, project … etc.
- Go to SAP ECC and launch the transaction code that you would like the user to call. For example, if you are jumping to transaction code CJ03 and want to display Project Definition as opposed to WBS Element Overview, you need the return code for that button.
- The easy way to find out this code is to click on the button and keep clicking while you press one time on F1, then release the click. You will get the following window with the required function:
- The following is the URL that will take you directly to Project Definition transaction: http://<server>:<port>/sap/bc/gui/sap/its/webgui?~transaction=*CJ03%20*PROJ-PSPID=12348;DYNP_OKCODE=MDTB
- You can also find these functions in SE41:
- If you want to generically pass an enter code, use /00. This is equivalent to LETB in this particular case of CJ03.
- Although the parameter ~OKCODE is obsolete and it is recommended that you use parameter DYNP_OKCODE, the ~OKCODE parameters is still the only way to bypass the selection screen in some transactions. For example, the following HTML tag calls transaction code VF03, which only work with ~OKCODE:
=”<a href=\”http://<server>:<port>/sap/bc/gui/sap/its/webgui?~transaction=VF03+VBRK-VBELN=”+URLEncode([Billing Document])+”&~OKCODE=UEBP\” title=\”Display Invoice Document in ECC\” target=\”_new\” nav=\”web\”>”+[Billing Document]+”</a>”
- To find the screen field name, go to the transaction and press F1 in the field you choose to populate with the value coming from your report. Select the “Technical Information” icon to access the screen field name.
The combination of the SAP ITS web GUI URL, the t-code and the screen field will allow specifying the exact location we need to pass the object value we need.Select the column of interest. Right click, select Hyperlink and then New. Please note that you do not need to select the column whose value you wish to pass to ECC.Select the Link to web page option. Enter the following syntax in the URL:
http://<server>:<port>/sap/bc/gui/sap/its/webgui/!?~transaction=(=[L01 Sales Document Number])&~OKCODE=ENT2
- http://<server>:<port>/sap/bc/gui/sap/its/webgui/!? is the SAP ITS web GUI.
- ~transaction=(=[L01 Sales Document Number])& is the transaction we want to send to ECC. L01 Sales Document Number is the Business Objects field (object) which will be passed to ECC.
- Finally, ~OKCODE=ENT2 executes the search in ECC.
- Selecting the Parse command button will cause the various portions of the URL to populate. As per report to report linking, we can specify a Target Window and a Tooltip. Select the OK button.
- For the final step, we need to add the transaction code and screen field information to the URL. Turn on your formula bar (see image) by right clicking in the tool bar area of Web Intelligence.
- Copy the contents of the formula bar and paste into Notepad or MS Word.
=”<a href=\”http://<server>:<port>/sap/bc/gui/sap/its/webgui/!?~transaction=”+URLEncode(“”+[L01 Sales Document Number])+”&~OKCODE=ENT2\” title=\””+(“select to go to ECC”)+”\” target=\”_blank\” nav=\”web\”>”+[L01 Sales Document Number]+”</a>”
- Add the transaction code and screen field syntax, =VA03%20VBAK-VBELN, to the URL string. This information should be placed before the transaction key word (marked in bold red).
=”<a href=\”http://<server>:<port>/sap/bc/gui/sap/its/webgui/!?~transaction=VA03%20VBAK-VBELN=”+URLEncode(“”+[L01 Sales Document Number])+”&~OKCODE=ENT2\” title=\””+(“select to go to ECC”)+”\” target=\”_blank\” nav=\”web\”>”+[L01 Sales Document Number]+”</a>”
- Copy the new URL into the formula bar. Select the Enter from the keyboard. As a best practice, name the URL as a local report object. Turning the formula into an object will reduce report clutter and report maintenance.
- Finally, test the link.
Passing Parameters to Web GUI Transaction to Release Requisition and Purchase Orders
You can do this by creating a custom Z transaction code that simply calls a custom ABAP program, which in turn, calls Function Module ‘ME_RELEASE_REQUISITION’. The ABAP program takes in the PR Number. Here’s an example ABAP program:
parameters p_pr_no type EBAN-BANFN.
CALL FUNCTION ‘ME_RELEASE_REQUISITION’
IM_BANFN = p_pr_no.
And here’s the link you can use to call the Z transaction code ZMM_PR_RELEASE, which you can create in SE93 based on the above Function Module.
Of course you can replace the Purchase Requisition number 10000143 with the name of that object in the Web Intelligence report, or any other SAP BI front tool like Xcelsius.This solution can also be used to release Purchase Orders, except you’ll have to call Function Module ME_RELEASE_PURCHASE_DOCUMENT in the custom ABAP program, and pass the PO Number you’d like to release. Here’s the code:
parameters p_po_no type EKKO-EBELN.
CALL FUNCTION ‘ME_RELEASE_PURCHASE_DOCUMENT’
I_EBELN = p_po_no.
Terminating a user session with integrated ITS when the transaction ends
You might want to delete the user session with the parameter ~singletransaction when the transaction started with ~transaction ends. This will ensure that the user has terminated the transaction in ECC when done.
When calling a transaction with ITS 6.20 using the parameter ~transaction, ITS takes care to delete the session when the transaction ends. With SAP NetWeaver and integrated ITS, it doesn’t work the same way because session handling is no longer done by ITS but by the SAP kernel itself. When a transaction ends the system shows the transaction selection screen with the “Start Easy Access Menu” button.
In a portal environment this is often not desired. SAP therefore enhanced the kernel to provide a similar functionality as with ITS 6.20. To activate this functionality you have to set the parameter ~singletransaction=1 in the ICF service. This parameter tells ITS to ask the SAP kernel to logoff a user session at the end of transaction. SAP note 959417 describes the kernel and support package requirements. For those who do not currently have access to the SAP Service Marketplace, the requirements are as follows:
SAP NetWeaver 2004, aka 640:
- Kernelpatch: 136
- ABAP Support-Package: SAPKB64018
SAP NetWeaver 2004s, aka 700:
- Kernelpatch: 66
- ABAP Support-Package: SAPKB70009
The parameter has the limitation that it doesn’t work if the transaction is terminated with LEAVE TO TRANSACTION. You should therefore not use this parameter with the standard WebGUI service but create your own z-service in SICF with ~transaction set to the transaction code you want to provide your users.
Passing Two Parameters from Web Intelligence Report to ECC Transaction
Sometimes, you would like to pass on two objects in order to start a transaction in ECC. For example, in the case you need to a Project Number and an Order/Network Number to start transaction code CN41N; Project Structure Overview, the following is a URL that can be used:
=”<a href=\”http://<server>:<port>/sap/bc/gui/sap/its/webgui?%7Etransaction=*CN41N+CN_PROJN-LOW=”+URLEncode([Project Key])+”;CN_NETNR-LOW=”+URLEncode([Order/Network Key])+”;DYNP_OKCODE%3DONLI\” title=\”\” target=\”_self\” nav=\”web\”>”+[Project Key]+”</a>”
Another example of passing two parameters, one is Project Number and the other is a date:
=”<a href=\”http://<server>:<port>/sap/bc/gui/sap/its/webgui?%7Etransaction=*CJ74+CN_PROJN-LOW=”+URLEncode([Project Key])+”;R_BUDAT-LOW=”+URLEncode([WBS Last Activity Date])+”;DYNP_OKCODE%3DONLI\” title=\”\” target=\”_new\” nav=\”web\”>”+[Project Key]+”</a>”
Note: Make sure when you pass on a date, the format of this date is matching the format you have defined for your users in their User Profile.
The following example is to pass on Project Number from a Prompt response and a Range of WBS Elements in the dataset to transaction code CN43N:
=”<a href=\”http://<server>:<port>/sap/bc/gui/sap/its/webgui?%7Etransaction=*CN43N+CN_PROJN-LOW=”+URLEncode([Project])+”;CN_PSPNR-LOW=”+URLEncode([Min])+”;CN_PSPNR-HIGH=”+URLEncode([Max])+”;DYNP_OKCODE%3DONLI\” title=\”\” target=\”_new\” nav=\”web\”>”+Nameof([WBS Element (Flat) Key])+”</a>”
Basically, you need to define the maximum and minimum values as variables in the Web Intelligence report.
A Hyperlink on Measures
The biggest issue I encountered when creating a hyperlink on measures is losing the format of that measure in the Web Intelligence report as soon as you configure the link. The FormatNumber() function offers a fix for number formatting being lost when links are put on measures.
Here’s an example of how this function can be used:
=”<a href=\”../../opendoc/openDocument.jsp?iDocID=M0n1zzkAAj.ZAAcQzAAATFkAAo4KDD8AAAA&sIDType=CUID&sType=wid&sRefresh=N&lsSWork%20Order=”+URLEncode(“”+[Order/Network Key])+”&lsSFiscal%20Year=”+URLEncode(“”+[Prompt Fiscal Year Key])+”&lsSPosting%20Period=”+URLEncode(“”+[Prompt Posting Period])+”&sWindow=New\” title=\”\” target=\”_new\” nav=\”doc\”>”+[Actual Labour Hours YTD CY]+”</a>”
=”<a href=\”../../opendoc/openDocument.jsp?iDocID=M0n1zzkAAj.ZAAcQzAAATFkAAo4KDD8AAAA&sIDType=CUID&sType=wid&sRefresh=N&lsSWork%20Order=”+URLEncode(“”+[Order/Network Key])+”&lsSFiscal%20Year=”+URLEncode(“”+[Prompt Fiscal Year Key])+”&lsSPosting%20Period=”+URLEncode(“”+[Prompt Posting Period])+”&sWindow=New\” title=\”\” target=\”_new\” nav=\”doc\”>”+FormatNumber([Actual Labour Hours YTD CY]; “#,##0;[red](#,##0);-;-“)+”</a>”
In this case, I’m jumping to an opendoc target; however this is not different from when you create a link on a measure to jump to SAP ECC.