‎2007 Aug 28 3:06 PM
Hi All,
If I hardcode material number, without loop statement call function READ_TEXT gives subrc 0. If I pass it through internal table in a loop, it ends up with SUBRC 4.
Moreover, this does not even enter into FM Read_text.
can somebody help me with this.
lOOP AT ITAB.
ALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'GRUN'
LANGUAGE = 'EN'
NAME = ITAB-MATNR
NAME = '000000000123456789'
OBJECT = 'MATERIAL'
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
.
ENDLOOP.
Thanks
Sharat
‎2007 Aug 28 3:12 PM
Hi sharat,
<b>NAME shoule be of type THEAD-TDNAME, try this
data : name like THEAD-TDNAME.</b>
lOOP AT ITAB.
<b>NAME = ITAB-MATNR.</b>
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'GRUN'
LANGUAGE = 'EN'
<b>NAME = NAME</b>
OBJECT = 'MATERIAL'
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
.
<b>CLEAR NAME.</b>
ENDLOOP.
Message was edited by:
Chandrasekhar Jagarlamudi
‎2007 Aug 28 3:12 PM
Hi sharat,
<b>NAME shoule be of type THEAD-TDNAME, try this
data : name like THEAD-TDNAME.</b>
lOOP AT ITAB.
<b>NAME = ITAB-MATNR.</b>
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'GRUN'
LANGUAGE = 'EN'
<b>NAME = NAME</b>
OBJECT = 'MATERIAL'
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
.
<b>CLEAR NAME.</b>
ENDLOOP.
Message was edited by:
Chandrasekhar Jagarlamudi
‎2007 Aug 28 3:35 PM
Sekhar, Sudheer / Mahesh and others,
Thanks for your replies,
Firstly, there is no problem with conversion routine, as my Matnr is 18 Char, I saw it in debug, before entering the FM.
Secondly, the problem is that it does not enter into FM,
After Loop at Itab statement, when I press F5, it comes out of FM, it is not going inside FM.
Maybe Sekhar is right, I will try his solutions and get back to you.
My concern is ... It is not even entering into FM.
Regards
Sharat
‎2007 Aug 28 3:39 PM
arrrgn now i got it.
if it doesnt even get INTO the FM, then the problem is very clear.
your itab has 0 records.
‎2007 Aug 28 4:05 PM
Thanks Kemmer,
but your guess is right but in my situation , it is not right.
I have data in inetrnal table.
Thanks
Regards
Sharat
‎2007 Aug 28 4:31 PM
HI,
if your table contains some records then it should definetly go into the funciton module how ever just try this.
after the read_text fm just place if sy-subrc <> 0 endif. and put a break point here at if statment as see what is wrong.
Thansk
Mahesh
‎2007 Aug 28 4:39 PM
Try if this works.
parameters p_matnr type matnr.
data: temp_text type table of tline with header line,
where_cond(20) type c.
data : begin of text_id ,
tdobject(10) value 'MVKE',
tdname(70),
tdid(4) value '0001',
tdspras value 'D',
end of text_id.
start-of-selection.
concatenate '%'
p_matnr
'%'
into where_cond.
select single tdname
from stxl
into text_id-tdname
where relid = 'TX' and
tdspras = 'E' and
tdname like where_cond.
import tline = temp_text[]
from database stxl(TX) id text_id.
write: / sy-subrc.
loop at temp_text.
write : / temp_text-tdline.
endloop.
Thanks
Mahesh
‎2007 Aug 28 5:06 PM
Thanks Mahesh,
My internal table is defined as table with header. and I have data in my header line. is it okay. Please let me know.
just after loop.
I can see in Sy-dbcnt = 1. but the data is just in header.
Regards
Sharat
‎2007 Aug 28 7:17 PM
Thanks All,
I got it. I am closing this thread.
this was a silly question, I did not append itab. So data was only at the header and did not went into loop and FM read_text.
Thanks
Sharat
‎2007 Aug 28 3:17 PM
Hi,
You need to use the conversion exit before passing the material number to this field
lOOP AT ITAB.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = ITAB-MATNR
IMPORTING
OUTPUT = ITAB-MATNR.
ALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'GRUN'
LANGUAGE = 'EN'
NAME = ITAB-MATNR
OBJECT = 'MATERIAL'
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
.
ENDLOOP.
Regards
Sudheer
‎2007 Aug 28 3:19 PM
data : lv_matnr like THEAD-TDNAME,
v_matnr like mara-matnr.
lOOP AT ITAB.
call function 'conversion_exit_alpha_input'
exporting
input = itab-matnr
importing
output = v_matnr.
lv_matnr = v_MATNR.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'GRUN'
LANGUAGE = 'EN'
NAME = lv_matnr
OBJECT = 'MATERIAL'
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
.
CLEAR lv_matnr.
ENDLOOP.
‎2007 Aug 28 3:20 PM
well, did you have a look at the exeptions part yet?
sy-subrc 4 means the TEXT is not found, its not a fault or anything, there is just NO text for this record.
probably you dont have a text for every record of your itab.
to recheck use another window, goto se37 and execute the FM read_text manually from there. feed it with same data and see if there really isnt anything, which i strongly believe.