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: 

Get Header Texts from a Sales Order when you push 'Save Button'

Former Member
0 Kudos

Hello,

I am developing a user exit run when you push 'Save' Button in Sales Document and I do not know how to retrieve current header texts.

I cannot access to database tables because they haven't been saved yet and I cannot the sales document number.

Does anyone have any ideas?

Many thanks!!

6 REPLIES 6

former_member191735
Active Contributor
0 Kudos

Not quite sure about possibility but it is worth trying other function modules in the function group STXD.

there are quite a few. Try them by coding within the user exit by passing everything but the name (order number)

Edited by: Sampath Kumar on May 13, 2011 8:35 AM

brad_bohn
Active Contributor
0 Kudos

Use READ_TEXT as usual in the save exit...it does not matter that the texts have not been saved. If you check the code, you'll see that 'XXXXXXXXXX' is the proper value for the text name for a read from memory. You CAN"T leave the name blank...

0 Kudos

I guess if you read from save exit, you don't have to use 'XXXXXXXX' but you can use actual sales order number.

READ_TEXT FM works in Save user exit but you have to use Sales order number.

Edited by: Sampath Kumar on May 13, 2011 9:43 AM

brad_bohn
Active Contributor
0 Kudos

I meant the prepare exit though - sorry for the confusion. I get sick of typing the name each time. To me it's obvious that you shouldn't do text reads/validations or any other complicated logic in the save exit other than Z-table updates. To others, I guess it's not as obvious...

0 Kudos

Make sense. I dont think text read is a complex logic. However, you are right XXXXXXXX should work and validations are not a great idea in save document (off subject though)

Former Member
0 Kudos

Hi Fernando,

use the below sample code to get the run time header text.

write the below code in USEREXIT_SAVE_DOCUMENT_PREPARE.

DATA : begin of wa_tline,

        tdformat like tline-tdformat,

        tdline like tline-tdline,

   end of wa_tline.

   data it_tline like table of wa_tline.

data temp_vbeln(70) type c.

       temp_vbeln = xvbak-vbeln.

       CALL FUNCTION 'READ_TEXT'

         EXPORTING

*         CLIENT                        = SY-MANDT

           id                            = 'Z053'

           language                      = 'E'

           name                          = temp_vbeln

           object                        = 'VBBK'

*         ARCHIVE_HANDLE                = 0

*         LOCAL_CAT                     = ' '

*       IMPORTING

*         HEADER                        =

         tables

           lines                         = IT_TLINE

*       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.


Thanks,

Sumanth P