• How To Find BADI or Exit In Standard SAP Transaction

    How To Find BADI or Exit In Standard SAP Transaction

    An easy technique to find BADI or Exit in standard SAP program is by using the class \’CL_EXITHANDLER\’.

    Please find below an example on how to find BADI\’s or Exits which are available when the transaction VA03 is execute.

    Step 1:

    Go to transaction code SE24 and display the class \’CL_EXITHANDLER\’.

    \"1.

    Step 2:

    Double click on the method \’GET_INSTANCE\’.

     

    \"2.

     

    Step 3:

    Set a break point (or external breakpoint) just after the method \’CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE\’ (please refer to below screenshot).

    The variable \’EXIT_NAME\’ (underline in the screenshot) will contain the name of the BADI or Exit.

    \"3.

     

    Step 4:

    Now we will check how to get the BADI or Exit name, execute transaction VA03 (or any other standard transaction you want to find BADI or Exit). If the above steps have been done correctly, the debugger will open and it will stop at the breakpoint set up above.

    \"4.

     

    In the debugger, enter the variable \’EXIT_NAME\’ and the variable \’EXIT_NAME\’ will return the name of the BADI/Exit available when transaction code VA03 was execute. For example, in the screenshot above, we can noticed that the first BADI encountered is \’BADI_SD_SALES\’.

    Press \’F8\’ to view all other BADI\’s/Exit\’s available when transaction VA03 was executed.

    For the example above, the following BADI\’s/Exits was found:

    • BADI_SD_SALES
    • BADI_SD_SALES_BASIC
    • UKM_R3_ACTIVATE
    • UKM_FILL

     

    Information:

    CL_EXITHANDLER is the class which contains the Ext. Services Within Framework of Exit Technique and is used in the enhancement framework. The class \’CL_EXITHANDLER \’ has the method \’GET_INSTANCE\’ which is used to trigger BADI\’s from the standard SAP program. Thus, each time a standard program which contains BADI\’s/Exit\’s is executed, the method \’GET_INSTANCE\’ is triggered and we can find BADI/Exit used by the standard program.

  • ABAP Predefine Types

    Please find below SAP ABAP predefined types:

    Type Length Standard Length Description Detailed Description
    b 1 byte 1 byte integer (internal)
    c 1 to 65,535 characters 1 character Text field • Default type when none is specified.
    • Used for regular text information.
    • Value padded right end with spaces.
    cursor as i as i Database cursor
    d 8 characters Date field • Fixed length of 8 and internal representation of YYYYMMDD using Gregorian calendar.
    • Set default output format in your User Profile.
    • Supports date arithmetic.
    f 8 bytes Floating point number • Used in all types of calculations. Be careful of rounding errors and do not compare using equivalent operator.
    i 4 bytes 4 byte integer • Fixed length of 4 bytes.
    n 1 to 65,535 characters 1 character Numeric text • Strings of digits.
    • Value padded left end with zeros.
    p 1 to 16 bytes 8 bytes Packed number • Numbers stored in compressed formats that is in 2 digits per byte of storage.
    • Can be used for all types of calculations
    string variable Text string • A sets of characters.
    s 2 bytes 2 byte integer (internal)
    t 6 characters Time field • Fixed length of 6 and format HHMMSS.
    • Supports time arithmetic.
    t 7 characters Time field • Hexadecimal values are stored in binary format for example in \’1001000011111000\’.
    xstring variable Byte string
  • How To Upload Files On the Application Server (AL11)

    If you are working with files on the SAP application server, you can easily upload files on the server via the transaction \’CG3Z\’.

    \"CGZ3

    In the zone \’Target File on Application Server\’, enter the destination path on the application server together with the destination file name and extension.

    Please note that you must have the appropriate authorisation to upload file on the application server.

    Files uploaded on the application server can be viewed via the transaction AL11.

  • What Is the Use of SY-SUBRC?

    SY-SUBRC is a system component which contains return value which is set by ABAP statements. The return value (an integer value like 0, 4, 8, …) is used to determine the execution status (successful, error, warning and among others) of an ABAP statement.

    Generally, when the SY-SUBRC equals to \’0\’ means that the ABAP statement has been executed successfully. If the value is other than \’0\’ means that the statement has raised an error or warning.

    \’SUBRC\’ can be found in the structure \’SYST\’.

    Please find below some main examples of the of the return value of the statement \’SY-SUBRC\’:

    • Statement \’SELECT\’ sets SY-SUBRC to 0 if at least one line was retrievedelse SY-SUBRC sets to 4/8.
    • For function module the statement \’CALL FUNCTION\’ sets SY-SUBRC based on the exceptions declared in the FM. Same applies for \’CALL METHOD\’.
    • Statement \’AUTHORITY-CHECK\’ sets SY-SUBRC to 0 if the user has the required authorization else SY-SUBRC sets to 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause of the authorization failure.
    • Statement \’OPEN DATASET\’ sets SY-SUBRC to 0 if the file could be opened, else SY-SUBRC sets to 8.
    • Statement \’LOOP\’ sets SY-SUBRC to 0 if there has been at least one pass through the loop else SY-SUBRC sets to a value other than 0.

    Please refer to this list for more return value of \’SY-SUBRC\’.

  • Activate ABAP Objects Programmatically

    Yes, we can activate ABAP objects programmatically, to do that we just need to call the function module \’REPS_OBJECT_ACTIVATE\’.

    Please find below the sample code:

    *Data Declaration:
    PARAMETERS: 
      p_objectToActivate TYPE e071-obj_name. 
    
    *Function module to activate object:
    CALL FUNCTION \'REPS_OBJECT_ACTIVATE\'
      EXPORTING
       OBJECT_NAME        = p_objectToActivate    \"Object to activate 
       OBJECT_TYPE        = \'REPS\'                \"Type of the object 
     EXCEPTIONS
       NOT_EXECUTED       = 1
       OTHERS             = 2
              .
    IF SY-SUBRC = 0.
      Message \'The object has been activated successfully.\' Type \'I\'.
    ENDIF. 
    

    Happy activation. 🙂

  • Rapidly Find Node In Smart Form

    This is a nice trick to rapidly find any node in a SAP Smart Form using a search functionality (or CTRL + F). To be able to search any SAP smart form node, we will have to enable \’Additional Control Services\’ setting (available in the GUI options).

     

    Step 1: Enable \’Additional Control Services\’ in SAP GUI Options.

    Click on the \’GUI Options\’ or \’Customize Local Layout\’ button (please refer to the below screenshot) and select \’Options\’.

    \"1\"

    On the next screen which appears, click on \’Control Settings\’ and check \’Enable addition control services\’.

    \"2\"

     

    Step 2: Generate the Smart form as HTML Page via \’Print\’ option.

    Now to search for a specific node in a Smart Form, first expand all the nodes in the Smart Form.

    Then right click on any main node and select \’Services > Print\’ from the list.

    \"3\"

     

    Step 3: Search for a smart form element or node   

    The smart form will open in \’Internet Explorer\’ as an HTML page. To search for a specific node, just press the button \’CTRL + F\’ and search any required text.

    \"4\"

    Voila… 🙂

    Hope this helps.

  • Function Module To Display Progress Bar

    We can used the function module \’SAPGUI_PROGRESS_INDICATOR\’ to display a progress bar in SAP when executing a particular code logic.

    Please find below a sample code of the function module \’SAPGUI_PROGRESS_INDICATOR\’.

    *----------------------------------------------------------------------*
    * To display an indicator of the progression of current                *
    * the current processing.                                              *
    *----------------------------------------------------------------------*
    * -->PI_VALUE Percentage Progress                                      *
    * -->PI_MSG Message                                                    *
    *----------------------------------------------------------------------*
    FORM f_show_progress USING pi_value TYPE i
                               pi_msg   TYPE string.
    *----------------------------------------------------------------------*
    
      *Function module to display the progress indicator of
      *processing.
      CALL FUNCTION \'SAPGUI_PROGRESS_INDICATOR\'
      EXPORTING
        percentage = pi_value
        text = pi_msg.
    
    ENDFORM. \" F_SHOW_PROGRESS

    Please note that the field \’PI_VALUE\’ contains the percentage the progress bar has reached and the field \’PI_MSG\’ contains the message to display next to the progress bar.

  • Finding SPRO Customization Using A Table Via SM30

    To rapidly find the customization (SPRO) related to a table in SAP is very easy.

    In the example below, we will look for the SPRO customization used to configure table TVAKZ.

    Step 1: Go to transaction SM30 with the table name \’TVAKZ\’ and click on the button \’Customizing\’.

     

    \"SPRO

    Step 2: On the next screen, please click on the button \’Continue w/o Specifying Project\’.

    \"SM30

    Step 3: This will open the appropriate customization (or configuration) used to maintain the table \’TVAKZ\’. In this example, SAP will open transaction SPRO and will highlight the customizing \’Assign Sales Area To Sales Document Types\’ which is the appropriate configuration use to maintain this table.

    \"SPRO

  • Two Ways to Update SAP Standard Table Directly

    a) The first way is to use the command \’&SAP_EDIT\’ once in transaction SE16N.

    Step 1: Display the table to be updated in transaction SE16N.

    Step 2: Once in display mode, please enter the command \’&SAP_EDIT\’ in the transaction code box (please refer to the screenshot below) and press the button \’Enter\’.

    \"sap_edit\"

    And the fields will become editable.

     

    b) The second way is via debug mode (in case the first method does not works):

    Step 1: Enter debug mode (using the command \’\\h\’) with the table to be updated in transaction SE16N.

    Step 2: Change the value of variables \’gd-sapedit\’ and \’gd-edit\’ to \’X\’ (please refer to the screenshot below).

    \"gd_sapedit\"

    And the fields will become editable.

  • Adding SE63 Translation To A Transport Request (TR)

    Open transaction code ‘SLXT\’ and follow the below steps:

    \"SE63

     

    1.       Enter the ‘Target Language’, (as in our example it is French),

    2.       Enter the TR Description,

    3.       Change the transport request to ‘Workbench Request’,

    4.       Processing Date – the date on which the translation was implemented,

    5.       In the field Object Processor, enter the username of the person who implements the translation,

    6.       In the field ‘Client Options’,  please enter the value ‘I’ (Cross-Client Objects),

    7.       And finally, click on the button execute to create the transport request for the translation.