Vous êtes sur la page 1sur 2

**************

changes for Z8FIRP39


**************
declaration
**********
types : begin of ty_vbap,
VBELN VBELN_VA,
POSNR POSNR_VA,
end of ty_vbap,
begin of ty_vbrp,
VBELN VBELN_VA,
POSNR POSNR_VA,
VGBEL VGBEL
VGPOS VGPOS,
end of ty_vbrp,
begin of ty_lips,
VGBEL VGBEL
VGPOS VGPOS,
ZCINVNO ZH_ICINVNO
end of ty_lips.
data : it_vbap type table of ty_vbap,
it_vbrp type table of ty_vbrp,
it_lips type table of ty_lips.
wa_vbap type ty_vbap,
wa_vbrp type ty_vbrp,
wa_lips type ty_lips.
**********
tvarvc check
***********
select single * from tvarvc where name eq c_ICInv_on_Itemtxt_billtype and low.
if sy-subrc eq 0.
select single * from tvarvc where name eq c_ICInv_on_Itemtxt_DChnl and low.
if sy-subrc eq 0.
select single * from tvarvc where name eq c_ICInv_on_Itemtxt_Sorg and low.
if sy-subrc eq 0
tvarvc_exist = 'X'.
endif.
endif.
endif.
***********
fetching
**********
if tvarvc_exist eq 'X'.
if t_docs_itm is not initial.
SELECT vbeln posnr from VBAP INTO IT_VBAP
for all entries in t_docs_itm
WHERE vbeln = t_docs_itm-vbel2

AND

posnr = t_docs_itm-posn2.

sort it_vbap by vbeln posnr.


endif.
if it_vbap is not initial
SELECT vbeln posnr vgbel vgpos from VBRK INTO it_VBRP
for all entries in it_vbap
WHERE VBELN = it_vbap-vbeln
AND
POSNR = it_vbap-POSNR.
sort it_vbrk by vgbel vgpos.
endif.
if it_vbrk is not initial.
SELECT vgbel vgpos ZCINVNO FROM LIPS INTO it_LIPS
for all entries in it_lips
WHERE VGBEL = it_vbrp-vgbel
AND VGPOS = it_vbrp-VGPOS.
sort it_lips by vgbel vgpos.
endif.
endif.
*****************************
inside loop
if tvarvc_exist eq 'X'.
read table it_vbap into wa_vbap with key vbeln = t_docs_itm-vbel2
posnr = t_docs_itm-posn2.
if sy-subrc eq 0
read table it_vbrk into wa_vbrk with key vbeln = wa_vbap-vbeln
posnr = wa_vbap-posnr.
if sy-subrc eq 0.
read table it_lips into wa_lips where vgbel = wa_vbrp-vgbel
and vgpos = wa_vbrp-vgpos.
if sy-subrc eq 0.
t_custom_fi-icinvce = WA_LIPS-ZCINVNO.
endif.
endif.
endif.
endif.

Vous aimerez peut-être aussi