SAP ABAP去掉前导0,或添加前导0

【添加前导0】

  LOOP AT lt_vkorg INTO DATA(ls_vkorg).
    ls_vkorg-vkorg = |{ ls_vkorg-vkorg ALPHA = IN }|.
    MODIFY lt_vkorg FROM ls_vkorg.
  ENDLOOP.


【去除前导0】

LOOP AT gt_data INTO gs_data.
   SHIFT gs_data-lifnr LEFT DELETING LEADING '0'.
   MODIFY gt_data FROM gs_data.
   CLEAR gs_data.
ENDLOOP.
 

 

*加上p_in的前导零

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = p_in
    IMPORTING
      output = p_in.

 


*去除p_out的前导零

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
      input  = p_out
    IMPORTING
     output = p_out.

你可能感兴趣的:(ABAP,SAP)