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

Splitting a XSTRING into a Table

Former Member
0 Likes
7,112

Hello there everybody,

i m facing a real awful problem right now. I'm trying to convert an variable of the type XSTRING to a table of the structure SOLISTI1. The lines of the table are 255 characters long. The XSTRING has an unknown length. For example len(XSTRING) = 1913 characters lines in table = 8 ((7 x 255) + (1x 128)) Is there any FM or any order to transform the XSTRING into this certain table??? Greetings Gollmer

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,061

Hello there anmol,

my input is an XSTRING variable, not a tlines-table. Do you have any idea how else i can solve my problem?

6 REPLIES 6
Read only

brad_bohn
Active Contributor
0 Likes
3,061

Use the functions of funtion group SCMS_CONV or methods of class CL_BCS_CONVERT among others.

Read only

Former Member
0 Likes
3,061

Hi,

There is a FM 'SX_TABLE_LINE_WIDTH_CHANGE' for this,


 CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
     EXPORTING
        line_width_src              = '268'
       line_width_dst              = '268'
      TABLES
        content_in                  = it_pdf[]
       content_out                 = it_pdfdata[]
*      EXCEPTIONS
*        err_line_width_src_too_long = 1
*        err_line_width_dst_too_long = 2
*        err_conv_failed             = 3
*        OTHERS                      = 4.

.

This did not worked for me, I developed a code for that

first try this else try this code


data : wa_pdf type tline,
       wa_pdfdata type solisti1,
       i type i,
       j type i,
       k type i,
       l type i.
i = 134.
loop at it_pdf into wa_pdf.
 move wa_pdf(i) to wa_pdfdata+j.
  j = j + i.
   if j >= 255.
    append wa_pdfdata to it_pdfdata.
    CLEAR wa_pdfdata.
    clear j.
    k = 134 - i.
    if k > 0.
    move wa_pdf+i(k) to wa_pdfdata+0(k).
    endif.
    j = j + k.
 endif.
l = j + i.
 if l >= 255.
   i = 255 - j.
 else.
   i = 134.
 endif.
endloop.

Thanks,

Anmol.

Edited by: anmol112 on Dec 7, 2010 9:46 AM

Read only

0 Likes
1,526

SCMS_XSTRING_TO_BINARY is the one.

Read only

Former Member
0 Likes
3,062

Hello there anmol,

my input is an XSTRING variable, not a tlines-table. Do you have any idea how else i can solve my problem?

Read only

0 Likes
3,061

Use the methods I gave you...And you're correct: Anmol's answer was wrong...

Read only

Former Member
0 Likes
3,061

Hello Brad,

I looked up the function-group and found the FM "SCMS_XSTRING_TO_BINARY". This piece of code sounds really promising to me. Unfortunately I cannot test this FM under real conditions. But I Think this one solves the problem.

Thank you very much Brad.

Greetings Gollmer

Edited by: GollmerBZ on Dec 7, 2010 4:35 PM