‎2007 Jan 02 9:08 AM
Hi All
I need to retrive the text from CAUFVD-STTXT.
Basically this is the text to be retrieved pertaining to a Production Order (AUFK-AUFNR). Production Orders can be found in CO03 Tcode.
All i know is that we need to use the FM "READ_TEXT".
How to use this FM in the above specified scenario..??????
Please help me by mentioning the parameters to be used in the READ_TEXT module....
Regards
Pavan
‎2007 Jan 02 9:16 AM
Hi,
Here is the pseudo code from http://www.sapdevelopment.co.uk/fmodules/fms_readtext.htm.
*Internal table to store standard texts
DATA: IT_TEXTS like T_LINE occurs o with header line.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = "Text ID
language = 'E'
name = "Text name
object = "text object
ARCHIVE_HANDLE = 0
IMPORTING
HEADER =
tables
lines = IT_TEXTS "Internal table
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.
‎2007 Jan 02 9:16 AM
Hi,
Here is the pseudo code from http://www.sapdevelopment.co.uk/fmodules/fms_readtext.htm.
*Internal table to store standard texts
DATA: IT_TEXTS like T_LINE occurs o with header line.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = "Text ID
language = 'E'
name = "Text name
object = "text object
ARCHIVE_HANDLE = 0
IMPORTING
HEADER =
tables
lines = IT_TEXTS "Internal table
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.
‎2007 Jan 02 9:17 AM
Hi,
Check here.
You can find lot of sample code.
search in sapfans.com for read_text.
‎2007 Jan 02 9:19 AM
Hi Pavan
Please check the code
Here in the export parameters you need to find ID, LANG, NAME, and OBJECT
By the query I can say that NAME is value of AUFK-AUFNR, and object is 'AUFK'.
You can debug the text for Production Order by going into T-code CO03 and putting a break-point at FM Read text and can retrieve all 4 export parameters..
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = 'F01'
language = 'E'
name = d_name
object = 'EKKO'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = it_text
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
Thanks
Gaurav
‎2007 Jan 02 9:22 AM
Hello Pavan,
You can use this code.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'KOPF'
language = sy-langu
name = aufk-aufnr
object = 'AUFK'
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 SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Manoj
‎2007 Jan 02 9:33 AM
Hi All...
Thanks for your Response.
I have used the following code in my program to retrieve the Order Status(CAUFVD-STTXT) from a Production Order.
loop at i_aufk.
move i_aufk-aufnr to l_aufnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'KOPF'
LANGUAGE = sy-langu
NAME = l_aufnr
OBJECT = AUFK
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = i_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.
clear l_aufnr.
endloop.
The internal Table i_aufk contains 10 Production Orders and i need to find the respective Order Status of those orders.
Using above code, the system is giving RunTime error at the statement "CALL FUNCTION 'READ_TEXT'".....
What might be the problem..??????
Regards
Pavan
‎2007 Jan 02 9:40 AM
Hi Pavan ,
Just one simple change in the code.
The Name that is to be passed must be in this format
<b>client</b><i>productionordernumber</i>
for e.g
if client is 999 and production order is 1002723,
since length of PO order is 12 so it must occupy 12 chars so the final value you pass to the FM must be
<b>999</b><i>000001002723</i>
and yes do <b>declare the correct variable</b> type the reason for your dump can be incompatable data type.
Please test and see if it works.
Regards
Arun
Reward with points if reply is helpful
‎2007 Jan 02 9:41 AM
Declare l_aufnr as type thead-tdname.
data: l_aufnr type thead-tdname.
Regards,
Manoj
‎2007 Jan 02 10:15 AM
Thanks for your guidance....
Wishing You and Your Family a Happy and joyful New Year...
Lets Rock in 2007...