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

Text tab delimited format

Former Member
0 Likes
496

Hello All,

I have a file in application server in text tab delimited format.I have a used following code to open and read but i am gettin sy-subrc as 4 and its not fetching data into my table....pls advice


data: pfilename(250) " file name in application server
-
-
-
OPEN DATASET pfilenaem FOR OUTPUT IN BINARY MODE.
-
-
-
"sy-subrc is 0 ....
-
-
-
-
ASSIGN wa TO <hex_container> CASTING.


* Move all of the records into the data table.
  DO.
.
    READ DATASET pfilename INTO <hex_container>.
    IF sy-subrc <> 0. ********here sy-subrc is failin it is 4
      EXIT.
    ENDIF.

pls advice..........

Title edited and Code Formatted by: Alvaro Tejada Galindo on Jan 1, 2008 11:23 AM

Hello All,

I have a file in application server in text tab delimited format.I have a used following code to open and read but i am gettin sy-subrc as 4 and its not fetching data into my table....pls advice


data: pfilename(250) " file name in application server
-
-
-
OPEN DATASET pfilenaem FOR OUTPUT IN BINARY MODE.
-
-
-
"sy-subrc is 0 ....
-
-
-
-
ASSIGN wa TO <hex_container> CASTING.


* Move all of the records into the data table.
  DO.
.
    READ DATASET pfilename INTO <hex_container>.
    IF sy-subrc <> 0. ********here sy-subrc is failin it is 4
      EXIT.
    ENDIF.

pls advice..........

Title edited and Code Formatted by: Alvaro Tejada Galindo on Jan 1, 2008 11:23 AM

2 REPLIES 2
Read only

Former Member
0 Likes
455

hi,

instead of Binary Mode, test by using TEXT MODE

may be u r not assigned any value to pfilename.

regards,

pavan

Edited by: pavan kumar pisipati on Jan 1, 2008 10:47 AM

Read only

former_member156446
Active Contributor
0 Likes
455

FORM fr_open_file USING p_ufile.

OPEN DATASET p_ufile FOR INPUT IN TEXT MODE.

IF sy-subrc <> 0.

EXIT.

ENDIF.

DO.

READ DATASET p_ufile INTO in_file.

IF sy-subrc <> 0.

EXIT.

ENDIF.

APPEND in_file.

CLEAR in_file.

ENDDO.

CLOSE DATASET p_ufile.

LOOP AT in_file.

SPLIT in_file AT c_tab INTO

wa_citm_b-type

wa_citm_b-vbeln

wa_citm_b-posnr

wa_citm_b-uepos.

  • wa_citm_b-matnr

  • lv_menge

  • wa_citm_b-arktx

  • wa_citm_b-vbegdat

  • wa_citm_b-venddat

  • wa_citm_b-prctr

  • wa_citm_b-zterm

  • wa_citm_b-faksp

  • wa_citm_b-taxm1

  • wa_citm_b-vlaufz

  • wa_citm_b-vlauez

  • wa_citm_b-vlaufk

  • wa_citm_b-vkuegru

  • wa_citm_b-bstkd

  • wa_citm_b-bstdk

  • wa_citm_b-posex

  • wa_citm_b-bstkd_e

  • wa_citm_b-bstdk_e

  • wa_citm_b-period.

IF NOT wa_citm_b-posnr CA sy-abcde.

APPEND wa_citm_b TO lt_citm_b.

ENDIF.

ENDLOOP.

SORT lt_citm_b BY vbeln posnr.

DELETE ADJACENT DUPLICATES FROM lt_citm_b COMPARING vbeln posnr.