Thursday 30 May 2024

SAP Program to discard preceeding zeroes from I'd and Ecode from the program's Output through conversion exit alpha input

Program:


REPORT zsm_28052024_2.


TYPES: BEGIN OF ty_str,

         id    TYPE char20,

         name  TYPE char20,

         ecode TYPE char20,

       END OF ty_str.


DATA: it TYPE STANDARD TABLE OF ty_str,

      wa TYPE ty_str,

      v_id TYPE char20,

      v_ecode TYPE char20.


it = VALUE #( ( id ='00001' name = 'AAA' ecode = '0004000' )

              ( id ='00002' name = 'AAA' ecode = '0005000' )

              ( id ='00003' name = 'AAA' ecode = '0007000' )

              ( id ='00004' name = 'AAA' ecode = '0008000' )

              ( id ='00004' name = 'AAA' ecode = '0009000' )

            ).


LOOP AT it INTO wa.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT_000'

    EXPORTING

      INPUT  = wa-id

    IMPORTING

      OUTPUT = v_id.


  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT_000'

    EXPORTING

      INPUT  = wa-ecode

    IMPORTING

      OUTPUT = v_ecode.


  WRITE:/ v_id, wa-name, v_ecode.

ENDLOOP.


Output:     


                                  

No comments:

Post a Comment