cancel
Showing results for 
Search instead for 
Did you mean: 

Issue on VF04/VF06 Invoice Creation with Multiple Documents.

former_member199670
Participant
0 Kudos

Hi Experts,

While creating an invoice through VF04/VF06 - we are doing the following checks in the user exit USEREXIT_NUMBER_RANGE.

(VBRK-VKORG)sale org = IT01, billing type(VBRK-FKART) <> YFC and ZFC , Net Value in Document Currency  = 0 (VBRk-NETWR) and at least one line item category(VBRP-PSTYV) <> ZANN item category.

If the above conditions are satisfied we should restrict the system not to create an invoice for a particular document and should continue for the rest of the documents.

When executing the t-code VF04/VF06 with multiple billing documents the above exit is stopping our invoice creation process if any one of the billing document satisfied our condition.

Here is an example:

Delivery documents :say 1,2,3

1-Invoice should generate

2-Invoice should not get generate bcoz the above validation is satisfying(Issuing an error message)

3-Invoice should generate

When we are running as a bulk either in foreground or background,the invoice generation is getting terminated bcoz of delivery document 2.

Kindly provide your suggestions.

Regards,

Manimaran.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member199670
Participant
0 Kudos

Hi All,

Can anyone please provide the correct user exit, BADI or Enhancement implementation where I can overcome this issue.

I just want to validate the each delivery document, if any wrong document found I need to raise error for that and process should continue for all other correct documents in background as well as foreground with multiple documents.

Thanks

Manimaran K.

Former Member
0 Kudos

Hi,

Not sure if you find the solution already.

You can try Enhancement spot ES_SAPLV60A Point  fakturaposi_auftragspositio_02  and set us_rc = 4  and RETURN statement if you don't want to process further.

Check include LV60AA29.

This spot is just after the subroutine  vbrk_vbrp_fuellen which fill the VBRK and VBRP data in XVBRK and XVBRP respectively. So you should get all the data there including NETWR available.

Do not forget to copy any standard code already there in any existing Enhancement under the same spot.

Also populate the XVBFS table with error message by using the standard subroutine before the RETURN statement so that it displays in the log.

Example :

PERFORM VBFS_HINZUFUEGEN_ALLG USING AVBAP-VBELN

                                               AVBAP-POSNR

                                               <Messge Class>

                                               'E'

                                               <Message No>

                                               SPACE

                                               SPACE

                                               SPACE

                                               SPACE.


You can check in debug mode also by simulating the above scenario by setting us_rc = 4 and populate XVBFS internal table.


You can set rc in statement CHECK: rc = 0. to rc = 4 or no zero to bypass the rest of the coding in debug mode. This statement is just after couple of lines after the spot.


R

former_member199670
Participant
0 Kudos

PFB details

Program : SAPLV60A

user exit : RV60AFZZ

subroutine : USEREXIT_NUMBER_RANGE and logic as follow

IF lt_ysta_param IS NOT INITIAL.

*This user-exit functionality should only work if sales Organization is 'IT01'

    CLEAR : wa_ysta_param.

    SORT lt_ysta_param BY pname pvalue.

    READ TABLE lt_ysta_param INTO wa_ysta_param WITH KEY pname  = con_vkorg

                                                         pvalue = p_pu_vbrk-vkorg

                                                        BINARY SEARCH.

    IF sy-subrc EQ 0.

      READ TABLE lt_ysta_param INTO wa_ysta_param WITH KEY pname  = con_fkart

                                                         pvalue = p_pu_vbrk-fkart

                                                         BINARY SEARCH.

      IF sy-subrc NE 0.

        IF p_pu_vbrk-netwr EQ 0 .

          lt_xvbrp_temp[]  =  p_c_it_xvbrp[].

* looping the billing document item table and read the param table for item catagory.

          LOOP AT lt_xvbrp_temp INTO wa_xvbrp WHERE updkz NE con_d1.

            READ TABLE lt_ysta_param INTO wa_ysta_param WITH KEY  pname  = con_pstyv

                                                                  pvalue = wa_xvbrp-pstyv

                                                                  BINARY SEARCH.

            IF sy-subrc NE 0.

* If the item catagory is not ZANN then set the flag

              lv_foc  = con_val.

            ENDIF.

            CLEAR : wa_ysta_param,wa_xvbrp.

          ENDLOOP.

          REFRESH lt_xvbrp_temp[].

* If the foc flag is set then specified error message will get populated.

          IF lv_foc = con_val.

            MESSAGE s054(zsls) DISPLAY LIKE 'E' .    "to tell the user what's the problem

          ENDIF.

          CLEAR : lv_foc.

        ENDIF.

      ENDIF.

    ENDIF.

  ENDIF.

Thanks.

Former Member
0 Kudos

Since you are issuing a success message it should not stop further processing even though its displayed like error.

did you check what happens after the message is issued?

V.

former_member199670
Participant
0 Kudos

Hi Vikram,

Thanks for your reply.

Originally we have given the message like "MESSAGE E054 (ZSLS) DISPLAY LIKE 'S'.

Since it is stopping our process completely, we have tried with success message.

As you said, yes now it is not terminating our process (since message S display like E) instead it is creating invoice for wrong document also.

Anyway after a lot of analysis we have concluded that, this is not a right user exit to handle this issue.

Hence we will be looking for a right place to implement our validations.

Could you please suggest any user exit, BADI or enhancement to implement the same validations? (We need to issue an error message for wrong documents and also the process should continue for correct documents).

Thanks

Manimaran K

JL23
Active Contributor
0 Kudos

Go into the IMG > SD > System Modifications > User Exits

there you find the list of activities, among them for example User Exits For Billing

In front of these activities is a docu icon which may help you further.

I personally think it is not the right approach at all.

Why is something in a billing due list if it shall not be billed? And how does it ever go away from the index?

If you just ignore it when running the batch billing process then you get more and more items into this index which will never be billed due to your logic, which also means that they are never considered as complete business cases and hence cannot be archived in a couple years, beside of the effect that the performance of billing will slow down over the years.

Former Member
0 Kudos

Can you provide the user exit and your logic to restrict invoice creation?

V.

former_member199670
Participant
0 Kudos

Hi Vikram,

FYI the details has been provided in the original post itself,please let me know if you want to see the actual coding.

Thanks

Manimaran K

JL23
Active Contributor
0 Kudos

this is a kind of logic but not ABAP code.

As you are posting in the ABAP space and reporting an error then you should be able to post your code too