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

Passing Data From Internal Table to a Character string in Unicode system

Former Member
0 Likes
376

Hi,

I am facing one problem,can u please tell me the solution.

I am passing data from internal table to a character field in Uni Code system,but it is showing the error like both the objects are not mutually convertable in unicode system.

But I have a solution by maintaining the offsets like :

TEMP_TEXT+0(1) = RETAINAGE_TEXT-DQ1.

TEMP_TEXT+1(1) = RETAINAGE_TEXT-HEX.

TEMP_TEXT+2(20) = RETAINAGE_TEXT-FILLER1.

TEMP_TEXT+22(15) = RETAINAGE_TEXT-AMT_DUE.

TEMP_TEXT+37(8) = RETAINAGE_TEXT-TEXT.

TEMP_TEXT+45(10) = RETAINAGE_TEXT-DUE_DATE.

TEMP_TEXT+55(1) = RETAINAGE_TEXT-DQ2.

But the has 140 fields.It is some what difficult to maintain offsets.

Please give me the suitable answer.

Thanks & Regards,

Pratap G.

2 REPLIES 2
Read only

Former Member
0 Likes
355

Hi,

You can concatenate all fields within a LOOP on your internal table into the TEMP_TEXT string.

Sample code:


FIELD-SYMBOLS: <fs>.
DATA: temp_text TYPE string.
LOOP AT itab INTO wa.
  DO 5 TIMES.
    ASSIGN COMPONENT sy-index OF  STRUCTURE wa TO <fs>.
    CONCATENATE temp_text <fs> INTO temp_text IN CHARACTER MODE.
    UNASSIGN <fs>.
  ENDDO.
ENDLOOP.

Cheers,

Aditya

Edited by: Aditya Laud on Jun 21, 2008 8:27 AM

Edited by: Aditya Laud on Jun 21, 2008 8:32 AM

Read only

uwe_schieferstein
Active Contributor
0 Likes
355

Hello Kumar

If you want to transfer your itab data 1:1 into the string there is a simple solution available:

use static method FILL_CONTAINER_C of class CL_ABAP_CONTAINER_UTILITIES.

Regards

Uwe