Archive for the 'General' Category

ABAP Debugging a Popup Window

To enter a debugging mode we simply type “/h” in the command field. But do you ever wonder how to enter a debugging mode on a popup window? I mean there is no command field to type in the “/h”.

I stumble upon this really great SDN article about ABAP debugging tips and found out that there is actually 2 ways to debug a popup window.

Option 1: From any SAP windows click the “Generate a Shortcut” button sap_shortcuticon and in the window that appears make the below changes and click “Finish”. A file will be generated on the location you specified. Now drag the file onto the popup window and your ABAP debugger should be switched on!

Make sure to set the Title, Type, Command, and Location.
sap_shortcut

Option 2: Create a text file (any file name will do) anywhere on your computer where you could easily get it, and type the code below and save it:
[codesyntax lang="c++" lines="no" title=""]
[FUNCTION]
Command=/h
Title=Debugger
Type=SystemCommand
[/codesyntax]

Same thing with option 1, you may drag this file onto the popup window to switched on the ABAP debugger.
Enjoy!

Creative Commons License

SAP: Quick Way To Search For Enhancement Points

Enhancement Points allow you to modify standard SAP code, but in a structured way that will allow you to upgrade and deploy enhancement packs without the conflicts of traditional modifications. Enhancement points are basically can be found at certain defined points within the ABAP code. This allow you to add your own custom code which will be executed as if it had been hard coded into the code using a modification. Unlike hard coded modifications, these will not be lost during upgrade or patching exercises.

It is hard to tell which enhancement points are available for the process you want to customize. There’s very little documentation, and it could take an SAP developer several hours to find the best point. But thanks to Panaya team, we can now enjoy ABAPNinja.

ABAPNinja is a free web site that allows us to quickly search for the best enhancement points for our business process. How did they do it? According to their website, deciding which enhancement points impact a given transaction, directly or indirectly, is not an easy feat, to say the least. There are some 13,000 enhancement points, and over 60,000 SAP transactions, which gives over a billion possible combinations. They have have analyzed close to 250 Million lines of ERP 6.0 code, using Panaya’s program comprehension technology, and a grid of 50 servers over a period of one month, to compile this huge database. Then then used Ruby on Rails to format the data as web pages.

Try it out now, go to www.abapninja.org and enjoy searching for enhancement points!
ABAPNinja.org

SAP: table JEST (Individual Object Status)

JEST table contains object status that is either system status or a user status. Field STAT corresponds to the Object Status. Field INACT identifies whether the status is currently active or inactive and field CHGNR is the change number that identifies the change documents for an object and is incremented serially.

TJ02 table contains the list of system status and description. All statuses in this table are internal. This means they are consistent across objects and clients. A single object can have multiple active system statuses and user statuses & inactive ones.

TJ30 table contains the list of user status and TJ30T contains their description.

You could use function module STATUS_READ read active object status and STATUS_OBJECT_READ to retrieve the status profile of an object number.

Creative Commons License

SAP: Dynamic Sapgui Progress Indicator

It is very easy to apply a progress indicator on your abap programs. This will enable the

user to determine how much long will he wait until the program finish its processing.

This is done by simply calling the function module SAPGUI_PROGRESS_INDICATOR.

[codesyntax lang="abap" lines="no" title="CODE #1"]
CALL FUNCTION ‘SAPGUI_PROGRESS_INDICATOR’
EXPORTING
VALUE(PERCENTAGE) DEFAULT 0
VALUE(TEXT) DEFAULT SPACE
[/codesyntax]

PERCENTAGE is where you indicate the percentage of processing time and the TEXT is

where you indicate the text to be displayed on the status bar. This parameters can be

set with static values. But if you want, you could also add a few line of codes to make your

progress indicator dynamic and based on the actual number of records being process. This tip

is applicable when you are querying and processing a record from a database.

First you have to declare three decimal variables, see example below.

[codesyntax lang="abap" lines="no" title="CODE #2"]
DATA: v_percent TYPE p DECIMALS 4, “holds the actual percentage of process time
v_increment TYPE p DECIMALS 4, “holds the increment value per single loop
v_mod TYPE p DECIMALS 4. “used as indicator
[/codesyntax]

Now refer to the lines below for the rest of the codes.

[codesyntax lang="abap" lines="no" title="CODE #2"]
****Your select statement goes here******

* this will determine the increment value based on the result of the select statement
v_increment = 100 / sy-dbcnt.

LOOP AT it INTO wa.
*calculate the progress percentage on every single loop
v_percent = v_percent + v_increment.

*this codes indicates that I want to update my progress indicator every 5% increase
*in percentage. you can change this anytime you want.
v_mod = v_percent MOD 5.
IF v_mod < 1.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = v_percent
text = 'Processing, please wait.'.
ENDIF.
[/codesyntax]

Creative Commons License

SAP: List of Icons

I could show you here the complete list of icons with its corresponding code but I rather show you a couple line of codes that will provide you the list of icons. So please refer to the code #1.

[codesyntax lang="abap" lines="no" title="CODE #1" container="div"]
TABLES: icon.
DATA: icontext(4) TYPE c.

SELECT * FROM icon.
WRITE: / icon-id+1(2).
CONCATENATE ‘@’ icon-id+1(2) ‘@’ INTO icontext.
WRITE: 10 icontext AS ICON, icon-name.
ENDSELECT.
[/codesyntax]

Create a blank program on transaction SE38 and add the code above. Just activate it and execute. You now have your own list of icons for your reference whenever you need it.