Category Archive ABAP code

Display transport request (TR) informations in ABAP

Use FMs :

  • STRF_READ_COFILE
  • TR_READ_GLOBAL_INFO_OF_REQUEST

Search tag: TO, Transport order, ordre de transport, OT

Protected: Abap code to call filtered BADI in enhancement

This content is password protected. To view it please enter your password below:

Open popup window to choose a diretory

Use method : cl_gui_frontend_services=>directory_browse.

Read More

Write spool in color

Create spool to display it later in SP01, SP02…

With code below, you can easily add lines in spool like that :


    ls_text-color = c_color_jaune.
    CONCATENATE 'Error on PN' lw_matnr INTO ls_text-text SEPARATED BY space.
    APPEND ls_text TO gt_text.

    CLEAR ls_text.
    ls_text-color = c_color_rouge.
    APPEND ls_text TO gt_text.

Read More

Create an ALV with custom control

You can check the SAP demo programs starting with BCALV_GRID_*

Read More

Add day/month/year to a date in ABAP

Add days to date

You can simply add integer value if your variable is typed DATUM.


  DATA : lw_date  TYPE  sy-datum.
  lw_date = '20170927'.
  lw_processed_date = lw_date + 5.
* ==> lw_processed_date = 20171002

Read More

Get text symbols from another program

In theory, you can’t access the text symbols of one program into another program.
They are program dependent.

Nevertheless, if you need to do that, there is the following statement in ABAP.


DATA : li_textpool TYPE TABLE OF textpool.
READ TEXTPOOL 'SAPLLCPP' INTO li_textpool LANGUAGE sy-langu.

Read More

Read MARA characteristics in mass

The code below shows how to retrieve a characteristic value in mass.
The characteristic in example is named INDICE.
Read More

How to CALL TRANSACTION in ABAP

The goal is to call Transaction with parameters and skip first screen.

Simple way

Example to call the Prod Order display transaction :


  SET PARAMETER ID 'ANR' FIELD w_of_number.
  CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.

 

Advanced way

The example below show how to call a transaction and skip first screen when it in not possible to SET parameters ID.
Read More