09-05-2008 8:40 PM
I need a way to fill an included field (on VBRK) at the save of an invoice. The catch is that this value needs to be provided by the use; it can't be calculated. What is the easiest way to do this? If need be I can do it on the save of the sales order and I will transport it (to the invoice) at the save of the invoice.
Regards,
Davis
09-05-2008 11:14 PM
Hi,
please check this sample code for popup..
DATA: s_sval TYPE sval,
t_sval TYPE TABLE OF sval.
* Prepare the input.
s_sval-fieldname = 'MATNR'.
s_sval-tabname = 'MARA'.
APPEND s_sval TO t_sval.
* Show the popup.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
no_value_check = 'X'
popup_title = 'Enter commission'
TABLES
fields = t_sval
EXCEPTIONS
error_in_fields = 1
OTHERS = 2.
IF sy-subrc = 0.
* Get the value entered.
READ TABLE t_sval INTO s_sval INDEX 1.
WRITE: / s_sval-value.
ENDIF.
Thanks
Naren
09-05-2008 9:34 PM
Hi,
You can use "billing document data transfer routine" (VOFM) to move the values from the sales order to the billing document.
OR
You can use the userexit..USEREXIT_FILL_VBRK_VBRP..which is there in the include RV60AFZC...
Is this what you want..? otherwise please let me know the details..
Thanks
Naren
09-05-2008 9:36 PM
My issue isn't filling the field so much as prompting the user to enter a value. I need a way to get this information from the user via a user/screen exit.
Regards,
Davis
09-05-2008 9:43 PM
Hi,
ok..got it...Which version of sap are you working on?
Thanks
Naren
09-05-2008 9:54 PM
Also,
Does it have to be a z field?
Please check if we can use an existing field which is not used at the header or item level..
Also check if the header texts / ITem texts can be used in this scenario..
Thanks
Naren
09-05-2008 10:06 PM
I'm sorry to say but it is 4.6c. I can't use a text because I need it to come through with a select of VBRK or VBRP because the report runs so slow that another FM call would kill it. I was thinking of looking for an unused field but I have a feeling that they will do an upgrade soon so that concerns me. The last thing I want is for them to start using this field and then the report won't work.
Davis
09-05-2008 10:25 PM
Hi,
I believe if there is no screen exit available in the billing document..
Try using the userexit USEREXIT_FILL_VBRK_VBRP...to call a popup to get the value when saving the invoice..
But I have the following concerns..
incase if you want to change the z field value ...how would you trigger the save again in VF02 without changing any of the standard field...
I think the best way is as you said...change the sales order screen additional data B screen (SAPMV45A) to add a new field...and then move the value from the sales order to the invoice..
anyways I will check if there is any way in invoice itself..
Thanks
Naren
09-05-2008 10:47 PM
The amount will never change. It is going to be used to determine the commission, of a sale, so once it is set it will stay set (per order). Do you happen to have sample code (or know where to point me) that would pop a box up to the user for entry?
Regards,
Davis
09-05-2008 11:14 PM
Hi,
please check this sample code for popup..
DATA: s_sval TYPE sval,
t_sval TYPE TABLE OF sval.
* Prepare the input.
s_sval-fieldname = 'MATNR'.
s_sval-tabname = 'MARA'.
APPEND s_sval TO t_sval.
* Show the popup.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
no_value_check = 'X'
popup_title = 'Enter commission'
TABLES
fields = t_sval
EXCEPTIONS
error_in_fields = 1
OTHERS = 2.
IF sy-subrc = 0.
* Get the value entered.
READ TABLE t_sval INTO s_sval INDEX 1.
WRITE: / s_sval-value.
ENDIF.
Thanks
Naren
09-05-2008 11:51 PM
Thank you very much for this help. In my opinion, you did more than most as you kept up the conversation and helped figure out the best way to go about this.
Thanks again!
Davis