SHIFT lw_char LEFT DELETING LEADING '0'.
Several synthax below to do the same thing :
(Notice that you have to work with a field type CHAR to remove the ZERO, will not work with a NUMC variable)
SHIFT lw_char LEFT DELETING LEADING '0'.
Several synthax below to do the same thing :
(Notice that you have to work with a field type CHAR to remove the ZERO, will not work with a NUMC variable)
DATA : li_tab TYPE TABLE OF trdir-name,
infotab TYPE t_varinfo OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'PRINT_SELECTIONS'
EXPORTING
mode = li_tab
rname = sy-repid "program name
rvariante = '' "variant name
TABLES
infotab = infotab.
LOOP AT infotab.
WRITE / infotab-line.
ENDLOOP.
Macros that I’m using for formatting reports quicker.
Theses are declared in the TOP of report.
When needed to perform standart text mass retrieve, you can use the following code :
Read MoreThis post explain how to call another report in your report and how to print it SPOOL in your program.
Read More
* Show progress indicator
lw_percentage = ( sy-tabix * 100 ) / gw_nb_total.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = lw_percentage
text = 'Message to display in SAP GUI progress bar'.
Get parameter in selection screen :
IF p_matnr IS INITIAL.
GET PARAMETER ID 'MAT' FIELD p_matnr.
ENDIF.
To set the entered value to parameter ID :
IF p_matnr IS NOT INITIAL.
SET PARAMETER ID 'MAT' FIELD p_matnr.
ENDIF.
Parameter ID table : TPARA (editable via SM30 transaction).
User parameter ID table : USR05.
You can check if a Function Module exists into table TFDIR (field FUNCNAME).
You can also use code :
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = 'Function_name'
EXCEPTIONS
function_not_exist = 1.
Code example below :
DATA : lo_error TYPE REF TO cx_root,
lw_mess TYPE string.
TRY. " Avoid dump in case of non numerical values...
lw_1 = ls_initial-zzip * ls_guaranteed-zzmtbur * 10 ** ls_guaranteed-zzrri.
lw_2 = ls_initial-zzmtbur * 10 ** ls_initial-zzrri.
CATCH cx_sy_conversion_no_number INTO lo_error. " Récupérer le type d’erreur a « catcher » en générant un dump par exple.
lw_mess = lo_error->get_text( ).
ENDTRY.
IF lw_mess IS NOT INITIAL.
" Display error (lw_mess)
ENDIF.