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

read dataset

Former Member
0 Likes
737

Hi guys..

I am reading a file from application server into sap using OPEN DATA SET and then READ dataset..

The file data is a s follows

H#12/10/07#integrity#1000#12000#interface

d########40#12

When I read the dataset into work area I dont see # but '/h/' in place of #,,

ands i cant split the wwork area at # into fields.

Please help me out why its happening like this..

I am using 4.6c

regards,

nazeer

4 REPLIES 4
Read only

Former Member
0 Likes
691

Then why to worry Split at '/h/'.

Regards,

Satish

Read only

0 Likes
691

Its not happenin..

I did that..

SPLIT wa AT '/h/' into wa1 wa2 wa3.

rgds,

nazeer

Read only

0 Likes
691

Try replacing '/h/' with space and split at space.

Regards,

Satish

Read only

former_member194152
Contributor
0 Likes
691

hi,

use cl_abap_character utility for split values.

DO.
    CLEAR lv_file_line.
    READ DATASET phy_name_out INTO lv_file_line.
    IF sy-subrc EQ 0.
      lv_file_line+0(1) = ' '.
      SHIFT lv_file_line LEFT DELETING LEADING space.

      SPLIT lv_file_line AT cl_abap_char_utilities=>horizontal_tab INTO
       wa_ctab-bukrs
       wa_ctab-fkdat
       wa_ctab-vbeln
       wa_ctab-kunag
       wa_ctab-zterm
       wa_ctab-inco1
       wa_ctab-inco2
       wa_ctab-matnr
       wa_ctab-fkimg
       wa_ctab-vrkme
       wa_ctab-netwr
       wa_ctab-waerk
       wa_ctab-fkart
       wa_ctab-lgort
       wa_ctab-charg
       wa_ctab-vkorg
       wa_ctab-vtweg
       wa_ctab-spart
       wa_ctab-kunnr
       wa_ctab-gjahr.
      APPEND wa_ctab TO ctab.
    ELSE.
      CLOSE DATASET phy_name_out.
      EXIT.
    ENDIF.
  ENDDO.

Rewards if helpful.

Regards

Gagan