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

Insert a tab - OPEN DATASET

Former Member
0 Likes
821

How can I insert a tab in a file that is created using OPEN DATASET / CLOSE DATASET.

I found some threads that talks about that but nothing work to me. I tried to concatenate all fields that i wanna display separeteb by a variable that I declared as a hexa with value 09 (TAB).

I appreciate all kind of help.

7 REPLIES 7
Read only

former_member156446
Active Contributor
0 Likes
782

DATA : wa_file TYPE string,

IF NOT p_ufile IS INITIAL.

OPEN DATASET p_ufile FOR OUTPUT IN TEXT MODE.

IF sy-subrc <> 0.

EXIT.

ENDIF.

LOOP AT p_output INTO wa_file.

concanate ur hexa varaible here <<<<<<<<

TRANSFER wa_file TO p_ufile.

CLEAR wa_file.

ENDLOOP.

CLOSE DATASET p_ufile.

Read only

0 Likes
782

I did that. Plz see my code:

DATA: vl_file(1000) type c,

vl_tab type x value '09'.

LOOP AT t_lista into wa_export

CLEAR: vl_file.

CONCATENATE wa_export-fiel1 wa_export-fiel2

.... wa_export-fiel8

INTO vl_file SEPARATED BY vl_tab.

vl_tamanho = STRLEN( vl_file ).

TRANSFER vl_file TO p_arq LENGTH vl_tamanho.

ENDLOOP.

Am i doing something wrong ?

Appears a message saying that I can concatenate variables only type C, N , D, T or STRING.

Read only

0 Likes
782

ur code looks good .. but to fix ur issue I would prefer to go with the use of field -s ymbols.

field-symobls : <fs_export> type wa_export.

LOOP AT t_lista assigning <fs_export>

CLEAR: vl_file.

CONCATENATE <fs_export>-fiel1 <fs_export>-fiel2

.... <fs_export>-fiel8

INTO vl_file SEPARATED BY vl_tab.

when ever u have this type of type conflict better use field symbols.

Read only

0 Likes
782

But the problem is not that. The variable vl_tab is type HEX and I CAN'T concatenate an HEX variable type.

Read only

0 Likes
782

co_line_feed TYPE x VALUE '0D'. <<<<<<<line feed the hex value..

CONCATENATE lf_line co_line_feed INTO lf_line.

APPEND lf_line TO p_output_file.

CLEAR lf_line.

Read only

Former Member
0 Likes
782

Sry but the problem continues. Same message:

co_line_feed must be a character-type data object ( data type C, N, D, T or STRING ). field string.

I use 4.6 C version. Can be my version the motive because is not working ??

Read only

0 Likes
782

I used the above code in 4.6C before.