cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if a user fills a header text in billing invoice

Former Member
0 Kudos

Hi everybody and thanks in advance.

My consultant wants to oblige all users to fill a header text when they create the billing invoice (vf01).

I was looking for several user exits when I can manage this requisite.

My problem is that when the user creates the invoice and push save button, I try to look for in the table STXH if the user created the header text. But I have not found anything, because the invoice has not created yet.

Only when the billing invoice has saved, the header text is stored in the table STXH.

I has been trying to find a structure wich contains the header data like xvbrk contains the data about type of invoice, etc.

I have studied this user exits:

userexit_number_range (module pool saplv60A, program rv60afzz)

userexit_account_prep_komkcv (same module)

userexit_account_prep_kompcv (same module)

userexit_fill_vbrk_vbrp (same module)

v60A0001 (Customer functions in the billing document).

My question is: In which structure is the header text of billing invoice manage before push the save button?

If I knew where it is, I could manage the data and check if the user filled the header text.

Thank you very much, and sorry for my pour English.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

David,

Look into internal table XTHEAD during your userexits.

XTHEAD will always have the available text IDs.

However,

If text has been entered, you will see additional values in this internal table for this texts IDs that the user has entered.

If no text has been entered, the other fields in the internal will be initial.

Please reward points for helpful answers.

Former Member
0 Kudos

I have a problem, because this structure shows me the available textid, but do not show me if the user has filled them. So I can not solve my problem. I need to know if a textId, for instance ZC09, exists and the user has filled it.

I need to find the text that the user has wrotten inside textId.

Example: TextId: ZC09 . The user wrote: 'This is a text'.

In USEREXIT_NUMBER_RANGE with XTHEAD I find that ZC09 exits. Now I need to find the text: 'This is a text'.

Thank you in advance, and sorry the delay.

Former Member

David,

Place this code into USEREXIT_NUMBER_RANGE:

DATA: CATALOG LIKE TCATALOG OCCURS 0 WITH HEADER LINE,

MEMORY_ID(30).

data: c_MEMORY_ID(30) VALUE 'SAPLSTXD'.

DATA l_head type THEAD.

DATA wa_head type THEAD.

data: l_lines type table of TLine.

data: l_line type TLine.

DATA l_CATALOG type TCATALOG.

IMPORT CATALOG FROM MEMORY ID 'SAPLSTXD'.

loop at catalog into l_catalog.

if l_catalog-IS_REFTEXT is initial

and l_catalog-keep is initial.

concatenate c_memory_id l_catalog-id into memory_id.

import thead to l_head

tline to l_lines

from memory id memory_id.

loop at l_lines into l_line.

message i000(zz) with l_line-TDLINE.

endloop.

endif.

endloop.

It will expose the text entered into the text ids in a message box (for now). You will want to replace the MESSAGE statement with your own logic.

You may also need to change the message numver/class from ZZ - as seen here "message i000(zz) with l_line-TDLINE." with an appropriate message on your system.

DON'T forget those points.

Former Member
0 Kudos

Hello John,

Thanks a lot for your code and detailed explanation, it's useful for my requirement.

Regards,

Munvar Basha.

Answers (6)

Answers (6)

Former Member
0 Kudos

David,

How did this work out for you?

If it has resolved your needs, please reward points and close the thread.

If not, plz provide more details.

Thanks in advance.

Former Member
0 Kudos

David,

And I should be more clear... add the code above to the UserExit and compile.

Then create an invoice using VF01. During the invoice creation, add some text in some of the text ids.

Now save the invoice. The message box should appear for each line of text that you entered into each text id.

Former Member
0 Kudos

David,

Has your issue been resolved?

If so, please reward points and close the thread.

If not, plz provide more details.

Former Member
0 Kudos

Give me time. I just work 8 hours per day.

I have just given you 10 points. Thank you very much for the answer.

Former Member
0 Kudos

Hello David,

think it's more a matter of customizing than of development. If you refer to the header note of billing document, it gets normally copied from the header note of the sales document (Text procedure '03' in standard - transaction VOTX). The pity is, that you can't declare texts in billing document as 'obligatory' - you can only do this in the sales document. So, if you would set the header note in sales document to 'obligatory', that would be enough.

Regards Wolfgang

Former Member
0 Kudos

Hi David,

I assume that you are creating invoices with reference to Sales Orders. If so, the header text might be on the sales order (dependant upon your procedures), in which case you can look on table STXH for the text relating to the sales order. You should be able to do this from any user exit in the invoice that provides you with the reference document number

Colin

Former Member
0 Kudos

this is a bit difficult as it is not a normal field.. wat i can think of is while saving, a pop up can be thrown asking the user if he has maintained the text..if he says yes, then it continues the save process, else it terminates...

u can use FM 'popup_to_confirm' within the userexit FORM USEREXIT_SAVE_DOCUMENT_PREPARE in the include MV45AFZZ.

just a try...pl let us know if it works

Regards,

Bikash..