‎2009 Feb 28 10:08 AM
Hi friends,
I have a problem in using fm SELECT_TEXT.
Here I want to fetch Material PO text in Material master to my report.
I just dont know in which field of table "it_thead" the actual text is available.\
I tried debugging the program but was not successful.
I have also tried using READ_TEXT but it gives an error if no Text exists.
CALL FUNCTION 'SELECT_TEXT'
EXPORTING
client = sy-mandt
object = 'MATERIAL'
name = wrk_matnr
id = 'BEST'
language = sy-langu
TABLES
selections = it_thead.
How do i print the actual MAterial PO text in IT_THEAD ?
hope u understand the question...please do let me know if any details are required from myside..
‎2009 Feb 28 10:42 AM
Hi,
If u have text in internal table, Just loop at that table and print the text.
LOOP AT it_thead INTO wa_thead.
WRITE: /1 wa_thead-tdline.
ENDLOOP.
Thanks,
Vinod.
‎2009 Feb 28 10:52 AM
Hi Vinod,
There's no field as TDLINE in THEAD structure.
It is there in READ_TEXT FM in TLINE structure.
‎2009 Feb 28 11:05 AM
Hi,
My mistake.
Check below sample code.
PARAMETERS: po_matnr TYPE mara-matnr.
DATA: i_lines TYPE STANDARD TABLE OF tline,
wa_lines TYPE tline,
l_matnr TYPE thead-tdname.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = po_matnr
IMPORTING
OUTPUT = po_matnr
.
MOVE po_matnr TO l_matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = 'BEST'
LANGUAGE = sy-langu
NAME = l_matnr "Pass material with leading zeros
OBJECT = 'MATERIAL'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = i_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 i_lines INTO wa_lines.
WRITE: /1 wa_lines-tdline.
ENDLOOP.
Just execute this code by inputting ur material number.
If the text doesnot exist the error u r getting because of not commenting the MESSAGE statement after FM call. Try in the way i told above.
Thanks,
Vinod.
Edited by: Vinod Reddy Vemuru on Feb 28, 2009 4:36 PM
‎2009 Feb 28 11:36 AM
hI Vinod,
I've now used READ_TEXT FM and removed the Messages.
If no text exist for material then
it says TEXT 000000000005010600 ID BEST LANGUAGE EN NOT FOUND..
‎2009 Feb 28 11:46 AM
Hi,
It is obvious that if u don't have text u will get this message. But where r u getting this message?
When u execute? or exception?
U can put a check for sy-subrc after FM call. If 0 then only loop and display the data.
Did u uncommented the EXCEPTIONS in FM call? If not do that.
Comment the Message statement. U can simply copy paste my code and modify as per ur req.
Thanks,
Vinod.
‎2009 Mar 04 4:11 AM
Dear Vinod,
Thanks for your reply..
I am sorry for replying late as I was not able to access Internet since last couple of days.
I had already done everything you recommended me.
Here's my code for READ_TEXT.
It is Giving me error when I press EXECUTE Button.
LOOP AT it_mara.
CLEAR: wrk_matnr, it_tline.
REFRESH it_tline.
wrk_matnr = it_mara-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'BEST'
language = sy-langu
name = wrk_matnr
object = 'MATERIAL'
TABLES
lines = it_tline.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
EXPORTING
input = it_mara-matnr
IMPORTING
output = wa_final-matnr.
wa_final-matkl = it_mara-matkl.
wa_final-maktx = it_mara-maktx.
‎2009 Mar 04 4:21 AM
Hi try this,
tables stxh.
LOOP AT it_mara.
CLEAR: wrk_matnr, it_tline.
wrk_matnr = it_mara-matnr.
*select single **
from stxh
where TDOBJECT = 'MATERIAL' and
TDNAME = wrk_matnr and
TDID = 'BEST'
TDSPRAS = sy-langu.
if sy-subrc = 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'BEST'
language = sy-langu
name = wrk_matnr
object = 'MATERIAL'
TABLES
lines = it_tline.
loop at it_tline.
move the data of tdline to ur variable.
endloop.
endif.
‎2009 Mar 04 5:16 AM
Hi,
U have missedout exceptions part after READ_TEXT FM.
Please paste exceptions also. It works.
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
Check my earlier code.
Thanks,
Vinod.
‎2009 Feb 28 10:59 AM
Hi yogesh,
If this text is stored in Text object the you have to use read_text but text id and name should be passed corectly.
Kindly look into follwoing link:
https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/anIntroductionofTextObjects
If having any problem then let me know the details further .
Thanks
Smita
‎2009 Feb 28 11:02 AM
Hi Smita,
If I use READ_TEXT in my program,
It gives an ERROR IF NO TEXT EXIST for the particular MATERIAL.
‎2009 Mar 04 4:40 AM
Hi yogesh,
It seems that the text name you are passing does not exist in text object .
Kindly use following function before passing it to read_text
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = wrk_matnr
IMPORTING
OUTPUT = wrk_matnr
Then pass this object name to read_text
I hope it will solve your issue
if not then let me know.
Thanks,
Smita .
‎2009 Mar 04 5:10 AM
Thanks all for helping me out..
Specially Mr.A and Mr.Vinod.
The Problem has been resolved as per guidance by MR. A ..