Application Development and Automation 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: 
Read only

Get header texts when creating SD invoice

marcelogb
Participant
0 Likes
585

Hi gurus,

I'd like to know if is it possible to get the header text when creating an invoice to do some validations and checks.

What I want is a structure or some way to get them on a requirement routine for message determination or from the invoice user exit.

[http://img40.imageshack.us/img40/615/dibujoaiw.png]

I already know you can get those texts from function READ_TEXT or from table STXH once the document is created, but i want to get them when creating and I don't have the document number yet.

Thanks in advance

2 REPLIES 2
Read only

Former Member
0 Likes
491

Hi

READ_TEXT should work fine, but try to transfer XXXXXXXXXX as name

Max

Read only

0 Likes
491

Hi Max,

Thanks for answering.

I have been making some tests and it works if using the temporal ID in the field

NAME

. For example: '&000000001'. (this is just needed when creating, if not you can get the NAME from

komkbv3-vbeln

Seems like the text values are selected from the buffer on creating.

As this ID is asigned depending on the number of documents you are processing at once, you gotta know it for each document. To do this, you can use the global variable

MSG_OBJKY

which has the temp ID for each document.

So as a resume you will have something like this:


   IF sy-tcode = 'VF03' OR sy-tcode = 'VF02'.
      va_tdname = komkbv3-vbeln.
   ELSE.
     va_tdname = MSG_OBJKY'.
   ENDIF.

  CALL FUNCTION 'READ_TEXT'
  EXPORTING
    ID                            = ID
    LANGUAGE                      = LANGUAGE
    name                          = va_tdname
    object                        = 'VBBK'
  TABLES
    LINES                         = it_tdline
  EXCEPTIONS
    ID                            = 1
    LANGUAGE                      = 2
    name                          = 3
    not_found                     = 4
    object                        = 5
    reference_check               = 6
    wrong_access_to_archive       = 7
    OTHERS                        = 8. 

Regards