‎2006 Mar 16 11:24 AM
Hello to all,
In a Smartforms we must print in a text node the first line of a long text.
To do so we read the long text and put its first line in a global data. Then we print the global data.
The problem are the character format founded in the first line of the long text that are printed as text......
Help me please.
Regards
Franco
‎2006 Mar 16 12:15 PM
Hi,
Try this code :
Data :wa_lines type tline.
DATA: BEGIN OF lt_line occurs 0.
INCLUDE STRUCTURE tline.
DATA: END OF lt_line.
move wa_vbrk-vbeln to gv_Tdname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = C_ZH01
LANGUAGE = wa_kna1-spras
NAME = gv_tdname
OBJECT = 'VBBK'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = lt_line
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DESCRIBE TABLE lt_line LINES wa_lines.
CHECK NOT wa_lines IS INITIAL.
LOOP AT lt_line.
SEARCH lt_line-tdline FOR '. .'.
MOVE lt_line-tdline TO gv_text.
endloop.Finally print gv_text.
Regards,
Gayathri
‎2006 Mar 16 11:40 AM
Franco,
What is the problem with the character format for the first line? The issue is not clear, could you please explain?
regards,
Ravi
‎2006 Mar 16 11:51 AM
Hello Ravi,
In our Smartforms we must print the first line of a long text.
To do that we insertd a program lines where, via function module READ_TEXT, we read the long text and put the first line of it in the global data w_text.
Then we print w_text in a text node.
As result we obtained this text in output:
<H>ST1000 MATERIAL 1014 </>
where <H> and </> are character formats put by the user when he wrote the text in the document.
Thanks and regards
Franco
‎2006 Mar 16 12:05 PM
Hi there Franco... maybe you have to specify to put in the variable w_text only the field TDLINE of the result table in FM READ_TEXT, i think that the format info of the line are stored in another field.
Hope it Helps!
‎2006 Mar 16 12:10 PM
Hi Jesus
Testing function module via transaction SE37, the content of the first row of table TLINE is as follow:
TDFORMAT = '*'
TDLINE = <H>ST1000 MATERIAL 1014 </>
Thanks and regards
Franco
‎2006 Mar 16 12:15 PM
Hi,
Try this code :
Data :wa_lines type tline.
DATA: BEGIN OF lt_line occurs 0.
INCLUDE STRUCTURE tline.
DATA: END OF lt_line.
move wa_vbrk-vbeln to gv_Tdname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = C_ZH01
LANGUAGE = wa_kna1-spras
NAME = gv_tdname
OBJECT = 'VBBK'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = lt_line
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DESCRIBE TABLE lt_line LINES wa_lines.
CHECK NOT wa_lines IS INITIAL.
LOOP AT lt_line.
SEARCH lt_line-tdline FOR '. .'.
MOVE lt_line-tdline TO gv_text.
endloop.Finally print gv_text.
Regards,
Gayathri
‎2006 Mar 16 12:33 PM
Hello Gayathri,
I hope to solve using this code putted after the READ_TEXT
... Function READ_TEXT
CALL FUNCTION 'CONVERT_TEXT'
EXPORTING
format_type = 'ASCII'
TABLES
foreign = tline
itf_lines = tline.
LOOP AT tline.
SHIFT tline BY 2 PLACES RIGHT.
tline-tdformat = '*'.
MODIFY tline.
ENDLOOP.
... Assigning W_TEXT