07-15-2021 7:09 AM
Hi,
I have very long text, so i`m sending it into smartform in pieces in internal table.
In one case, at the end of the one part of text i have the space.
I do not know why, in smartform i do not see this space. I checked the data in itab, there is a space, i`m sure (i used
write: wa_opinie2-txt5 color 5, /.
and i see space on green background).
Ofcourse I used string as type of the text field.
Please, help! 🙂
07-15-2021 7:47 AM
07-15-2021 9:02 AM
07-15-2021 9:33 AM
How did you print the text in Smartforms, did you use : LOOP, TEMPLATE or TABLE + TEXT (element or dynamic) nodes.
Also elaborate on 'I do not see this space.' are two texts concatenated?
07-15-2021 9:43 AM
I`m using loop.
Look pls at my other comment, there are also pics.
07-15-2021 9:47 AM
Please use the COMMENT button for comments, questions, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.
07-15-2021 9:50 AM
07-15-2021 10:28 AM
I don not know why, but i have a problem with attachements here, so...
Link to description of problem and information about my smartform
07-15-2021 11:49 AM
If I understand well, you mean that you complain about missing space between the variables, let's say txt1 ends with "hello" and txt2 begins with "world", you want to see "hello world", so why not adding a space between txt1 and txt2?
&wa_opinie2-txt1& &wa_opinie2-txt2& &wa_opinie2-txt3& &wa_opinie2-txt4& &wa_opinie2-txt5& &wa_opinie2-txt6&
07-15-2021 12:19 PM
No...
For example:
wa_opinie2-txt1 = 'this is txt with space at the end '.
wa_opinie2-txt2 = 'and this is next part of lo'.
wa_opinie2-txt3 = 'ng text'.
In smartform:
&wa_opinie2-txt1&&wa_opinie2-txt2&&wa_opinie2-txt3&
Effect:
this is txt with space at the endand this is next part of long text
As You can see, there is no space between "end" and "and" (lol...). And this is my problem.
I can not use:
&wa_opinie2-txt1& &wa_opinie2-txt2& &wa_opinie2-txt3&
because it will give me:
this is txt with space at the end and this is next part of lo ng text
I hope that there is clear now 😉
07-15-2021 12:42 PM
But, in your example, how do you decide that there is a space at the end of TXT1, but there is no space at the end of TXT2? Do you want to implement a "natural language understanding" system, or a split based on "dictionary words" (of a given human language) or is there another rule?
07-15-2021 1:42 PM
Hello Emil,
You can try following Solution
concatenate txt1 txt2 .. txt6 into lv_string respecting blanks.
Hopefully, this works for you.
Regards,
Juby
07-16-2021 6:45 AM
Content of the txt1 and txt2 it is a typical text from database. I need to cut it into txt1, txt2 etc..., because smartform will not give me possibility to print it as a one, long text from itba/WA.
All i need, is write exacly what i have in txt1 and txt2. I do not decide about spaces at the end of txt1. When i cut long text into pieces 250 char long, sometimes there is a space at the end. And i need this space, because without it text does not have a sense during the assembly.
07-16-2021 7:16 AM
So, you say that TXT1, TXT2, etc. come from the database table, and are all CHAR 250, and a text spans over all these columns as a continuous text, so if there's a very long text up to TXT6, I guess that TXT1 to TXT5 all occupy 250 characters, with the 250th character being either a space character or a non-space character. Am I right?
07-16-2021 7:17 AM
(and if I am right, your example with very short TXT1 and TXT2 values don't reflect a real case)
07-16-2021 7:34 AM
Sandra: You are right, but in my pdf You can see example with text longer than 250 characters (look at example with disappeared space after „wynosi”).
07-17-2021 6:32 PM
Hi Dear, I recommend implementing below ABAP code example.
Best Regards!
Roberto FORTI Santos
DATA: lt_pdf type standard table of tline,
<lfs_w_pdf> type tline,
lv_buffer type string,
lt_mess_att type standard table of solisti1,
<lfs_attac> type solisti1,
ls_doc_data type sodocchgi1,
lv_cnt type i.
"Transfer the 132-long strings to 255-long strings
loop at <lfs_t_pdf>[] assigning <lfs_w_pdf>.
translate <lfs_w_pdf> using ' ~'.
concatenate lv_buffer <lfs_w_pdf> into lv_buffer.
endloop.
translate lv_buffer using '~ '.
do.
append initial line to lt_mess_att[] assigning <lfs_attac>.
if ( <lfs_attac> is assigned ).
<lfs_attac> = lv_buffer.
shift lv_buffer left by 255 places.
if ( lv_buffer is initial ).
exit.
endif.
endif.
enddo.
"Fill the document data and get size of attachment
if ( <lfs_attac> is assigned ).
ls_doc_data-doc_size = ( lv_cnt - 1 ) * 255 + strlen( <lfs_attac> ).
endif.
"...
07-17-2021 8:58 PM
I guess the simplest way to solve is to define in the Smart Form a text of type "Dynamic text", i.e. filled with an internal table of type TSFTEXT or TLINE_TAB (same), which is a text in SAP "ITF" format, and use the function module CONVERT_STREAM_TO_ITF_TEXT to initialize it from a long text.
Here is an example with input and expected result.
Note that the STREAM_LINES parameter is an internal table which can be initialized with one line, and that you may fill with:
DATA(stream_line) = ||.
CONCATENATE txt1 txt2 ... txt6 INTO stream_line RESPECTING BLANKS.
DATA(stream_lines) = VALUE string_table( ( stream_line) ).
...
(RESPECTING BLANKS so that to not lose the trailing spaces).