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

Read Tilda separated file from Application Server

Former Member
0 Likes
1,092

I have a requirement to read a tilda separated file from application server and write a tilda separeted output to application server. Please suggest how to to get data from tilda separated file to internal table ? and also How to create a tilda separated file from internal table to application server.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
970

Dear ,

I will suggest when you reading a file from application server with tilda separator, get this into a string and then split it at tilda separator and move this to your internal table.

and for outputing file on application server, loop at internal table and concatenate all fields in the field (type string) with separated by tilda.

Hope this will solve your proble. feel free to ask if you have any doubt.

Regards,

vijay

I have a requirement to read a tilda separated file from application server and write a tilda separeted output to application server. Please suggest how to to get data from tilda separated file to internal table ? and also How to create a tilda separated file from internal table to application server.

5 REPLIES 5
Read only

former_member212005
Active Contributor
0 Likes
970

To Read a tilda file from Application server, you can use the READ DATASET statement.

Read it into a variable e.g. gv_string(1000) TYPE c....

CONSTANTS: c_tilde_sep TYPE x VALUE '152'.

Then split the variable gv_string at hexadecimal 152 into the variables that you want...

Read only

Former Member
0 Likes
971

Dear ,

I will suggest when you reading a file from application server with tilda separator, get this into a string and then split it at tilda separator and move this to your internal table.

and for outputing file on application server, loop at internal table and concatenate all fields in the field (type string) with separated by tilda.

Hope this will solve your proble. feel free to ask if you have any doubt.

Regards,

vijay

Read only

0 Likes
970

Ya...as said by Vijay...for generating a tilda file in application server...you can conctenate all the data separated by tilda separator i.e. hexa 152 in the case.

Read only

0 Likes
970

Guys thanks for showing some light. It would be very helpfule if you can share some sample code for both reading and writing tilda separated file from internal table.

Read only

0 Likes
970

Hi again,

This some sample code for outputing data on application server with tilda separator.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. " MESSAGE msg.

IF sy-subrc <> 0.

message i812(LQ).

LEAVE LIST-PROCESSING.

ENDIF.

LOOP AT gs_input INTO wa_input.

CONCATENATE wa_input-wadat_ist

wa_input-sort2

wa_input-name1

wa_input-street

wa_input-region

wa_input-post_code1

wa_input-zzchep

wa_input-vbeln

wa_input-bstkd

wa_input-zfrom

wa_input-zland

wa_input-zccode

wa_input-zrcvd

wa_input-zfref

wa_input-znorc

wa_input-zsepr

wa_input-zvers

wa_input-zlout

wa_input-zinfo

wa_input-zinco

wa_input-zsqal

wa_input-zscod

wa_input-zrqal

wa_input-zeqal

wa_input-zecod

wa_input-zcust

wa_input-ztran INTO g_path SEPARATED BY '~'.

TRANSFER g_path TO p_file.

CLEAR : g_path, wa_input.

ENDLOOP.

CLOSE DATASET p_file.

Hope this will be helpful for you.

Regards,

Vijay