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: 

Smartforms

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

Franco,

What is the problem with the character format for the first line? The issue is not clear, could you please explain?

regards,

Ravi

0 Kudos

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

0 Kudos

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!

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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