Category Archive Blog

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

Program to fill entries in SFLIGHT, SBOOK, SPFLI

To use main of SAP demo programs, it is useful to have data in flights management tables.

You can use program SAPBC_DATA_GENERATOR to fill tables SFLIGHT, SBOOK, SPFLI.

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

How to edit table content in SE16n

Notice that this tip must only be used on specific tables, only when concerned table is not maintained through SM30 transaction.

Check if you have authorization to do it by clicking on Maintain entries (working according table configuration).

If this tick box is greyed, write &sap_edit on transaction field and press enter.

Read More

Configure the pretty printer

In transaction where you can edit code (like SE38, SE80…) :

Debug code executed in update task with infinite loop.

Even with an external break-point, it is not always possible to trigger the debugger for update task.

The tip is to use infinite loop in your code executed in update task, to prevent the code to be debugged from execution, and then, trigger the debugger from SM50.

Infinite loop :


  " ==========================================================
  " Infinite LOOP to retrieve debug in SM50 (background tasks)
  " ----------------------------------------------------------
  DATA lw_x TYPE char1.
  IF sy-uname = 'USERNAME'. " <== Not not lock everybody
    WHILE lw_x IS INITIAL.
    ENDWHILE.
  ENDIF.
  " ==========================================================

Read More

Simply display internal table into ALV grid

To display content of internal table into ALV grid, use this method :


  DATA : lo_table     TYPE REF TO cl_salv_table.

* Create ALV
  TRY.
      cl_salv_table=>factory(
        IMPORTING
          r_salv_table = lo_table
        CHANGING
          t_table      = gi_data_to_display ).
    CATCH cx_salv_msg.
  ENDTRY.

* Display ALV grid
  lo_table->display( ).

Example of use in SAP demo program : SALV_DEMO_TABLE_REAL_SIMPLE.

Read More

Add leading ZERO with ABAP


DATA : lw_char10 TYPE char10,
       lw_vbeln  TYPE vbeln.

lw_char10 = '300841'.

UNPACK lw_char10 TO lw_vbeln.  " ==> LW_VBELN = 0000300841

Read More