Category Archive Blog

Set or change/delete user preference on ALV export

Use program : SALV_BS_ADMIN_MAINTAIN.

Convert text in UTF-8

When opening data in UTF-8, the transfered text must also be converted to UTF-8.
Check method described :
https://archive.sap.com/discussions/thread/1401493
Read More

Debugger shortcut to debug popup

Use the file below to trigger the debugger.
For instance in popups, it is not possible to write /h as transaction to debug. Use file below.
Drag the file and drop it in the SAP windows where you want to trigger the debugger.

Download file here : Debugger.sap (ZIP file).
Read More

List clients available in a system

Use transaction SCC4.
 

Search tag: mandant, mandants, liste

 

Transactions SAP SD (with French translations)

SD = Sales and distribution (Vente et distribution)
ADV = Administration Des Ventes

Commandes clients (commandes de vente): sales order
VA01 – créer une commande client standard – create sales order
VA02 – modifier commande client, annulation de la commande – change sales order
VA03 – afficher commande client – display sales order
VA05 – liste des commandes client – list of sales orders
V.02 – commande client : commandes incomplètes – incomplete SD documents

Read More

Read / write file with ABAP

Read file :



  DATA : lo_error  TYPE REF TO cx_root,
         lw_error  TYPE string.

*                    ENCODING DEFAULT = ANSCII on main SAP system.
  OPEN DATASET lw_fullname FOR INPUT IN TEXT MODE ENCODING DEFAULT. 
  IF sy-subrc <> 0.
    " Manage erreur
  ENDIF.

* For each line
  DO.
*   Read line
    TRY.
          READ DATASET lw_fullname INTO lw_string.

       CATCH cx_sy_conversion_codepage INTO lo_error.  " En cas d'erreur d`encodage, 
        lw_error = lo_error->get_text( ).              " fichier en UTF-8 alors que 
        WRITE / lw_error.                              " lu en mode défaut par exemple
        EXIT.       
    ENDTRY.

    IF sy-subrc = 0.
      " Treat data
      APPEND lw_string TO li_string.
    ELSE.
      EXIT.
    ENDIF.

  ENDDO.
  
  CLOSE DATASET lw_fullname.

Assign screen variable to ABAP

Example :


  DATA : li_xvepo TYPE TABLE OF VEPOVB.

  FIELD-SYMBOLS: <fi_xvepo> TYPE ANY.

  ASSIGN ('(SAPLV51P)GT_XVEPO') TO <fi_xvepo>.
  IF <fi_xvepo> IS ASSIGNED.
    MOVE <fi_xvepo> TO li_xvepo.
  ENDIF.

 

Search tag: dynpro, structure, table, dynamique, dynamic, global data

 

Function to read Excel file

Use FM ALSM_EXCEL_TO_INTERNAL_TABLE to read Excel file

Caution, this use OLE_Objects and can’t be run in background.

Read More

Convert date to posting date

Posting date = date comptable.
Use the FM below :


  CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
    EXPORTING
      i_gjahr        = gv_gjhar
      i_periv        = gc_24
      i_poper        = gv_poper
    IMPORTING
      e_date         = s_fkdat-low
    EXCEPTIONS
      input_false    = 1
      t009_notfound  = 2
      t009b_notfound = 3
      OTHERS         = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
    EXPORTING
      i_gjahr        = gv_gjhar
      i_periv        = gc_24
      i_poper        = gv_poper
    IMPORTING
      e_date         = s_fkdat-high
    EXCEPTIONS
      input_false    = 1
      t009_notfound  = 2
      t009b_notfound = 3
      OTHERS         = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

 

Search tag: date comptable, conversion