2010 Jun 30 8:32 AM
Hi All,
I have a output control routine for Billing. This routine is assigned to Z output type.
Business scenario:
1) Allow output for billing docs when the preceding doc sales order reason is "118:New Contract" .
The routine works fine for VF01 & VF02.
The same routine does not work for VF04. I checked from debug and the validation is working fine.
*Based on the validation i have SY-SUBRC = 0 (success) or SY-SUBRC = 4(failure).
Still the output is not being triggered.*
Appreciate if anyone has come up with this scenario and how it was handled.
Hi All,
I have a output control routine for Billing. This routine is assigned to Z output type.
Business scenario:
1) Allow output for billing docs when the preceding doc sales order reason is "118:New Contract" .
The routine works fine for VF01 & VF02.
The same routine does not work for VF04. I checked from debug and the validation is working fine.
*Based on the validation i have SY-SUBRC = 0 (success) or SY-SUBRC = 4(failure).
Still the output is not being triggered.*
Appreciate if anyone has come up with this scenario and how it was handled.
2010 Jun 30 7:16 PM
Check the output determination log (available in VF03) for the documents in question.
Also post the code that you have in the output requirement routine. Once I saw someone using STATIC variables and memory, which was not cleaned up in the batch run (such as VF04), so it caused unexpected results.
2010 Jun 30 7:34 PM
Here is the code. Will check the points you mentioned.
The output type attached to this routine triggers only for transmission medium '5'.
The print program attached to this output uses the spool id and send email....
TYPES : type_komfk TYPE STANDARD TABLE OF komfk.
FIELD-SYMBOLS : <fs_komfk> TYPE type_komfk.
DATA : lv_table(30) TYPE c VALUE '(SAPLV60A)XKOMFK[]',
lx_komfk TYPE komfk,
lx_vbfa TYPE vbfa,
lx_vbak TYPE vbak.
sy-subrc = 4.
Get the invoice document items
ASSIGN (lv_table) TO <fs_komfk>.
IF sy-subrc = 0.
READ TABLE <fs_komfk> INTO lx_komfk INDEX 1.
lx_vbfa-vbelv = lx_komfk-vbeln.
lx_vbak-vbeln = lx_komfk-vbeln.
Ouput only if output is the order is 'New Contract'
No output, if the order is not 'System order'
SELECT SINGLE augru
INTO lx_vbak-augru
FROM vbak
WHERE vbeln = lx_vbak-vbeln.
IF sy-subrc EQ 0.
IF lx_vbak-augru = '118'.
*--Check if no invoice is generated for the Contract
SELECT SINGLE vbeln
INTO lx_vbfa-vbeln
FROM vbfa
WHERE vbelv = lx_vbfa-vbelv.
IF sy-subrc EQ 0.
sy-subrc = 4.
exit.
ELSE.
sy-subrc = 0.
EXIT.
ENDIF.
ELSE.
sy-subrc = 4.
exit.
ENDIF.
ENDIF.
ENDIF.
2010 Jun 30 8:10 PM
Please next time use the code tags for formatting.
I see at least two potential problems here. First one:
READ TABLE <fs_komfk> INTO lx_komfk INDEX 1.You don't know what is in the table and it is not checked if the entries #1 is actually the one that you need. When the program runs for a bunch of documents, there could be anything in the table (especially since you have to get it with ASSIGN, which means it was not really supposed to be used at this point).
Also what is the table's structure? If it's the same as KOMFK then certainly you need to do more checking. Or, better yet, find some other way to get the contract #. Do you invoice the contracts directly? Then the number will be in VBRP-VGBEL (which brings another question - the relationship between the documents is really on the line item level; is there a guarantee that contract to invoice will always be 1:1?).
Second one (unrelated):
*--Check if no invoice is generated for the Contract
SELECT SINGLE vbeln
INTO lx_vbfa-vbeln
FROM vbfa
WHERE vbelv = lx_vbfa-vbelv.This code is not checking if there is no invoice. It's checking if there is any entry in the document flow. This entry may or may not be invoice related. You should at least add VBTYP_N condition to really check for an invoice. Or, better yet, just check the billing status (in VBUK), it would be more accurate (what if there was an invoice but it was cancelled?).
2010 Jul 02 7:20 AM
Hi Jelena,
Thanks for your feedback. The issue is resolved.
VF04 Calls alll the Output types assigned to the billing document type. I do not need to check VBFA , instead sort
the Contracts by ascending order and issue output only for the first invoice.
When posting through VF04 all the invoices for the contracts are processed together , since i am using the collective processing option from VF04.
2016 Apr 21 8:34 AM
Hi,
how you debug the output program that link to VF04, I try to put breakpoints in the output program, while running, i does not stop at the breakpoit,
please help,
Thanks and Regards.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |