2016 Aug 03 8:12 PM
Hello,
I have been trying to figure where I can get the Purchase Order Text in MM03. I have looked at the STXH, the STXL and, the MARA table and I am still not having any luck in finding the text. I am trying to create a report when a user runs the report it'll show up instead of using MM03. I need help in locating the text. Thanks.
2016 Aug 03 8:21 PM
Hi Shawn,
Try the following values for the FM 'READ_TEXT':
id = 'BEST'
object = 'MATERIAL'
name = material value
language = sy-langu
Regards,
Ryan Crosby
Hello,
I have been trying to figure where I can get the Purchase Order Text in MM03. I have looked at the STXH, the STXL and, the MARA table and I am still not having any luck in finding the text. I am trying to create a report when a user runs the report it'll show up instead of using MM03. I need help in locating the text. Thanks.
2016 Aug 03 8:21 PM
Hi Shawn,
Try the following values for the FM 'READ_TEXT':
id = 'BEST'
object = 'MATERIAL'
name = material value
language = sy-langu
Regards,
Ryan Crosby
2016 Aug 03 8:31 PM
Thanks. I was able to get the info but I am trying to see where I can get the text from a table. Thanks Ryan.
2016 Aug 03 8:36 PM
Hi Shawn,
You cannot read the data directly from the table because it's stored in a RAW format. The purpose of that FM is to give it back to you in the human readable form that you see in MM03.
Regards,
Ryan Crosby
2016 Aug 03 8:39 PM
Okay. So there is no other way get the text but only from MM03?
2016 Aug 03 8:42 PM
Hi Shawn,
Well it is one of the return values in that function 'READ_TEXT' so that you can reconstruct the text and display it. It comes back in the form of an internal table with line structure TLINE which has two fields called TDFORMAT and TDLINE and the TDLINE field has a length of 132 characters.
Regards,
Ryan Crosby
2016 Aug 03 8:49 PM
Thanks. I will tell the user that the only way is to use MM03.
2016 Aug 03 9:02 PM
if you just need an online report then you do not need to create anything yourself as SAP has already a standard report, see
I wonder anyway how quick you give up with such a simple report, don't you fear that your users have friends working with SAP in another company and know that they can get such report?
2016 Aug 03 9:21 PM
Thanks. I did find that very helpful. The end users thinks a report can easily be made but inputting the Material # and the Purchase Order Text will also be included to the report. I am trying to find a way to create a custom report if not use
2016 Aug 03 9:26 PM
Hi Shawn,
It would not be difficult to take the table data from 'READ_TEXT' and construct some output. The question would be what kind of formatting the user is expecting. Are they expecting bold, italic, different size fonts, etc. or simply just an output that shows all the data from the text in a simple format?
Regards,
Ryan Crosby
2016 Aug 03 9:32 PM
They just want a simple text report showing all of the data from the Material Number(s). Simple format.
2016 Aug 03 9:39 PM
ask any of the experienced ABAPers here and they would tell you that they write such small report in less time than I need to click through our Solman system to create a Change Request. Any beginner who has taken the BC400 course should be able to finish this request in about 1 hour.
And I needed just to put these words into Google to get several fully coded reports: call function read_text select extract long text BEST
2016 Aug 03 9:56 PM
Hi Shawn,
Here is example with a very rudimentary output but it's only meant to serve as an example and any formatting/output requirements you might have you would have to take care of independently.
TABLES: mara.
TYPES: BEGIN OF ty_material,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_material.
DATA: gt_matnr TYPE TABLE OF ty_material,
gs_matnr TYPE ty_material,
gv_tdname TYPE tdobname,
gt_lines TYPE TABLE OF tline,
gs_line TYPE tline,
gv_str TYPE string.
CONSTANTS: gc_tdid TYPE tdid VALUE 'BEST',
gc_tdobject TYPE tdobject VALUE 'MATERIAL'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
REFRESH: gt_matnr.
SELECT mara~matnr makt~maktx
FROM mara INNER JOIN makt ON mara~matnr = makt~matnr
INTO TABLE gt_matnr
WHERE mara~matnr IN s_matnr
AND makt~spras = sy-langu.
IF sy-subrc <> 0.
MESSAGE 'Nothing found' TYPE 'I'.
RETURN.
ENDIF.
END-OF-SELECTION.
LOOP AT gt_matnr INTO gs_matnr.
REFRESH: gt_lines.
gv_tdname = gs_matnr-matnr.
CONCATENATE gs_matnr-matnr ' - ' gs_matnr-maktx INTO gv_str SEPARATED BY space.
WRITE: / gv_str INTENSIFIED COLOR 1.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = gc_tdid
language = sy-langu
name = gv_tdname
object = gc_tdobject
TABLES
lines = gt_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.
LOOP AT gt_lines INTO gs_line.
WRITE: / gs_line-tdline.
ENDLOOP.
ELSE.
WRITE: / 'No text found'.
ENDIF.
WRITE: /.
ENDLOOP.
Regards,
Ryan Crosby
2016 Aug 03 10:08 PM
Thank you very much Ryan. That helped me so much. Now I can change the output format
2016 Aug 04 4:48 PM
Ryan,
I am trying to remove the leading zero. I tried to search for a solution but I still can't figure it out.
data matnr(18) value '000000000000012345'.
Call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
Exporting
input = matnr
Importing
output = matnr.
write matnr.
2016 Aug 04 4:52 PM
Hi Shawn,
The code you have pasted looks fine - I tested it out in my system and I don't see any leading zeroes when it writes the value. Do you have a different example from the place where it is not working?
Regards,
Ryan Crosby
2016 Aug 04 5:12 PM
Ryan,
I figured it out. Thanks
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = gv_tdname
IMPORTING
OUTPUT = gs_matnr-matnr.
2016 Aug 03 9:28 PM
Has someone 5 minutes to write this program and post it here? That would be useful !