Thursday, November 15, 2012

Function Exit Call

 
It is a normal way to call function exit by using statement - CALL CUSTOMER-FUNCTION ‘nnn’ (where ‘nnn’ is the exit number)

Ex:
But sometimes SAP calls the function exit directly like normal function module using CALL FUNCTION statement.

And before calling the function exit directly it checks whether corresponding enhancement, that is holding the function exit is active or not using FM MODX_FUNCTION_ACTIVE_CHECK.


In SMOD if we check the enhancement “SDTRM001” then we can find that FM “EXIT_SAPVSTRM_NO_ATPCHK_001” is part of it.



So to find the function exit call inside a program other than searching with CALL CUSTOMER-FUNCTION statement, we have to search with normal CALL FUNCTION statement or put a break point on “MODX_FUNCTION_ACTIVE_CHECK” function call to see whether there is any exit called inside the program directly.



Saturday, September 24, 2011

Problem with Custom table activation

Joyjit Ghosh, Kolkata.

Background:
Recently we have seen a peculiar problem during activation of an existing custom table after a field addition.
During activation it was throwing following message:



From the above screen shots we were clueless about the problem
That's why thought to check the system log (SM21):

It gives the required hint that problem is with database physical storage


Solution:
After searching through SAP market place we have found an OSS note that gives a clue to resolve this issue. It states about a data dictionary table called DDSTORAGE that stores the parameters related to database storage for any data dictionary table. Further investigation reveals that to resolve this problem we have to increase the value for MAXEXTENTS parameter.


Changed the value of MAXEXTENTS parameter in debug mode.



After maintaining the value for parameter MAXEXTENTS when we had activated the table it was activated without any error.

Sunday, August 1, 2010

Few SAP tips

Joyjit Ghosh, Kolkata

1. Maintain single table entry at a time without coding or debugging

Steps:

  • Go to SE16 transaction
  • Give any table name and press Enter , Ex: MARA
  • Now execute (F8) this screen
  • Choose the record you want to manipulate and display (F7)
  • Go to Debug mode (/H) and press ‘Enter’ 2 times
  • Change the value of the variable ‘CODE’. By default, it is 'SHOW'
  • Change the code value as 'EDIT' for modifications, 'INSR' for insert and 'DELE' for delete.

2. Maintain multiple table entries at a time without coding or debugging

Steps:

  • Goto transaction SE16N
  • Give the table name
  • In command box write ‘&sap_edit’ then press ‘Enter’
  • Press execute button

3. Debugging background job

Steps:

  • Goto transaction SM37
  • Select any job that you want to debug
  • Enter 'jdbg' as okcode in command box
  • Press ‘Enter’

Note: You can do the same from transaction SM50 as well

4. Environmental analysis of a program

Steps:

  • Goto Transaction SE38 and key in the program name for which you want to Environmental analysis
  • Press ‘SHIFT+F4’. 'Environment Analysis' pop-up-window opens.
  • Check the required information and press ‘Enter’

Aslo check the programs RSINCL00, RSDEPEND.

5. Start debugging from a popup window

Alernative 1:

Steps:

  • Create a short cut for any transaction from the SAPGUI.
  • Change transaction type to ‘system command’.
  • Enter command as ‘/h’
  • Save this on the desktop.
  • On any screen just drag and drop this shortcut
  • You are all set to debug now

Alternative 2 :

Steps:

  • Create a text file with following commands

*********************

[FUNCTION]

Command=/H

Title=Debugger

Type=SystemCommand

*********************

  • On any screen just drag and drop this shortcut
  • You are all set to debug now

6. Retrieving the deleted program

Steps:

  • Create a program with the same name as earlier (which is deleted)
  • Click on "Utilities" --> "Versions" --> "Version Management"
  • Select the version of your earlier program and click on display.
  • Your earlier program is displayed here.

7. Sending message to other user from SAP

Steps:

  • Go to transaction SE37
  • Execute the FM ‘TH_POPUP’ by mentioning the client , user name and the message text

8. Display icon in selection screen

Steps:

  • Find the hex code of the icon. Hex codes of all the icons are available in type-pool ‘ICON’ or available through the program ‘’ .
  • Now you have to create text-elements using that hex codes.

Ex: @6A@ Click

Thursday, November 19, 2009

Triggering workflow event from WE19 (Inbound)

Joyjit Ghosh, Kolkata.

We were trying to test a custom inbound function module where for error it triggers the workflow so that user can be send notification mails with details of the problem.

We were using transaction WE19 to test the FM, for that we had chosen Inbound function module option.

But in SWEL we had found that no event was raised by the FM.

But in our code we had populated workflow variables correctly

Also we had checked the config. and found that this FM is properly configured to raise the event INPUTERROROCCURRED.

After spending few minutes we were able to figure out the problem. We had observed that if we choose Standard Inbound option with ALE Service Check box checked then it triggers the event.

Note: Our custom inbound FM Z_IDOC_INPUT_GOODS_RECEIPT was attached with custom process code ZMIM_POGR.

SWEL:

Then what was the reason for not triggering the workflow? Reason is very simple; workflow is triggered by the ALE layer itself, without ALE layer we cannot trigger the workflow. So if you want to trigger workflow for inbound IDOC from WE19, choose Standard Inbound option with ALE Service Check box checked.



Friday, October 23, 2009

Error handling in LSMW

Joyjit Ghosh, Kolkata.


To do error handling in LSMW object we can write validation logic in step “5 Maintain Field Mapping and Conversion Rule”. All custom codes written in this section will be part of the conversion program once we generate it.

