Reply from sarat on Jan 25 at 4:47 PM Hi Jim, Thank you very much your help. I will give it a try. Warm regards, Saratvamsi
| | | ---------------Original Message--------------- From: Jim Wolfe Sent: Wednesday, January 25, 2012 4:41 PM Subject: Creating an Invoice on a Percentage of Net Value Sarat - When I looked at my code a little closer, I remembered that I implemented it slightly different than I described. The code was actually put into one of the accounting userexits so that it would be able to send the user a popup message to confirm that the 2nd invoice was needed, if for example, you cancelled the 1st invoice to the 1st payer but didn't cancel the other, and were re-billing the wrong one. That program is ZXVVFU01. The process actually creates a debit memo request, then follows that up with a debit memo billing document to bill the 2nd payer. Good luck and use at your own risk. *&---* *& Include ZXVVFU01 *& Present the user with the option to create the Debit Memo Request *& and billing doc *&---* TABLES: konv, vbpa. DATA: ans(1), zvbeln LIKE bapivbeln-vbeln. DATA: BEGIN OF zret OCCURS 0. INCLUDE STRUCTURE bapireturn1. DATA: END OF zret. IF vbrk-vkorg = '1234' AND vbrk-vbtyp = 'M'. *look for the alternate payer partner and the pricing condition SELECT SINGLE * FROM vbpa WHERE vbeln = vbrk-vbeln AND posnr = '000000' AND parvw = 'Y6'. IF sy-subrc = 0. SELECT SINGLE * FROM konv WHERE knumv = vbrk-knumv AND kschl = 'xxxx' AND kwert NE 0. IF sy-subrc = 0. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING titlebar = 'Create 2nd Invoice' * DIAGNOSE_OBJECT = ' ' text_question = 'Do you want to create the 2nd Invoice?' text_button_1 = 'Yes'(001) * ICON_BUTTON_1 = ' ' text_button_2 = 'No'(002) IMPORTING answer = ans . IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSEIF ans = '1'. CALL FUNCTION 'BAPI_SALESDOCUMENT_COPY' EXPORTING salesdocument = vbrk-vbeln documenttype = 'Y2ND' * TESTRUN = ' ' IMPORTING salesdocument_ex = zvbeln. * TABLES * RETURN = . IF sy-subrc = 0. COMMIT WORK. CALL FUNCTION 'BAPI_BILLINGDOC_CREATE' TABLES return = zret. ENDIF. ENDIF. ENDIF. ENDIF. ENDIF. | | Reply to this email to post your response. __.____._ | _.____.__ |