Application Development and Automation 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: 
Read only

FM - Read_Text

Former Member
0 Likes
1,501

Hi all,

I am using Func.Module Reae_text, in which i want to display all the lines whatever is there in the text tab, should be displayed as a paragraph. I am using the following code which displays only the last line.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = SY-LANGU

NAME = NUM3

OBJECT ='VBBP'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = G_T_LINES

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 G_T_LINES.

MOVE G_T_LINES-TDLINE TO REM1.

ENDLOOP.

READ TABLE OUT_TAB WITH KEY 'REM1'.

IF SY-SUBRC EQ 0.

MOVE REM1 TO OUT_TAB-VALUE.

MODIFY OUT_TAB INDEX SY-TABIX.

ENDIF.

Hi all,

I am using Func.Module Reae_text, in which i want to display all the lines whatever is there in the text tab, should be displayed as a paragraph. I am using the following code which displays only the last line.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = SY-LANGU

NAME = NUM3

OBJECT ='VBBP'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = G_T_LINES

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 G_T_LINES.

MOVE G_T_LINES-TDLINE TO REM1.

ENDLOOP.

READ TABLE OUT_TAB WITH KEY 'REM1'.

IF SY-SUBRC EQ 0.

MOVE REM1 TO OUT_TAB-VALUE.

MODIFY OUT_TAB INDEX SY-TABIX.

ENDIF.

11 REPLIES 11
Read only

Former Member
0 Likes
1,461

LOOP AT G_T_LINES.

*--MOVE G_T_LINES-TDLINE TO REM1.

<b> concatenate REM1

G_T_LINES-TDLINE

into REM1 SEPARATED BY SPACE.</b>

ENDLOOP.

each loop pass of G_T_LINES, TDLINE value will be populated to REM1. but next LOOP, REM1 value again replaced with 2nd line of TDLINE.

so instead of MOVE, use CONCATENATE

DEFINE REM1 TYPE STRING.

then do your processing.

Regards

srikanth

Message was edited by: Srikanth Kidambi

Read only

0 Likes
1,461

Yes Srikanth, i used but its displaying as a single line & i've not restricted o/p length.

In SAP Script I want to restrict the text length only in a particular column ( Ex:Material Description Column)

Read only

0 Likes
1,461

OTAB-VALUE IS 255 character field. so you CANT transfer more than that length.

try to follow the logic i have given how to write the include in the script itself.

then follow like this

<b>I2 Shipping Instructions:

/: INCLUDE &X_EKKO-EBELN& OBJECT EKKO ID F06 LANGUAGE EN</b>

here: in the line first "Shipping Instructions" Will be comming followed by the text.

regards

srikanth

Message was edited by: Srikanth Kidambi

Read only

0 Likes
1,461

Understood, but Shipping Instructions: and my text to be a continuous line, should not be followed.

Ex: Shipping Instructions: -


my text----

Read only

Former Member
0 Likes
1,461

Hi ravi ,

in that case u have to do a loop @

<b>MOVE REM1 TO OUT_TAB-VALUE.</b>bcos u will get no.of lines not only one line items, so we have to do the loop.

Regards

Prabhu

Read only

Former Member
0 Likes
1,461

Hi ravi,

you have to concatenate or else you get only last line,

is REM1 is of type string , if not declare like that.

data: REM1 TYPE STRING.
LOOP AT G_T_LINES.
concatenate REM1 G_T_LINES-TDLINE INTO REM1.
ENDLOOP.

Regards

vijay

Read only

Former Member
0 Likes
1,461

it seems to be you are printing the text, in script.so instead of writing the total logic in the program and sending it back to the script , you can use another alternative.

in the script editor itself, you can give the command which will take care of fetching text for that document.

in your case,

in the script editor,

/: INCLUDE &X_EKKO-EBELN& OBJECT VBBP ID 0001 LANGUAGE EN

&X_EKKO-EBELN& this is my po number,you can give your NUM3 equalent variable available in the script.

revert, if you need any further help.

regards

srikanth

Read only

0 Likes
1,461

NO i want to start the text by giving some space in the output, so it is not possible in INCLUDE Statement.

Ex: REMARKS : -


my text----

Read only

Former Member
0 Likes
1,461

Hi

i'm using read_text...from the sample prog available here.

can we loop thru G_T_lines and can we write the tdline lo report??

if i try the same i'm getting short dump

help me

Praneeth

Read only

Former Member
0 Likes
1,461

Hi Ravi

t_head-tdobject = 'ZOBJ1'.

t_head-tdid = 'I01'.

t_head-tdname = '003'.

t_head-tdspras = 'E'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = t_head-tdid

language = t_head-tdspras

name = t_head-tdname

object = t_head-tdobject

TABLES

lines = t_text

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.

CALL FUNCTION 'INIT_TEXT'

EXPORTING

id = t_head-tdid

language = t_head-tdspras

name = t_head-tdname

object = t_head-tdobject

TABLES

lines = t_text

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

else.

LOOP AT t_text.

tab-line = t_text-tdline.

APPEND tab.

ENDLOOP.

CONCATENATE sy-uname sy-datum sy-timlo INTO tmp_tab-line SEPARATED

BY space.

APPEND tmp_tab-line TO tab.

DESCRIBE TABLE tab LINES tmp_len. " old value

APPEND space TO tab.

DESCRIBE TABLE tab LINES tmplen. " newvalue

Read only

Former Member
0 Likes
1,461

You just need to move the code for READ table inside the loop and you would be able to capture all text lines.

LOOP AT G_T_LINES.

MOVE G_T_LINES-TDLINE TO REM1.

READ TABLE OUT_TAB WITH KEY 'REM1'.

IF SY-SUBRC EQ 0.

MOVE REM1 TO OUT_TAB-VALUE.

MODIFY OUT_TAB INDEX SY-TABIX.

ENDIF.

ENDLOOP.

Regards

Anurag