Re: [sap-log-sd] Creating an Invoice on a Percentage of Net Value

Reply from jim-wolfe on Jan 25 at 4:41 PM
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.

---------------Original Message---------------
From: Sarat Sathuluri
Sent: Wednesday, January 25, 2012 1:23 PM
Subject: Creating an Invoice on a Percentage of Net Value

Hi Jim,

Thanks for your excellent solution. I already replied to this thread earlier, but it is still awaiting for moderator's approval. Of late it has become a trend to take 4-6 hrs to post the responses.

I will work on your suggestion. It would be of immense help if you could share the code as well, just in case if my technical guy is unable to figure out. In case if I need any further help, I will get back to you. Hope you would not mind.

Thanks again.

Warm regards,
Sarat

P.S.: I marked your answer as the best.

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Toolbox.com and message author.
Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
jim-wolfe  

achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Become a blogger at Toolbox.com and share your expertise with the community. Start today.

_.____.__