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: 

runtime atachment

Former Member
0 Kudos

hello everyone,

How to send runtime values to Long text messages?

I've created a short text message first and then i attached a long text to it. In the long text i want a field value to get populated at runtime.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Yes, you can use LONGTEXT in your Message Statement, but due to text limitations it will be cut off.

You can use READ_TEXT FM to read the required LONGTEXT, capture the value in a variable and print it in your Message statement.

Check out if the below code helps.

Code:

&----


*& Report ZPR_TEST1_1 *

*& *

&----


*& *

*& *

&----


REPORT ZPR_TEST1_1 .

DATA IT_LTEXT LIKE tline OCCURS 0 WITH HEADER LINE .

DATA: V_MYVAL(400).

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'GRUN'

language = sy-langu

name = 'FORALE'

object = 'MATERIAL'

archive_handle = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = IT_LTEXT

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.

LOOP AT IT_LTEXT .

CONCATENATE IT_LTEXT V_MYVAL INTO V_MYVAL.

ENDLOOP.

*WRITE: MYVAL.

MESSAGE W899(V1) WITH V_MYVAL.

... WITH f1 ... f4

Note

You can output up to 50 characters per field. If the field contains more characters, these are ignored.

Regards

Siva.

Reward if useful.

1 REPLY 1

Former Member
0 Kudos

Hi,

Yes, you can use LONGTEXT in your Message Statement, but due to text limitations it will be cut off.

You can use READ_TEXT FM to read the required LONGTEXT, capture the value in a variable and print it in your Message statement.

Check out if the below code helps.

Code:

&----


*& Report ZPR_TEST1_1 *

*& *

&----


*& *

*& *

&----


REPORT ZPR_TEST1_1 .

DATA IT_LTEXT LIKE tline OCCURS 0 WITH HEADER LINE .

DATA: V_MYVAL(400).

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'GRUN'

language = sy-langu

name = 'FORALE'

object = 'MATERIAL'

archive_handle = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = IT_LTEXT

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.

LOOP AT IT_LTEXT .

CONCATENATE IT_LTEXT V_MYVAL INTO V_MYVAL.

ENDLOOP.

*WRITE: MYVAL.

MESSAGE W899(V1) WITH V_MYVAL.

... WITH f1 ... f4

Note

You can output up to 50 characters per field. If the field contains more characters, these are ignored.

Regards

Siva.

Reward if useful.