Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Open dataset for output excel file with number type

$
0
0

Hi~~Everybody,

    I have the requirement that I produce the excel file and transfer it to application server by OPEN DATASET . But the some columns of the content have to be number type. Do somebody have good advises?? The below is my program code, and please help me, thanks a lot.

 

In current, the column type of file is character.

 

CONSTANTS: srvfile TYPE string VALUE '/usr/sap/trans/'.

CONSTANTS: con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.

DATA: BEGIN OF it_att OCCURS 0,          

             wa_att TYPE string,

             END OF it_att.


DATA: l_cell1 type string,

          l_cell2 type string,

          p_srvfile TYPE string.

 

Loop at gt_itab.

  l_cell1 = number1.

  l_cell2 = number2.

  CONCATENATE l_cell1 l_cell2 INTO it_att-wa_att SEPARATED BY con_tab APPEND it_att.

endloop.

 

CONCATENATE srvfile 'abc.xls' INTO p_srvfile.

DELETE DATASET p_srvfile.

OPEN DATASET p_srvfile FOR OUTPUT IN TEXT MODE

                                            ENCODING NON-UNICODE

                                            IGNORING CONVERSION ERRORS.

OPEN DATASET p_srvfile FOR OUTPUT IN LEGACY BINARY MODE

 

IF sy-subrc NE 0.

ELSE.

     LOOP AT it_att.

       TRANSFER it_att-wa_att TO p_srvfile.

     ENDLOOP.

endif.

CLOSE DATASET p_srvfile.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>