Application Development 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: 

ABAP:File = Write Up to 300 Records in file

Former Member
0 Kudos

HI friends,

One quick question on ABAP file handling

Can you let me know the logic , When user writes 300 Records in a file and when he tries to write 301 records the select screen should through an error message saying "only 300 records can be downloaded in a file for one run'

I have added below loop in the code, but in the below loop i have given the values of "MATNR, TEXTID, TEXT_A, SPRA,cTEST_T" as some dummy values.....

but i dont want this dummy vaules , it shuld pick whatever user is given

wa_out-matnr = 'C100'.

wa_out-textid = '100'.

wa_out-text_A = 'sssssssssssssssssssssssssssss'.

wa_out-spras = 'RU'.

wa_out-text_t = 'ddddddddddddddddddddddddddddd'.

do 300 times.

wa_out-sno = sy-index + 1.

append wa_out to t_out.

enddo.

clear wa_out.

Can you help

1 REPLY 1

Former Member
0 Kudos

Hi

When you are writing into a file based on the content of an internal table, you can use sy-tabix to check if its <= 300, then exit the loop and close the file.

For eg:

loop at itab.

if sy-tabix <= 300.

transfer itab to lf_file.

endif.

endloop.

close lf_file.

Regards

Raj