Skip to Content
avatar image
Former Member

Reading Header Text before PO Saving

I have to read the header text during the creation of PO for checking whether it is filled with some value or not..

I cannot use READ_TEXT FM since the PO is not yet saved..

Please help me in this...

Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 29, 2016 at 03:22 PM

    I had to do similar for the sales order header, ended up using function 'GET_TEXT_MEMORY'. I imagine it would work for the production order as well so long as you use the correct text identifiers. Here's an short example

        DATA: lt_lines type TABLE OF tline.
        DATA: l_tdid type tdid value 'Z010'. "Use your desired text
        DATA: l_tdobject type TDOBJECT value 'VBBK'. "Use your desired object
        DATA: l_tdname type tdobname.
        l_tdname = vbak-vbeln.
        DATA: catalog TYPE STANDARD TABLE OF tcatalog INITIAL SIZE 0,
              w_cat TYPE tcatalog.
        DATA BEGIN OF theader.
                INCLUDE STRUCTURE thead.
        DATA END OF theader.
        DATA: memory_id(30) VALUE 'SAPLSTXD'.
        "first attempt to get the text from memory if it has never been saved
            text_memory = catalog.
        READ TABLE catalog INTO w_cat WITH KEY tdobject = 'VBBK' "Header text
                                                 tdid = 'Z010' "Use your Text type
                                                 tdspras = 'E'. "Search Type
        IF sy-subrc EQ 0.
          memory_id+8(6) = w_cat-id.
        IMPORT thead TO theader
               tline TO lt_lines
            FROM MEMORY ID memory_id.
    Add comment
    10|10000 characters needed characters exceeded

    • Thank you for these precisions. I'll try to have a look quickly at it tomorrow, and revert back.

      Update: I did a test this morning, by implementing READ_TEXT in subroutine USEREXIT_SAVE_DOCUMENT_PREPARE, and could retrieve the text succesfully for VA02 (using name=VBAK-VBELN if T180-AKTYP='V') and VA01 (using name='XXXXXXXXXX' if T180-AKTYP='H').

  • avatar image
    Former Member
    Dec 28, 2016 at 11:48 PM

    You could create a project in transaction CMOD that calls SAP enhancement MM06E005. You have access to all header and line item data, at the time a PO is checked or saved, from function EXIT_SAPMM06E_012. You would add you code to include ZXM06U43, capturing whatever data you want. look at FM EXIT_SAPMM06E_012 to see what is available.

    *& Include ZXM06U43 *

    * This include is in function module EXIT_SAPMM06E_012,
    * the function module is part of SAP enhancement MM06E005,
    * the SAP enhancement has been up associated with project Z_PO_VAL.
    * The source code in this include is executed every time a PO is
    * checked or saved.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 29, 2016 at 12:37 PM

    Thanks Bruce.

    I will check and get back.

    Add comment
    10|10000 characters needed characters exceeded