Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Order Text

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Ryan-Crosby
Active Contributor
0 Kudos

Hi Shawn,

Try the following values for the FM 'READ_TEXT':

id = 'BEST'

object = 'MATERIAL'

name = material value

language = sy-langu

Regards,
Ryan Crosby

17 REPLIES 17

Ryan-Crosby
Active Contributor
0 Kudos

Hi Shawn,

Try the following values for the FM 'READ_TEXT':

id = 'BEST'

object = 'MATERIAL'

name = material value

language = sy-langu

Regards,
Ryan Crosby

0 Kudos

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.

0 Kudos

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

0 Kudos

Okay. So there is no other way get the text but only from MM03?

0 Kudos

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

0 Kudos

Thanks. I will tell the user that the only way is to use MM03.

JL23
Active Contributor
0 Kudos

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?

0 Kudos

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

0 Kudos

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

0 Kudos

They just want a simple text report showing all of the data from the Material Number(s). Simple format.

JL23
Active Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

Thank you very much Ryan. That helped me so much. Now I can change the output format

0 Kudos

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.

0 Kudos

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

0 Kudos

Ryan,

I figured it out. Thanks


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

       EXPORTING

         INPUT         = gv_tdname

       IMPORTING

         OUTPUT        = gs_matnr-matnr.

Sandra_Rossi
Active Contributor
0 Kudos

Has someone 5 minutes to write this program and post it here? That would be useful !