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

Sample Program using Data Set

Former Member
0 Likes
627

Hi All,

currently I am working for Data Migration, and i need to copy my flat file to Application Server.

How to write a program to do this using Data Sets..

Regards,

Anil.

1 ACCEPTED SOLUTION
Read only

bpawanchand
Active Contributor
0 Likes
559

HI

OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
  DO.
    READ DATASET p_file INTO wa_account.
    IF sy-subrc <> 0.
      EXIT.
    ELSE.
      APPEND wa_account TO t_account.
    ENDIF.                             " If sy-subrc <> 0.
  ENDDO.                               " DO
  CLOSE DATASET p_file.

OPEN DATASET p_file FOR INPUT---> this line is for reading the data set

OPEN DATASET p_file FOR OUTPUT --> this is to write data to the data set

instead of READ you need to use TRANSFER statement to write the data to the data set after opening the file in OUPTUT mode.

after transferring the data CLOSE the DATASET.

to upload the data from flat file use GUI_UPLOAD FM pass the table

Regards

Pavan

3 REPLIES 3
Read only

bpawanchand
Active Contributor
0 Likes
560

HI

OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
  DO.
    READ DATASET p_file INTO wa_account.
    IF sy-subrc <> 0.
      EXIT.
    ELSE.
      APPEND wa_account TO t_account.
    ENDIF.                             " If sy-subrc <> 0.
  ENDDO.                               " DO
  CLOSE DATASET p_file.

OPEN DATASET p_file FOR INPUT---> this line is for reading the data set

OPEN DATASET p_file FOR OUTPUT --> this is to write data to the data set

instead of READ you need to use TRANSFER statement to write the data to the data set after opening the file in OUPTUT mode.

after transferring the data CLOSE the DATASET.

to upload the data from flat file use GUI_UPLOAD FM pass the table

Regards

Pavan

Read only

GauthamV
Active Contributor
0 Likes
559

hi,

before asking basic questions search in SCN u will get lot of posts.

u can use CG3Y,CG3Z transactions to upload and download files to application server.

or u can use open dataset,closed dataset concept.

Read only

Former Member
0 Likes
559

What about F1 on read Data set??SAP says somthing or completely dumb?