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: 

Unicode - Transfer structure with packed fields (type p, x) into c-field

Former Member
0 Kudos

I have following problem:

data: c_field(1000) type c.

tables: mara.

select * from mara......

Move mara to c-field. --> without Unicode no problem, with Unicode: error.

Methods cl_abap_container_utilities=>fill_container_c is moving mara into c_field without error, but in c_field all packed fields are marked as "#####" in debugging. When I use read_container_c into mara, all packed fields are correct again. So I can use these methods WITHIN a program. But when I (for example) want to write a record to a dataset and in the record ist a c_field, the next program, that works with this dataset receives the packed fields in c_field with "#####" when it doesn't use the read_container_c.

Do you know another method to store a structure in a container-field (c_field) in unicode?

Regards.

Dino

10 REPLIES 10

Former Member
0 Kudos

Hi Wilhelm,

Instead of reading <b>whole Structure</b>, it better to read individual field,By using <b>CONCATENATE</b> operator you

store in it in one character field.

Always the whole Field string is treated as Character variable and also depending on the fields present in the

field string it appears as '#######'.

Hope you got it.

If you any queries regarding this, you are welcome.

Reward,if helpful.

Regards,

V.Raghavender.

0 Kudos

Hi V.Raghavender.

Thanks for your answer. My problem is, that in the mentioned dataset there are some keyfields to identify the following record and then the whole record ist stored in a c(4000)-field. And the stored record can be totally different (for example mara, marc, mard, maktx.....). Only with the keyfields (e.g. one field named "tablename" you can identify, in which structure (mara, marc, mard, maktx) you have to put the c(4000)-field. In a non-unicode-system ist was working:

Program A:

tablename = 'MARA' (marc, mard)

c-4000 = mara (marc,mard....) --> error in Unicode

Program B:

if tablename = 'MARA'

mara = c-4000 --> error in Unicode

endif

ALL fields of mara, marc, mard.....are needed in program B.

0 Kudos

Hi William, are both programs in SAP, in which case why do you want to transfer the data to the operating system?

former_member194669
Active Contributor
0 Kudos

In Unicode enviornment you need to use

class cl_abap_char_utilities definition load.

cl_abap_char_utilities=>horizontal_tab.

for converting hex to char.

aRs

Former Member
0 Kudos

Hi ,

This may help you

data:

  begin of L_LINE,

    TEXT1(10) type c,

    MARK1(1) type c 
      value CL_ABAP_CHAR_UTILITIES=>MINCHAR,

    TEXT2(10) type c,

    MARK2(1) type c 
      value CL_ABAP_CHAR_UTILITIES=>MINCHAR,

    TEXT3(10) type c,

    MARK3(1) type c 
      value CL_ABAP_CHAR_UTILITIES=>MINCHAR,

    BLANK(100) type c,

  end of L_LINE,

 

  HEX0(1) type c,

  CRLF(2) type c.

 

HEX0 = CL_ABAP_CHAR_UTILITIES=>MINCHAR.

CRLF = CL_ABAP_CHAR_UTILITIES=>CR_LF.

 

L_LINE-TEXT1 = 'SYSTEM: '.

L_LINE-TEXT2 = 'USER: '.

L_LINE-TEXT3 = 'CLIENT: '.

 

replace: HEX0 with SY-SYSID into L_LINE,

         HEX0 with SY-UNAME into L_LINE,

         HEX0 with SY-MANDT into L_LINE.

 

condense L_LINE.

concatenate L_LINE CRLF into L_LINE.

 

*Further processing of L_LINE.

Note: This example, which was found in a similar fashion in a real application, is unnecessarily complicated and certainly not an example of a good programming style. The following is an example of a much clearer solution:

 

class CL_ABAP_CHAR_UTILITIES definition load.

data: L_LINE(133) type c.

 

concatenate 'SYSTEM: ' SY-SYSID
            'USER: ' SY-UNAME
            'CLIENT: ' SY-MANDT
             CL_ABAP_CHAR_UTILITIES=>CR_LF into L_LINE.

thanks

venki

0 Kudos

Hi alltogether.

Thanks for your answers. It seems, that the class cl_abap_container_utilities with its methods ist the correct solution for my problem.

Class cl_abap_character_utilities only transforms hex-values into c-fields, for example low-value, high-value, carriage-return....this was not my problem.

Bye for now.

W.

Former Member
0 Kudos

Found solution to the problem myself.

0 Kudos

HI Wilhelm Boegner ,

I am also facing the same problem ,can you please provide me the information regarding how you solved the issue.

regards

sandeep

Former Member
0 Kudos

Hi experts.

I'm sorry to interrupt you.

My name soo Il Kim from South Korea.

I showed below your question on SDN forum board.

but I had same problem. I think that you already solved this problem .

Please Can you notice me how can you solve this problem?

-


I have following problem:

data: c_field(1000) type c.

tables: mara.

select * from mara......

Move mara to c-field. --> without Unicode no problem, with Unicode: error.

Methods cl_abap_container_utilities=>fill_container_c is moving mara into c_field without error, but in c_field all packed fields are marked as "#####" in debugging. When I use read_container_c into mara, all packed fields are correct again. So I can use these methods WITHIN a program. But when I (for example) want to write a record to a dataset and in the record ist a c_field, the next program, that works with this dataset receives the packed fields in c_field with "#####" when it doesn't use the read_container_c.

Do you know another method to store a structure in a container-field (c_field) in unicode?

Regards.

Dino

-


My program.

-


DATA: buffer(30000) OCCURS 10 WITH HEADER LINE.

DATA : st_table TYPE REF TO data,

tb_table TYPE REF TO data,

FIELD-SYMBOLS : <wa_table> TYPE ANY,

<it_table> TYPE STANDARD TABLE,

<wa_table2> TYPE ANY.

CREATE DATA : tb_table TYPE TABLE OF (query_table), "Object Create.

st_table TYPE (query_table).

ASSIGN : tb_table->* TO <it_table>, "INTERNAL TABLE.

st_table->* TO <wa_table>. "WORK AREA.

SELECT * FROM (query_table)

INTO CORRESPONDING FIELDS OF TABLE <it_table> WHERE (options).

LOOP AT <it_table> INTO <wa_table>.

CLEAR buffer.

CALL METHOD cl_abap_container_utilities=>fill_container_c

EXPORTING

im_value = <wa_table>

IMPORTING

ex_container = buffer

EXCEPTIONS

illegal_parameter_type = 1

OTHERS = 2.

APPEND buffer.

endloop.

-


I also fiound "#####" in buffer.

Please help me.

Have a nice day.

Thanks.

Former Member
0 Kudos

Hi Wilhelm Boegner ,

Can you please tell me how did you solve this issue. I am working on BAPI_OUTB_DELIVERY_CREATE_SLS and

need to use the Extension structure. I am facing the same problem. Would appreciate your reply.

With Regards,

Shiva.