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

Flat file with empty field generation

Former Member
0 Likes
433

Hi all,

I've created a structure with few variables, for instance :

v_1 c lenght 3,

v_2 c lenght 5,

v_3 c lenght 5.

I want to insert those values in a txt flat file.

The fields will have to be separated by a star '*'.

As far as I can see, there's no way to force the field separator to be a * using GUI_DOWNLOAD function.

But I've found a workaround.

But my issue now is that I can't find a way to have an "empty" field.

Here is an example of what my file should look like if v_2 is empty :

aaa bbbbb

And here is how it is created :

aaa* bbbbb*

Do you know if there is a way to have my v_2 fill with blanks or spaces in my output file ?

Thanks in advance for your help.

Regards

Pierre

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
409

try to use offsets to write the field values ...

itab-v_file+0(3) = v_1.

itab-v_file+3(1) = '*'.

itab-v_file+4(5) = v_2.

itab-v_file+9(1) = '*'.

itab-v_file+10(5) = v_3.

itab-v_file+15(1) = '*'.

append itab.

Now download this table ...

2 REPLIES 2
Read only

Former Member
0 Likes
409

Sorry, in my previous post my exemple appears in bold...

Here is an example of what my file should look like if v_2 is empty :

\*aaa\* \*bbbbb\*

And here is how it is created :

aaa* bbbbb*

Pierre

Read only

Former Member
0 Likes
410

try to use offsets to write the field values ...

itab-v_file+0(3) = v_1.

itab-v_file+3(1) = '*'.

itab-v_file+4(5) = v_2.

itab-v_file+9(1) = '*'.

itab-v_file+10(5) = v_3.

itab-v_file+15(1) = '*'.

append itab.

Now download this table ...