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: 

ASSIGN dref->* to <fs> and UC_OBJECTS_NOT_CONVERTIBLE

Former Member
0 Kudos

Hi,

is there solution for my problem:

DATA: l_data_hdr_new TYPE REF TO data,

l_hdr_cont TYPE bal_s_cont,

FIELD-SYMBOLS: <l_hdr_context_new> TYPE ANY.

CREATE DATA l_data_hdr_new TYPE (l_hdr_cont-tabname).

ASSIGN l_data_hdr_new->* TO <l_hdr_context_new>.

<l_hdr_context_new> = l_hdr_cont-value.

Problem is that in "(l_hdr_cont-tabname)" I could have many different structures, and since SAP system is UNICODE, I can't assign STRING data (l_hdr_cont-value) to field-symbol (<l_hdr_context_new>) directly. Is there solution form my problem?

7 REPLIES 7

former_member188685
Active Contributor
0 Kudos

Try to assign Hexadecimal data to field symbol.

Regards

Vijay

0 Kudos

Please use function RFC_READ_TABLE. You may need to copy it because one of the "Tables" parameters is only 512 bytes: "DATA STRUCTURE TAB512"

Please let me know if this works.

ken.offers at comcast.net

-Ken

former_member186741
Active Contributor
0 Kudos

try using a field-symbol for the source data too:

DATA: l_data_hdr_new TYPE REF TO data,

l_hdr_cont TYPE bal_s_cont,

FIELD-SYMBOLS: <l_hdr_context_new> TYPE ANY,<l_hdr_context_old> TYPE ANY.

CREATE DATA l_data_hdr_new TYPE (l_hdr_cont-tabname).

ASSIGN l_data_hdr_new->* TO <l_hdr_context_new>.

assign l_hdr_cont-value to ,<l_hdr_context_old>

casting type (l_hdr_cont-tabname).

<l_hdr_context_new> = <l_hdr_context_old>.

0 Kudos

Neil,

I'm pasting the same thing as from my other post FYI for other readers..

-Ken

Neil,

You are correct so long as the QUERY_TABLE doesn't have a RAW field-- Table VBAK works. Table KONV does not (as its last field is RAW). Not sure why but I've experienced it before. Here is the kind of short-dump given. If you had a way to get around this, you'd be my ultimate hero.

Ken

"In the current program "ZHTG_UNICODE3", an ASSIGN statement is supposed to

assign a field or structure to a field symbol (using either

FIELD-SYMBOLS ... STRUCTURE s ... or ASSIGN...CASTING....). When

converting the base entry of the field symbol "<BIG>" (number in base table:

14), it was found that the structure s requested a memory alignment of

8.

The calculated offset within the source structure causes an invalid

memory alignment. (The offset must be exactly divisible by 8).

by 8.)"

Here is the full code if you want to try it:

REPORT ZHTG_UNICODE3.

PARAMETERS : P_TAB(20) DEFAULT 'VBAK'.

data : QUERY_TABLE(20).

data : BIG(5000).

QUERY_TABLE = P_TAB.

DATA DREF TYPE REF TO DATA.

FIELD-SYMBOLS <FSWA> TYPE ANY.

FIELD-SYMBOLS <BIG> TYPE ANY.

CREATE DATA DREF TYPE (QUERY_TABLE).

ASSIGN DREF->* TO <FSWA>.

assign BIG to <big> casting type (QUERY_TABLE).

IF P_TAB = 'KONV'.

SELECT * FROM (QUERY_TABLE) INTO <FSWA> WHERE

KNUMV = '1000340055'.

<BIG> = <FSWA>.

MOVE <FSWA> TO <BIG>.

endselect.

ELSE.

SELECT * FROM (QUERY_TABLE) INTO <FSWA> WHERE

VBELN = '0060073830'.

<BIG> = <FSWA>.

MOVE <FSWA> TO <BIG>.

endselect.

ENDIF.

0 Kudos

REPORT ZHTG_UNICODE3.

PARAMETERS : P_TAB(20) DEFAULT 'VBAK'.

data : QUERY_TABLE(20).

data : BEGIN OF BIG,

ALIGN1 TYPE F,

STUFF(5000),

END OF BIG.

QUERY_TABLE = P_TAB.

DATA DREF TYPE REF TO DATA.

FIELD-SYMBOLS <FSWA> TYPE ANY.

FIELD-SYMBOLS <BIG> TYPE ANY.

CREATE DATA DREF TYPE (QUERY_TABLE).

ASSIGN DREF->* TO <FSWA>.

assign BIG to <big> casting type (QUERY_TABLE).

IF P_TAB = 'KONV'.

SELECT * FROM (QUERY_TABLE) INTO <FSWA> WHERE

KNUMV = '1000340055'.

<BIG> = <FSWA>.

MOVE <FSWA> TO <BIG>.

endselect.

ELSE.

SELECT * FROM (QUERY_TABLE) INTO <FSWA> WHERE

VBELN = '0060073830'.

<BIG> = <FSWA>.

MOVE <FSWA> TO <BIG>.

endselect.

ENDIF.

0 Kudos

Please i have a dump with error : UC_OBJECTS_NOT_CONVERTIBLE

Code :

DATA :  d_filler(5000) TYPE c.

FIELD-SYMBOLS: <wa>       TYPE ANY.                      

FIELD-SYMBOLS: <wa_table> TYPE ANY.                     

CREATE DATA dref TYPE (<fs_zpurge>-tabname).         

ASSIGN dref->* TO <wa>.

ASSIGN d_filler TO <wa_table> CASTING TYPE (<fs_zpurge>-tabname).

SELECT * FROM (<fs_zpurge>-tabname) INTO <wa>            

   WHERE (<fs_zpurge>-cond).

         move : <wa> TO <wa_table> .                          

TRANSFER d_filler TO d_fils.   "here generate a dump

ENDSELECT.

Please, is there solution form my problem

0 Kudos

Please create a new thread instead of bumping up an old thread