Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Opening the Excel file from Application server

Former Member
0 Likes
605

Hi All,

I had uploaded an excel file on the application server for using it in my program .

But when i am opening the uploaded file on the Application server it shows some special characters and those are also displayed on my report output while reading the file from the application server.

Please suggest how to get rid of those special characters.

my open data set statement is

OPEN DATASET pg_out2 FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.

Hi All,

I had uploaded an excel file on the application server for using it in my program .

But when i am opening the uploaded file on the Application server it shows some special characters and those are also displayed on my report output while reading the file from the application server.

Please suggest how to get rid of those special characters.

my open data set statement is

OPEN DATASET pg_out2 FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.

2 REPLIES 2
Read only

Former Member
546

Hi ,

if it a Excel file ..

do the following..


    OPEN DATASET pg_out2              "appl file
            FOR INPUT IN TEXT MODE
            ENCODING DEFAULT.
    IF sy-subrc EQ 0.
      DO.
        READ DATASET p_infile INTO w_temp.
*       Condition To check when cursor reaches End Of file
        IF sy-subrc EQ 0.
          PERFORM f_split_appl_data.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET p_infile.
    ELSE.
     
      MESSAGE 'Error in opening file' type 'E'.
    ENDIF.

FORM f_split_appl_data .

  SPLIT w_temp AT ',' INTO : wa_inputfile-plannum ......   "Split at , for excel or CSV file formats at appl files
  APPEND wa_inputfile TO t_inputfile.

ENDFORM.                    " F_SPLIT_APPL_DATA

Prabhudas

Read only

Former Member
0 Likes
546

Hi,

The special char should be the horizontal Tab values..try to split the string at horizontal tab using the below code

READ DATASET p_infile INTO w_temp.
*       Condition To check when cursor reaches End Of file
        IF sy-subrc EQ 0.
              SPLIT w_temp AT  CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB  
                                    INTO  wa_inputfile-plannum ......         
               APPEND wa_inputfile TO t_inputfile.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET p_infile.

    ENDIF.