Thursday, June 6, 2013

ABAP Tip-How to Debug Pop-up window

How to Debug Popup Window

Creating SAPGUI shortcuts

Introduction
SAPGUI shortcuts are files located on a computer with SAPGUI for Windows installed, which are used to login directly to a SAP system, or run directly a SAP transaction, or entering okcode commands on modal dialogs.

How to create a SAPGUI shortcut
There are 4 ways to create a SAPGUI shortcut:
Approach 1:
  • Click on the Create shortcut icon on a the toolbar in a SAPGUI session
  • In the popup window, enter the values you need See SAP Library and note 103019 in Links chapter below for more information. The TYPE field may be Report, Transaction or System Command (this late one is useful for entering /H in popup windows)
  • A shortcut on the Desktop (or the location you entered) will be created
Approach 2:
  • From desktop, choose Create SAP Shortcut using contextual menu and enter file name with extension .sap
  • Then choose Modify in the SAP Shortcut contextual menu and enter Shortcut attributes as above
Approach 3:
  • Create a text file with .SAP extension on the desktop with this kind of content (replace the values with your local ones):
    [System]
    Name=YD1
    Description=04 - **** Solman ****
    Client=100
    [User]
    Name=ALBERT
    Language=
    [Function]
    Title=Debug
    Command=/H
    Type=SystemCommand
    [Configuration]
    WorkDir=C:\Documents and Settings\albert\SapWorkDir
    [Options]
    Reuse=1
    
    The parameters are more or less explained in note 103019 below, as the sapshcut.exe parameters have the same names.
Approach 4:
  • It is also possible to create a shortcut file from an ABAP program by calling SWN_CREATE_SHORTCUT function module, and save the text to a file (using GUI_DOWNLOAD function module). See the wiki in the Links below.
How to execute a SAPGUI shortcut :
There are 3 ways to execute a SAPGUI shortcut:
  • Double-click the .SAP file from Windows desktop or Windows explorer
  • You may execute a .SAP file by sapsh.exe before 4.5 and sapshcut.exe after 4.5
  • Drag and drop the .SAP file to an existing SAPGUI session window. It is especially useful for system commands (okcode commands) that need to be entered on a modal window (popup) as the okcode field is protected, like /H, /RON, /ROFF, etc.
    • Locate the window of your SAP popup window:
    • Display desktop by Windows-D key, then drag (do not drop) the shortcut to the window
    • Drag the shortcut to the popup window:
    • Drop it:

Debugging workflows and generating sub-workflows

Workflow Debugging
First of all, you cannot set breakpoints in a workflow, so I assume you mean that you have set a break-point in a method used in one of the task's used in your workflow?
If so, and if this task-method is a background method (i.e. a non-dialog task), debugging is not possible, since a background method, as the name states, is executed in another context in background.
To see how the workflow passes values from/to the different container's, you can use transaction SWUD (to see if the values needed for your method, are binded correctly).
Other useful tools for workflow error search, are: SWEL (first turn on even trace with SWELS) or simply look at the workitems created to see what kind of errors they may have encountered: SWI2_FREQ f.x.
If background task, I recommend you use SWUS for the specific task in question to create a WorkItem. Find the workitem with SWI2_FREQ, then display it. From there, display Container, to see the outcome.
You can debug the method, from SWO1 for the Object Type owning the method. From SWO1 simply click the test button. Then click "create instance". Execute the method for the object instance and you will be able to debug the method.
Generating Sub Workflow
1. Add one of your subflows to the main workflow as an activity step and define the binding. This subflow is just a place-holder and will be replaced by another subflow when the workflow runs.
2. In the step definition specify "Task to be determined using an expression" and specify which container element (or expression) contains the subflow ID to be used.
At run time, the place-holder subflow will be replaced by the subflow that is specified by the expression. In other words this expression reads the table that you created to find the subworkflow to call and this subworkflow is called by the main workflow instead of the (static) place-holder subflow.
Finding out the Object Types involved
  • Switch the event trace ON (Tcode SWELS), carry out your transaction and view the event log (Tcode SWEL).
  • If there is a standard event then the trace will tell you the name of the object and the event raised.
  • Otherwise create your own object and events and trigger it (them) using FM "SWE_EVENT_CREATE".

ABAP Debugger Tips

This  post lists few frequently asked questions about abap debugger

Create maintenance view variant

This post explains how to create a maintenance view variant for an existing maintenance dialog.

NOTE: When you create a maintenance view variant, no new dialog is generated, i.e. all screens and function modules of the original dialog are used. For this reason, all basis dialog checks are made in view variant maintenance.

Prerequisites: The basis dialog for which the maintenance variant is created already exists.