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: 

Transferring data between internal tables with different line length

Former Member
0 Kudos
230

Hello,

I am almost positive that I have seen a function module which will transfer data from one internal table to another internal table of a different length.

For example, I have an internal table storing the contents of a binary file. The line length of this table is 300. I need to move it to an internal table with line length 255 so I can use it with the function module SO_NEW_DOCUMENT_ATT_SEND_API1.

I realize that this is not an impossible task to accomplish within my ABAP program, but if the code's already there ....

Does anyone know this function module?

Regards

9 REPLIES 9

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
131

Have you tried "FORMAT_TEXTLINES".

Good Luck,

Rich Heilman

brad_bohn
Active Contributor
0 Kudos
131

Try 'SX_TABLE_LINE_WIDTH_CHANGE'

nablan_umar
Active Contributor
0 Kudos
131

I don't think you need a function module for that. Just try this one:

tab_with_255[] = tab_with_300[].

0 Kudos
131

<i>

Nablan wrote:

I don't think you need a function module for that. Just try this one:

tab_with_255[] = tab_with_300[].

</i>

I think you do need a FM, your code would trucate the last 45 positions of the table.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

Message was edited by: Rich Heilman

nablan_umar
Active Contributor
0 Kudos
131

Even if there is a function module or codes for this, you still have to remove 45 bytes from the original.

0 Kudos
131

Yes, but these function modules take those last 45 bytes and move them to the first 45 bytes of the following line, and so on.

Regards,

Rich Heilman

Former Member
0 Kudos
131

Thanks for this. Yes I did want one that would wrap the text around to the next line, not truncate it.

Now I just need to see if I can get something to work with STRINGs.

Former Member
0 Kudos
131

It depends, if you need wordwrapping or not.

Without wordwrap its quite simple and should work similarly to this:

_______________________

  • tab to string

loop at src_tab assigning <src_tab_wa>.

concatenate my_string <src_tab_wa> into my_string.

endloop.

  • string to tab

do while strlen(my_string) > 0.

result_wa = my_string.

append result_wa to result_tab.

shift my_string left by result_tab_len places.

enddo.

_______________________

If you need wordwrapping then you could split the joines string at each space. Then loop over all words and see for each word, if the current word will fit into the current result line or not.

If it does: append it to your current line.

If not: append the line buffer to the result table, clear the result line buffer and then append the word to the line buffer (that is: to the next line).

Greetings

Christian

0 Kudos
131

Hi Mike,

For word wrap, I found this function module:

<b>RKD_WORD_WRAP</b>

Let us know what approach you used from the answers you have got.

Regards,

Subramanian V.