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: 

File not created evrytimes

Former Member
0 Kudos
89

Hi,

I try to create a file converted in CODEPAGE 4103. But the file is created only once.

Exemple : I select the program and execute it with a variant. The file is correctly created. If I stay on the same selection screen at the end of the execution and execute it again, the file is not created even if the filename isn't the same and if in debug, the file seems to be created.

Here is the code I implement :

Open dataset v_file for output in binary mode.

If sy-subrc is initial.

     Loop at t_file_csv into ls_file_csv.

          ls_file_string = ls_file_csv.

          concatenate ls_file_string cl_abap_char_utilities=>cr_lf into ls_file_string.

          conv = cl_abap_conv_out_ce=>create( encoding = '4103' endian = 'L' ).

          Call Method Conv->reset.

          Call method Conv->write( data = ls_flie_string ).

          lv_file_xtring = conv->Get_buffer( ).

          Transfert lv_file_xtring to v_file.

     Endloop.

     Close DATASET v_file.

Endif.

thanks for your help.

Regards.

Marie Schonbuch.

5 REPLIES 5

Former Member
0 Kudos
67

Hi Marie,

I am curious about your Issue and checking your code I stumbled over this:


Transfert lv_file_xtring to v_file.

fail in copy or in code?

edit: here is another one:


Call method Conv->write( data = ls_flie_string ).

Will try to find the problem as well.

ok let's find the problem:

on which event are you executing the code?

Is the code executed on the 2nd time?

Regards

Markus

0 Kudos
67

Hi Markus,

You are right, the errors in code are fails in copy. The code is activated correctly.

For your Event question, I don't understand what you mean.

And yes, the code is executed the 2nd time as the first time.

And the Buffer is changed at each record and transfered. But the file is not physically created.

0 Kudos
67

"But the file is not physically created."

this really grinds my gears...you are even checking if the file is created ... have you checked the 2nd file? Try to select something different to be able to see if the 1st file gets overwritten.

0 Kudos
67

The file is created in FILE tcode and have the date and the time as parameter. So it can't be the same one. And when I am in debugg, I see the file name so I copy it and try to find it but it is not created.

To create another file, I must return to the program name selection, find my program, execute it and the file is now created.

The functionnal person have the same problem when he execute the program in test mode, without going in the FORM create_file, and then in real mode, the file isn't created, even if in debug, the FORM create_file is executed.

Sandra_Rossi
Active Contributor
0 Kudos
67

If you made sure by debug that the file was apparently being created (so you went through open, transfer a number of bytes and close), but you can't find it, it sounds like you should verify two or three more times what is happening. I think we can't help. Ask a colleague to check with you.

Eventually, you could have an issue if you have several application servers, maybe the "soft link or whatever it is" on one of the application servers does not refer to the same physical directory.