Category Archive ABAP code

Insert data into sorted table

With a sorted table, it is not possible to use statement APPEND to add line in a table.
APPEND will resquest to add the line at the end, which will perturbate the sort of table.
Use statement INSERT, which will automatically manage in which index will be inserted the line.

Use this code:


  DATA : li_table TYPE SORTED TABLE OF ts_structure WITH NON-UNIQUE KEY key_field,
         ls_table TYPE ts_structure.

  INSERT ls_table INTO TABLE li_table.

 

Search tag: table triée, insérer

Get serial numbers (SN) of documents

Use FM GET_SERNOS_OF_DOCUMENT.

Search tag: n°, numéro de série

Add button on selection screen in toolbar

Check program DEMO_SEL_SCREEN_FUNCTION_KEY.

Read More

Move files in SAP application server

You can use FM SXPG_COMMAND_EXECUTE.
Use transaction SM69 to configure the command name.

Read More

Send mail using BCS class

This is a basic example to sent mail using BCS class.

Read More

Values for TRTYP (transaction type)

Main values :
A : Display (Afficher)
V : Change (Modifier)
H : Add/Create (Ajouter/Créer)
Read More

Demo programs for ALV Tree

Check theses programs using class CL_GUI_ALV_TREE:

SAPTLIST_TREE_CONTROL_DEMO
BCALV_TREE_DEMO
Read More

EXIT at check/save on purchase order (ME21n/ME22n)

Exit triggered at check, and before SAVE on ME21n/ME22n : EXIT_SAPMM06E_012.
Exit triggered after save on ME21n/ME22n : EXIT_SAPMM06E_013.

Search tag: sauvegarder, commande, achat, PO, PReq, requisition

Change paragraph text width

Convert table text to another lenght :


  CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
    EXPORTING
      line_width_src              = 79
      line_width_dst              = 255
    TABLES
      content_in                  = li_input_text_79
      content_out                 = li_input_text_whished_at_255
    EXCEPTIONS
      err_line_width_src_too_long = 1
      err_line_width_dst_too_long = 2
      err_conv_failed             = 3
      OTHERS                      = 4.

 

Convert string char to table :


  CALL FUNCTION 'SO_STRING_TO_TAB'
    EXPORTING
      content_str = lw_string
    TABLES
      content_tab = li_input_text_whished_at_255.

 

Search tag: convert, conversion, text, texte