2007 Jun 01 5:08 AM
Hi,
iam having one problem if i call read_text fm
only one line is coming in the output.
eg: material(Text)
plant (Text)
my progaram write only one line ie. material i want to consider f all the line in single line.
opt should be: materialplant.
please correct this code
loop at t_mara.
*CONCATENATE t_mara-matnr t_mara-dwerks INTO TeMP IN CHARACTER MODE.
temp = t_mara-matnr .
temp+19(4) = t_mara-dwerks .
WRK_NAME = temp.
*WRITE: / temp..
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'LTXT'
LANGUAGE = SY-LANGU
NAME = WRK_NAME
OBJECT = 'MDTXT'
IMPORTING
HEADER =
TABLES
LINES = IT_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
READ TABLE IT_LINES INDEX 1.
TXT_TD03 = IT_LINES-TDLINE.
MOVE TXT_TD03 TO T_MARA-TEXT.
MODIFY T_MARA.
ENDIF.
2007 Jun 01 5:13 AM
keep your internal table in the loop ,
loop at tlines.
use concatenate into string.
endloop.
finally you will have data in single line..
acutall my code is working the problem is if the text contains multiple lines its bringing only first line in the output i want to consider all the lines present there
it should be concatenated
2007 Jun 01 5:11 AM
Hi Arun ,
Check the IT IT_LINES , it must have more than one line .
So loop on IT_LINES and concatenate the text into a varaible separated by sapce.
Loop at IT_LINES.
concatenate T_MARA-TEXT IT_LINES-<TEXT> into T_MARA-TEXT separated by sapce.
endloop.
MODIFY T_MARA.
Hope this helps
Regards
Arun
Message was edited by:
Arun R
2007 Jun 01 5:12 AM
Change as below,
<b>Looa at IT_LINES.</b>
TXT_TD03 = IT_LINES-TDLINE.
MOVE TXT_TD03 TO T_MARA-TEXT.
MODIFY T_MARA.
<b>endloop.</b>
Reward points if useful.
Regards,
Atish
2007 Jun 01 5:13 AM
keep your internal table in the loop ,
loop at tlines.
use concatenate into string.
endloop.
finally you will have data in single line..
2007 Jun 01 5:49 AM
hai
DATA wa_it_lines LIKE TLINE.
DATA WRK_NAME LIKE THEAD-TDNAME.
data TXT_TD03 (70).
CONCATENATE W_IT_NUMBER W_IT_DE_NUMBER INTO W_NUMBER.
*Get the dETAIL NUMBER
call function 'READ_TEXT'
exporting
id = 'LTXT'
language = sy-langu
name = WRK_NAME
object = 'MDTXT'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = it_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 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
read table it_lines index 1 into wa_it_lines .
*GET THE NUMBER BY
TXT_TD03 = IT_LINES-TDLINE.
MOVE TXT_TD03 TO T_MARA-TEXT.
MODIFY T_MARA.
do it like this
regard
nawa
2007 Jun 01 6:00 AM
Hi thanks for ur help please iam not able to get u,can u please change the code and send to me let me check it here
2007 Jun 01 6:05 AM
Try this.
loop at t_mara.
*CONCATENATE t_mara-matnr t_mara-dwerks INTO TeMP IN CHARACTER MODE.
temp = t_mara-matnr .
temp+19(4) = t_mara-dwerks .
WRK_NAME = temp.
*WRITE: / temp..
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'LTXT'
LANGUAGE = SY-LANGU
NAME = WRK_NAME
OBJECT = 'MDTXT'
IMPORTING
HEADER =
TABLES
LINES = IT_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
<b>LOOP AT IT_LINES.</b>
TXT_TD03 = IT_LINES-TDLINE.
MOVE TXT_TD03 TO T_MARA-TEXT.
<b>APPEND T_MARA.</b>
<b>ENDLOOP.</b>
ENDIF.
It will work. Let me know the result.
Regards,
Atish
2007 Jun 01 6:10 AM
acutall my code is working the problem is if the text contains multiple lines its bringing only first line in the output i want to consider all the lines present there
it should be concatenated
2007 Jun 01 6:15 AM
Hi Arun,
where do you want to concatenate the same?
Do you want to print material number and description or what?
Regards,
Atish
2007 Jun 01 6:13 AM
loop at t_mara.
*CONCATENATE t_mara-matnr t_mara-dwerks INTO TeMP IN CHARACTER MODE.
temp = t_mara-matnr .
temp+19(4) = t_mara-dwerks .
WRK_NAME = temp.
*WRITE: / temp..
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'LTXT'
LANGUAGE = SY-LANGU
NAME = WRK_NAME
OBJECT = 'MDTXT'
* IMPORTING
* HEADER =
TABLES
LINES = IT_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS .
<b>DATA : TEXT TYPE STRING.</b>
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
<b>LOOP AT IT_LINES.
TXT_TD03 = IT_LINES-TDLINE.
CONCATENATE TXT_TD03 INTO TXT_TD03 SEPERATED BY SPACE.
ENDLOOP.
MOVE TXT_TD03 TO T_MARA-TEXT.
MODIFY T_MARA.
CLEAR TEXT.</b>
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |