on 10-14-2010 11:49 AM
Hello everybody,
is there any chance of collect multiple sold-to parties (AG) on a single invoice ?
a) all sold-to have the same RG & RE
a) sold-to is not included in partner functions of invoice header
b) other conditions such as Zterm or inco1 and so on are empty after copy-control VBRK-VBRP custom routine.
header copy control values are
Copying requirements 003
Determ.export data B
Assignment Number
Reference number E
item copy control values are
Copying requirements 004
Data VBRK/VBRP 912 (my custom routine to set up ZUKRI and put blanks in splitting fields)
Thanks in advance.
Franco
Hi Franco,
what are the partner profiles settings on the invoice header and line item (VOPA)?
Cheers,
Dirk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dirk, here it is the latest version
FUNCTION ZFIFATT912.
*"----------------------------------------------------------------------
*"*"Interfaccia locale:
*" IMPORTING
*" REFERENCE(I_LIPS) TYPE LIPS
*" REFERENCE(I_KURGV) TYPE KURGV
*" REFERENCE(I_VBAK) TYPE VBAK
*" REFERENCE(I_VBRP) TYPE VBRP
*" REFERENCE(I_KUAGV) TYPE KUAGV
*" REFERENCE(I_KUWEV) TYPE KUWEV
*" REFERENCE(I_TCODE) TYPE SY-TCODE OPTIONAL
*" REFERENCE(I_CALLD) TYPE SY-CALLD OPTIONAL
*" REFERENCE(I_BATCH) TYPE SY-BATCH OPTIONAL
*" REFERENCE(I_CPROG) TYPE SY-CPROG OPTIONAL
*" CHANGING
*" REFERENCE(VBRK) TYPE VBRK
*" REFERENCE(VRKPA) TYPE VRKPA OPTIONAL
*"----------------------------------------------------------------------
* ---> VBAK Order header KUAGV View Sold-to *
* VBAP Order item KURGV View Payer *
* KUWEV View Ship-to VBRP Doc Fatt. item *
* LIPS Delivery item *
*---------------------------------------------------------------------*
DATA: l_katr4 LIKE kna1-katr4,
l_kvgr2 LIKE knvv-kvgr2,
l_kvgr3 LIKE knvv-kvgr3,
l_kdkg1 LIKE kna1-kdkg1,
l_mvgr2 LIKE mvke-mvgr2,
zuk LIKE vbrk-zukri.
* A consegna
* B destinatario merce
* C esecutore pagamento
CLEAR:l_katr4,l_kvgr2,l_kvgr3,l_kdkg1,l_mvgr2,zuk.
IF vbrk-vkorg = 'I100'.
zuk = '912'.
SELECT SINGLE katr4
FROM kna1
INTO l_katr4
WHERE kunnr = vbrk-kunrg.
* if ( i_tcode = 'VF01' and i_calld = 'X' ) or
* ( i_tcode = 'VF04') or
* ( i_tcode is initial and i_batch = 'X' and i_cprog = 'SDBILLDL' ).
*
* select single fkdat
* from zdatafattsd
* into vbrk-fkdat
* where fkart = vbrk-fkart.
*
* endif.
*{ DELETE DEVK900827 1
*\ CONCATENATE 'C' i_lips-matnr+11(2) INTO l_mvgr2.
*\
*\ SELECT SINGLE kdkg1
*\ FROM zgruppomatf
*\ INTO l_kdkg1
*\ WHERE kunnr = i_kurgv-kunnr
*\ AND mvgr2 = l_mvgr2.
*} DELETE
*{ REPLACE DEVK900827 3
*\ CASE l_katr4.
*\
*\*consegna
*\ WHEN 'CA'.
*\
*\ CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
*\ i_vbrp-vgbel INTO zuk.
*\
*\*esecutore pagamento
*\ WHEN 'CC'.
*\
*\ vbrk-kunag = i_kurgv-kunnr.
*\
*\ CLEAR:vbrk-pltyp,vbrk-kdgrp,vbrk-konda,vbrk-vsbed,vbrk-regio,
*\ vbrk-xblnr,vbrk-inco1,vbrk-inco2,vbrk-bstnk_vf.
*\
*\ CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
*\ i_kurgv-kunnr INTO zuk.
*\
*\*modifica gruppo fatturazione
*\* CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
*\* l_kdkg1 i_kurgv-kunnr INTO zuk.
*\
*\*destinatario merce
*\ WHEN 'CB'.
*\
*\ CLEAR:vbrk-xblnr,vbrk-bstnk_vf,vbrk-pltyp,vbrk-kdgrp,
*\ vbrk-konda,vbrk-vsbed,vbrk-regio,vbrk-inco1,vbrk-inco2.
*\
*\ CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
*\ i_kuwev-kunnr INTO zuk.
*\
*\*modifica gruppo fatturazione
*\* CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
*\* l_kdkg1 i_kuagv-kunnr INTO zuk.
*\
*\ ENDCASE.
DATA: a3_kunnr LIKE vbpa-kunnr.
CONCATENATE zuk l_katr4 INTO zuk.
CASE l_katr4.
*consegna
WHEN 'BO'.
CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
i_vbrp-vgbel INTO zuk.
* CLEAR vbrk-kunag.
**esecutore pagamento
* WHEN 'EP'.
*
* CLEAR: vbrk-pltyp, "Tipo listino prezzi"
* vbrk-kdgrp, "Gruppo clienti"
* vbrk-konda, "Gruppo prezzi cliente"
* vbrk-vsbed, "Condizione di spedizione"
* vbrk-xblnr, "Numero documento di riferimento"
* vbrk-inco1. "Incoterms parte 1"
*
* CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
* i_kurgv-kunnr INTO zuk.
*destinatario merce
WHEN 'DM'.
CLEAR: vbrk-bstnk_vf, "Numero d'ordine del cliente"
vbrk-pltyp, "Tipo listino prezzi"
vbrk-kdgrp, "Gruppo clienti"
vbrk-konda, "Gruppo prezzi cliente"
vbrk-vsbed, "Condizione di spedizione"
* vbrk-xblnr, "Numero documento di riferimento"
* vbrk-zuonr, "Numero di attribuzione"
* vbrk-kidno, "Riferimento pagamento"
vbrk-inco1. "Incoterms parte 1"
CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
i_kuwev-kunnr INTO zuk.
*modifica gruppo fatturazione
* CLEAR vbrk-kunag.
*committente
WHEN 'CO'.
CLEAR: vbrk-pltyp, "Tipo listino prezzi"
vbrk-kdgrp, "Gruppo clienti"
vbrk-konda, "Gruppo prezzi cliente"
vbrk-vsbed, "Condizione di spedizione"
* vbrk-xblnr, "Numero documento di riferimento"
* vbrk-zuonr, "Numero di attribuzione"
* vbrk-kidno, "Riferimento pagamento"
vbrk-inco1. "Incoterms parte 1"
CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
i_kuagv-kunnr INTO zuk.
*Gruppo fatturazione **** Nodo A3 della gerarchia ****
WHEN 'PF'.
select single kunnr
from vbpa
into a3_kunnr
where vbeln = i_vbrp-vbeln
and parvw = 'A3'
and posnr = ''.
CLEAR: vbrk-pltyp, "Tipo listino prezzi"
vbrk-kdgrp, "Gruppo clienti"
vbrk-konda, "Gruppo prezzi cliente"
vbrk-vsbed, "Condizione di spedizione"
* vbrk-xblnr, "Numero documento di riferimento"
* vbrk-zuonr, "Numero di attribuzione"
* vbrk-kidno, "Riferimento pagamento"
vbrk-inco1. "Incoterms parte 1"
* vbrk-xblnr = a3_kunnr.
* vbrk-kidno = a3_kunnr.
CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
A3_KUNNR INTO zuk.
WHEN ''.
select single kunnr
from vbpa
into a3_kunnr
where vbeln = i_vbrp-vbeln
and parvw = 'A3'
and posnr = ''.
CLEAR: vbrk-pltyp, "Tipo listino prezzi"
vbrk-kdgrp, "Gruppo clienti"
vbrk-konda, "Gruppo prezzi cliente"
vbrk-vsbed, "Condizione di spedizione"
* vbrk-xblnr, "Numero documento di riferimento"
* vbrk-zuonr, "Numero di attribuzione"
* vbrk-kidno, "Riferimento pagamento"
vbrk-inco1. "Incoterms parte 1"
* vbrk-xblnr = a3_kunnr.
* vbrk-kidno = a3_kunnr.
CONCATENATE zuk i_vbak-vkorg i_vbak-vtweg i_vbak-spart
A3_KUNNR INTO zuk.
ENDCASE.
*} REPLACE
MOVE zuk TO vbrk-zukri.
*{ REPLACE DEVK900827 4
*\ CLEAR vbrk-kunag.
*} REPLACE
*{ INSERT DEVK900827 2
** Aggiunte FDI
** VBRK Testata Fattura
CLEAR: VBRK-BSTNK_VF, "Numero d'ordine del cliente
VBRK-REGIO, "Regione (provincia)
VBRK-INCO2, "Incoterms parte2
VBRK-KDGRP. "Gruppo Clienti
** VRKPA Funzioni partner Fattura
* CLEAR vrkpa-kunag.
* CLEAR vrkpa-adrnr.
*} INSERT
ENDIF.
ENDFUNCTION.
____________________
- The two parts not working are those within
WHEN 'PF' and WHEN ''
At this stage the splitting criteria shown by the system is "different sold-to-party"
but in prevoious versions I tried first to put blank in vbrk-kunag and then the message was "Payment Reference" & "Assignment number" also put in blank but default-evaluated with invoice number.
I also tried to set up xblnr and kidno with a dummy number but the result was -no splitting criteria shown but invoices splitted.
I hope I've been clear, in case not please advise.
Many thanks for your help.
Cheers.
Franco
Edited by: Franco Diena on Oct 15, 2010 9:29 AM
Hmmm...
Ok, so under 'PF' and ' ' you are doing the following:
Select the VBPA-KUNNR for partner type 'A3' (should this be AG?) and then you make this AG (which is different on each document that you try to merge) into a split criteria.
Try and leave out the a3_kunnr when concatenating the fields, so that the differing AGs do not become a split criteria.
Did that help?
Hi Dirk,
no A3 is a hierarchic node.
different AGs can be linked to A3 partner and in this case should be splitted in one single invoice.
The point is that invoices are splitted by payer & sold-to party even if sold to party (KUNAG) is set to blank (even if this code version is different).
It seems to me that are there other hidden split criteria and one of these is i.e. KIDNO.
thanks.
Cheers
Franco
Hi Franco,
Ok that code is ok then.
Do you have the code of the function that actually calls this function? (as the data transfer routine is typically called FRV60C912)
Did you check if AG is mandatory in the partner profile for the billing line item (VOPA)?
What if you take out AG on item level altogether, so that the system doesn't even attempt to copy it?
Could you check?
You probably know already, but basically whatever goes into VBRK-ZUKRI (long text key) drives the split. So maybe rather than 'putting blanks' you should completely ignore those fields.
You could switch on debugging and watch VBRK-ZUKRI to check when it is changed...
Cheers,
Dirk
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.