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

SPLIT command not working while using OPEN DATASET to download a file from application server

Former Member
0 Likes
996

Hi,

  Following is my ABAP code which I have written for downloading a file from application server.But somehow the SPLIT command is not working in my case.It jus gets the first value in the work area i.e lt_datd but the rest of the values in the string don't get updated.

TYPES : BEGIN OF ty_data ,

        terid(2) TYPE c ,

        cardi(8) TYPE c ,

        pernr(8) TYPE c ,

        ldate(8) TYPE c ,

        ltime(6) TYPE c ,

        satza(3) TYPE c ,

       END OF ty_data.

DATA :  t_datd   TYPE TABLE OF ty_data,

               lt_datd  TYPE ty_data.

  cl = sy-mandt.

  v_date = sy-datum - 1.



  CONCATENATE v_date+6(2) v_date+4(2) v_date+0(4) INTO v_date.

  CONCATENATE '/tmp/' v_date '.log' INTO p_dir.

  CONDENSE p_dir.

  

OPEN DATASET p_dir FOR INPUT IN TEXT MODE ENCODING DEFAULT.





  DO.

    READ DATASET p_dir INTO string.

    IF sy-subrc EQ 0.

      SPLIT string AT '#' INTO lt_datd-terid

                               lt_datd-cardi

                               lt_datd-pernr

                               lt_datd-ldate

                               lt_datd-ltime

                               lt_datd-satza.



      APPEND lt_datd TO t_datd.

      CLEAR lt_datd.

    ENDIF.

  ENDDO.



  CLOSE DATASET p_dir.

Please help.

Hi,

  Following is my ABAP code which I have written for downloading a file from application server.But somehow the SPLIT command is not working in my case.It jus gets the first value in the work area i.e lt_datd but the rest of the values in the string don't get updated.

TYPES : BEGIN OF ty_data ,

        terid(2) TYPE c ,

        cardi(8) TYPE c ,

        pernr(8) TYPE c ,

        ldate(8) TYPE c ,

        ltime(6) TYPE c ,

        satza(3) TYPE c ,

       END OF ty_data.

DATA :  t_datd   TYPE TABLE OF ty_data,

               lt_datd  TYPE ty_data.

  cl = sy-mandt.

  v_date = sy-datum - 1.



  CONCATENATE v_date+6(2) v_date+4(2) v_date+0(4) INTO v_date.

  CONCATENATE '/tmp/' v_date '.log' INTO p_dir.

  CONDENSE p_dir.

  

OPEN DATASET p_dir FOR INPUT IN TEXT MODE ENCODING DEFAULT.





  DO.

    READ DATASET p_dir INTO string.

    IF sy-subrc EQ 0.

      SPLIT string AT '#' INTO lt_datd-terid

                               lt_datd-cardi

                               lt_datd-pernr

                               lt_datd-ldate

                               lt_datd-ltime

                               lt_datd-satza.



      APPEND lt_datd TO t_datd.

      CLEAR lt_datd.

    ENDIF.

  ENDDO.



  CLOSE DATASET p_dir.

Please help.

2 REPLIES 2
Read only

RaymondGiuseppi
Active Contributor
0 Likes
639

There is a 99% chance that the separator/delimitor is not "#" but a not-displayable character like cl_abap_char_utilities=>horizontal_tab or x'05' ('09') for older versions.

Regards,

Raymond

Read only

hendrik_brandes
Contributor
0 Likes
639

Hi,

use the debugger and switch to the hex-view of the string for checking, what kind of character will be hide through the '#'.

Kind regards,

Hendrik