Following steps are required for error handling:

  1. Define an internal table to store all error messages
  2. Write logic to validate the data and populate the error table when validation fails
  3. Display error messages as part of conversion program output

All these steps should be performed under step “5 Maintain Field Mapping and Conversion Rule” from transaction LSMW.

Step 1: Define an internal table to store all error messages

In __GLOBAL_DATA__ section define the internal table that will store the error messages.

Step 2: Write logic to validate the data and populate the error table when validation fails

Now write validation logic for the fields those we want to validate. If validation fails then populate the error table and after that call the macro “SKIP_TRANSACTION” so that this error record can be skipped and control will go to next record in the file.


Step 3: Display error messages as part of conversion program output

Now at __END_OF_PROCESSING__ section write logic to display the error table.

After writing the above steps, check the syntax of the custom code by clicking the appropriate button () on application toolbar. It will display a pop-up screen where we need to press ‘Yes’ button.

If everything is OK then it will display message that conversion program is regenerated successfully.

After this follow the LSMW steps like “7 Specify Files”, “8 Assign Files”, “9 Read Data”, “10 Display Read Data”. And lastly perform the step “11 Convert Data” where SAP actually executes the validation logic (written in step “5 Maintain Field Mapping and Conversion Rule”) as part of conversion program. And display the error messages those are generated due to error handling.

Output:

Monday, August 10, 2009

Guidelines to write a good Technical Specification

Joyjit Ghosh, Kolkata

Following points need to be remembered at the time of TS preparation.

  • If Technical Specification template contains any instruction then we need to replace them with actual content. If nothing is required to fill against that section then put N/A (Not applicable) instead.
  • Use consistent Font (Family and Size) throughout the document (e.g. Arial 10 or Times New Roman 10)
  • The Technical Specification title should follow the naming convention that is agreed with the client like :"( Type of Development) : (Description of the Development)".
    Ex: Report: BOM explosion level by level.
  • The Technical Specification file name should have an agreed naming convention like "TS_(Short Description)". E.g. TS_BOM_Explosion.doc
  • Maintain Date and Version on the first page of TS
  • Maintain Amendment History
  • Maintain QA’s and Signoffs Section.
  • Do not add anything in “Table of contents”, only you can update the page number.
  • Don’t delete any section of the TS template; if no information is available for any section then put N/A instead.
  • Maintain contact details of the developer and functional owner
  • Provide all CTS numbers including dependent objects stored in other CTS.
  • Mention all assumptions & issues; provide closure date with issue resolution for the closed issues
  • Mention all technical details like Program name, Transaction name, Package name, Message class, and other repository objects correctly, they should follow the agreed naming convention
  • If required Table access diagram should be created where all tables along with keys fields and their relationships are drawn correctly
  • The flow diagram should describe the high level program flow. It should have a START node and an END node. Use the Flow Chart symbols to depict various steps.
  • The pseudo code should be organized in paragraphs indented properly as per the flow logic.
  • In the pseudo code each sentence should start with words like “Retrieve”, “Perform” etc.
    Example: Retrieve the following fields from table MARA
    Perform the following steps for each record of T_MARA
  • In the pseudo code a SELECT statement can be written as:
    Retrieve the fields (Field List) from into an internal table (Say T_ITAB) using the following criteria.
  • In the pseudo code a LOOP statement can be written as:
    Perform the following steps for each record of internal table T_ITAB.
  • In the pseudo code an IF statement can be written as:
    Perform the following steps if is true or false.
  • In the pseudo code data declarations can be written as:
    Declare the following variables. X1 type CHAR1
  • In the pseudo code calls to function module can be written as: Call the function module and pass the following parameters to the function module. The parameters can be specified in a Table format or attached as an excel document.
  • In the pseudo code for custom table, list of fields should be included along with the data elements, foreign key checks etc. Also Technical settings need to be specified along with Delivery and Maintenance details.
  • In the pseudo code mention Selection Screen Criteria along with its data type, default value, mandatory, selection screen type and validations.
  • Perform spelling check after the preparation of the document.
  • Go to document Properties and fill the Summary tab with appropriate values.
  • In Unit test plan (UTP) document all the test conditions appropriately
  • In Unit test plan (UTP) expected results should be documented clearly
  • In Unit test plan (UTP) test data should be given if available

Thursday, July 30, 2009

Display background (water mark) image using SAPscript

Joyjit Ghosh, Kolkata

Detail Steps:

Step 1: Create a standard text (transaction SO10) and insert the background image in it


Step 2: Now open the layout set (transaction SE71) in which background image needs to be displayed and do the required changes as mentioned below.

Note: Here I am using an existing custom sapscript layout where all windows, pages and page windows are already created except the background image. And for this demo I am showing the changes required for inserting the background image in the 1st page.

Goto “Page window” of the 1st page and create another page window of type ‘MAIN’. And its attributes must be same as the existing “MAIN” window.





Now open the Text Elements of the main window in edit mode and in the 1st line of the Sapscript editor insert the standard text (created above) that contains the background image.




Now in the 2nd line insert the special command NEW-WINDOW


Definition of NEW-WINDOW command:

Each page can consist of up to 99 main windows. Each main window is assigned a consecutive identifying number (0..98), and the windows are filled in this order. This feature enables SAPscript to print labels and to output multi-column text. When one main window fills up, the next main window on that page is taken, if there is a next one. A page break is inserted after the last main window.

You can use the NEW-WINDOW command to call the next main window explicitly, even if the current main window is not yet full. If you are in the last main window of the page, the command has the same effect as the NEW-PAGE command

Now activate the form

Step 3: Maintain required configuration for triggering the form

Step 4: Now trigger the form and see the print preview


Result:

Form is displayed with background image in print preview.