Saturday, 28 September 2013

Display data with Prefix Zero's in an Excel Sheet

Types : begin of ty_final,
            a type string,
           end of ty_final.

data  : b type mara-matnr.

data : it_final type TABLE OF ty_final,
        wa_final type ty_final..


b = '0000147'.
concatenate '=REPLACE("' b '",1,7,"' b '")' into wa_final-a.
append wa_final to it_final.
clear: b, wa_final.

b = '0000167'.
concatenate '=REPLACE("' b '",1,7,"' b '")' into wa_final-a.
append wa_final to it_final.
clear: b, wa_final.

b = '0000747'.
concatenate '=REPLACE("' b '",1,7,"' b '")' into wa_final-a.
append wa_final to it_final.
clear: b, wa_final.

CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
     filename                        = 'd:/excel.xls'
   tables
     data_tab                        = it_final.
           .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.