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: 

How to Keep A null character in between two fields in a file

Former Member
0 Kudos

Hi ,

We are passing the data to the application server ..

Using open dataset..

Close Dataset...

Previously we used

sep type x value '|"

as the separator..

Now that we made our code unicode compliant ,We could not pass the non character field to the file which is opened in TEXT mode.

Could anyone suggest what is the exact replacement of this seperator so that it introduces the Null character in between two fields...

Thank you..

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

Use static attribute CR_LF of class CL_ABAP_CHAR_UTILITIES for the same purpose.

Like:


concatenate ITAB-FIELD1 ITAB-FIELD2 into l_text
spearated by CL_ABAP_CHAR_UTILITIES=>CR_LF.

Regards,

Naimesh Patel

8 REPLIES 8

naimesh_patel
Active Contributor
0 Kudos

Use static attribute CR_LF of class CL_ABAP_CHAR_UTILITIES for the same purpose.

Like:


concatenate ITAB-FIELD1 ITAB-FIELD2 into l_text
spearated by CL_ABAP_CHAR_UTILITIES=>CR_LF.

Regards,

Naimesh Patel

0 Kudos

Hi naimesh,

Can we use the CL_ABAP_CHAR_UTILITIES=>CR_LF in the structure ..

Because in our code we have like..

var1 type char2 ,

sep1 type x value '|',

var2 type char2 ,

sep2 type x value '|',

var3 type char2 ,

sep3type x value '|',

var4 type char2 ,

0 Kudos

You can define your type like this:


types: begin of ty_data,
       fld type char20,
       sep1 type  ABAP_CR_LF,   " <<
       fld1 type char20,
       end   of ty_data.

When you move the data in the workarea, fill the SEP1 with the value CL_ABAP_CHAR_UTILITIES=>CR_LF.

Regards,

Naimesh Patel

0 Kudos

When you move the data in the workarea, fill the SEP1 with the value CL_ABAP_CHAR_UTILITIES=>CR_LF.

...

I did not get the above statement..

Can we use

types: begin of ty_data,

fld type char20,

sep1 type CL_ABAP_CHAR_UTILITIES=>CR_LF, " <<

fld1 type char20,

end of ty_data.

0 Kudos

Naimesh,

The ABAP_CR_LF is producing 2 spaces in the file..

Was it exactly represents the null then..

And can you explain how can we identify the null in the file..

0 Kudos

I meant,


TYPES: BEGIN OF TY_DATA,
       FLD TYPE CHAR20,
       SEP1 TYPE  ABAP_CR_LF,
       FLD1 TYPE CHAR20,
       END   OF TY_DATA.

DATA: IT_DATA TYPE STANDARD TABLE OF TY_DATA,
      LA_DATA TYPE TY_DATA.

DO 5 TIMES.

  LA_DATA-FLD  = 'test1'.
  LA_DATA-FLD1 = 'test1'.
  LA_DATA-SEP1 = CL_ABAP_CHAR_UTILITIES=>CR_LF.
  APPEND LA_DATA TO IT_DATA.

ENDDO.

Regards,

Naimesh Patel

0 Kudos

When you read back the file from server, you can use the SPLIT command to split at CL_ABAP_CHAR_UTILITIES=>CR_LF.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi naimesh..but we are using the CSV FORMAT to resolve this format..

I appreciate for your attention and the time you spent ...

Thanks a lot