10-25-2007 9:32 AM
Hi all,
My requirement is to read the long text of a particular material number and display on report program.
In ME5A Std.TCode,if i enter purch req numbr,and execute it i will get a list display of purchase requisition..heer , in this o/p i need to add a column of long text of tht particular material.
So, how to find wr the long text is saved and how to call to a list display....
Pls help me ,,,,
I reward points for the helpful answer...
Thanx.
regards,
Prashanth.
10-25-2007 9:34 AM
you can find the standard text for a material via function module READ_TEXT with TDOBJECT = 'MATERIAL'
TDNAME = material number
TDID = id for the particular material text
regards
Hans
10-25-2007 9:36 AM
chech this...
hi,
declare the paramters like:
To fetch Long Text lines for READ_TEXT function module
DATA:BEGIN OF dt_lines OCCURS 0.
INCLUDE STRUCTURE tline. " Long Text
DATA:END OF dt_lines.
Variable declarations for Read_TEXT function module
DATA : dl_name TYPE thead-tdname, " Object Name
dl_lan TYPE thead-tdspras. " Language
Constants
CONSTANTS:
Object ID for Long Text of Sales Item Text
c_best TYPE thead-tdid value 'Z026', ID
c_object TYPE thead-tdobject . " Object
Object will be VBBK, and the Object name will be the concatenation of Sales order and Item No(for Item texts) and only Sales order for Header texts.
Language will be default sy-Langu.
In the loop of Sales orders call this fun module and use by passing all the above 4 paramters ID,OBJECT,NAME and LANG.
You double click on that text
GOTO -> header you will know the all above paramters.
READ_TEXT
READ_TEXT provides a text for the application program in the specified work areas.
The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.
After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.
If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.
Function call:
CALL FUNCTION 'READ_TEXT'
EXPORTING CLIENT = SY-MANDT
OBJECT = ?...
NAME = ?...
ID = ?...
LANGUAGE = ?...
ARCHIVE_HANDLE = 0
IMPORTING HEADER =
TABLES LINES = ?...
EXCEPTIONS ID =
LANGUAGE =
NAME =
NOT_FOUND =
OBJECT =
REFERENCE_CHECK =
WRONG_ACCESS_TO_ARCHIVE =
Export parameters:
CLIENT
Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.
Reference field: SY-MANDT
Default value: SY-MANDT
OBJECT
Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.
Reference field: THEAD-TDOBJECT
NAME
Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.
Reference field: THEAD-TDNAME
ID
Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.
Reference field: THEAD-TDID
LANGUAGE
Enter the language key of the text module. The system accepts only languages that are defined in table T002.
Reference field: THEAD-TDSPRAS
ARCHIVE_HANDLE
If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.
The value '0' indicates that you do not want to read the text from the archive.
Reference field: SY-TABIX
Default value: 0
Import parameters:
HEADER
If the system finds the desired text, it returns the text header in this parameter.
Structure: THEAD
Table parameters:
LINES
The table contains all text lines that belong to the text read.
Structure: TLINE
Exceptions:
ID
The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.
LANGUAGE
The parameter LANGUAGE contains a language key that does not exist in table T002.
NAME
The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.
Possible errors:
The field contains only blanks.
The field contains the invalid characters * or ,.
OBJECT
The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.
NOT_FOUND
The system did not find the specified text module.
REFERENCE_CHECK
The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.
WRONG_ACCESS_ TO_ARCHIVE
The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).
**********************************************************
All the texts are stored in a table called STXL
U can read it Using the READ_TEXT function by passing the respective parameters which u can get from the above table..
10-25-2007 9:37 AM
hi,
All the long text can be retrieve using this method.
You have to used the READ_TEXT functions to read the SAP long text. e.g. Sales Order, Purchase Order Item text etc.
To check your long text header, go into the long text. Click Goto -> Header
Example of READ_TEXT functions reading tables PBIM - Independent requirements for material.
REPORT ZTEXT .
TABLES: PBIM.
stxh, stxl, stxb - trans tables for text
ttxit - text on text-ids
ttxot - Short texts on text objects
Transaction MD63
SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR,
S_WERKS FOR PBIM-WERKS.
DATA: BEGIN OF HTEXT.
INCLUDE STRUCTURE THEAD.
DATA: END OF HTEXT.
DATA: BEGIN OF LTEXT OCCURS 50.
INCLUDE STRUCTURE TLINE.
DATA: END OF LTEXT.
DATA: BEGIN OF DTEXT OCCURS 50.
DATA: MATNR LIKE PBIM-MATNR.
INCLUDE STRUCTURE TLINE.
DATA: END OF DTEXT.
DATA: TNAME LIKE THEAD-TDNAME.
SELECT * FROM PBIM WHERE WERKS IN S_WERKS.
MOVE PBIM-BDZEI TO TNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'PB'
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'PBPT'
ARCHIVE_HANDLE = 0
IMPORTING
HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO DTEXT-TDLINE.
MOVE PBIM-MATNR TO DTEXT-MATNR.
APPEND DTEXT.
ENDIF.
ENDLOOP.
ENDSELECT.
LOOP AT DTEXT.
WRITE:/ DTEXT-MATNR, DTEXT-TDLINE.
ENDLOOP.
What is the purpose of READ_TEXT functuion module and how to get text id value in this scenario(TDID)?
In business process, there are so many transactions that take place in every day, like purchase orders, sales orders, delivery, gooodsmovement etc... SAP provided a feature to maintain some text descriptions.
Read_Text Function module is used to retrieve the text for a particular objects.
To find the Text id these are the following steps. Let us take an example of Billing document Header text.
1. goto VF03, enter Billing doc Number
2. from menuselect Goto>Header-->header Text..... New window will be displayed
3. select the Header Text. here you can see all the text.
4. click on the TEXT (which you want to know the Text id) , then press log ICON (you can find in bottom right of the text window) it looks like a rolled paper.
5. in the Next window you will find Text Name. Text ID, Language. etc...
regards
siva
10-25-2007 9:39 AM
Use READ_TEXT function module. u can find out the details of the text to be passed in READ_TEXT as explained in above replies or alternatively u can find out from SE75 tcode
10-25-2007 9:56 AM
Hi
you have to copy the std program to Z program and to find out the final
internal table
and in the loop of the internal table you have to call this code
see the sample code
report zmm_longtext
no standard page heading
line-size 255.
TABLES: mara.
Internal Table for Material Texts Data
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr, " Material
END OF itab.
To read Long Text lines for function module
DATA:BEGIN OF dt_lines OCCURS 0.
INCLUDE STRUCTURE tline. " Long Text
DATA:END OF dt_lines.
Variable declarations for CREATE_TEXT function module
DATA : dl_name TYPE thead-tdname, " Object Name
dl_lan TYPE thead-tdspras, " Language
gv_matnr TYPE matnr.
Constants
CONSTANTS:
Object ID for Long Text of Material Basic Data 1
c_best TYPE thead-tdid VALUE 'GRUN',
c_material TYPE thead-tdobject VALUE 'MATERIAL'. " Object
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECT matnr FROM mara INTO TABLE itab WHERE
matnr IN s_matnr.
get the Texts
SORT itab BY matnr.
LOOP AT itab.
dt_lines-tdformat = 'ST'.
dt_lines-tdline = itab-text.
APPEND dt_lines.
dl_name = itab-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = c_best
language = sy-langu
name = dl_name
object = c_material
TABLES
lines = dt_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.
AT END OF matnr.
REFRESH dt_lines.
ENDAT.
ENDLOOP.
regards
Anji
10-25-2007 10:08 AM
Hi Anji,
ThanQ very much ...
I just copied the program to Z...
But am not able to execute it, it showing errors abt the enhancements and some fields.....
wt i should do to copy all its enhancements or what ever....
reply.
regards,
prashanth.
10-25-2007 10:04 AM
Hi Prashanth,
Use FM 'READ_TEXT'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F01'
LANGUAGE = 'EN'
NAME = '4500000001'
OBJECT = 'EKKO'
IMPORTING
HEADER = IT_HEADER
TABLES
LINES = IT_LINES1
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
Regards,
Hemant
10-25-2007 10:55 AM