Skip to Content

Reading Header Text before PO Saving

Dec 28, 2016 at 06:12 AM


avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member 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.

          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.
Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Chris Bosler,

Thank you very much.

I was trying many ways to implement but none of them worked.

The logic given by you is working perfectly.

Thank you. :)


GET_TEXT_MEMORY reads the text from memory as does READ_TEXT, at least both do it when the save mode of the text object is "in update task" (which is the case of EKKO I think). The OP says that READ_TEXT does not work since the PO is not saved yet, but it should work as READ_TEXT gets the text from the memory. If GET_TEXT_MEMORY works, then READ_TEXT should work too. I'm curious to know the reason why there is an issue.

Former Member
Sandra Rossi

In my situation I was using it in the SAVE_PREPARE user exit of the sales order. I can't say much as to why, but when calling READ_TEXT for the Z010, VBBK header text it was not pulling back text (I assumed it was due to the fact the text was not yet saved and was only in memory.


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.


10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 29, 2016 at 12:37 PM

Thanks Bruce.

I will check and get back.

10 |10000 characters needed characters left characters exceeded