‎2006 Sep 11 4:21 AM
Hi guys,
can any one check the following logic. under <b>'if it is vendor</b>' first it should take credit note if not and if gst-no is available header should print as 'tax invoice' and if gst-no not available it should print as 'invoice'.
i wrote the code but it is not working properly. can you sugest me some thig.
loop at t_inv_hdr.
if it is cusomer
if p_inter eq ''.
if t_inv_hdr-bschl = '11'. "Credit note
t_inv_hdr-inv_type = 'CREDIT NOTE'.
else.
t_inv_hdr-inv_type = 'TAX INVOICE'.
endif.
select * into corresponding fields of t_inv_item
from bseg
where bukrs = t_inv_hdr-bukrs
and belnr = t_inv_hdr-belnr
and gjahr = t_inv_hdr-gjahr
and buzid eq '' .
if t_inv_hdr-inv_type = 'TAX INVOICE'.
if t_inv_item-shkzg = 'S'.
t_inv_item-wrbtr = 0 - t_inv_item-wrbtr.
t_inv_item-dmbtr = 0 - t_inv_item-dmbtr.
endif.
else.
if t_inv_item-shkzg = 'H'.
t_inv_item-wrbtr = 0 - t_inv_item-wrbtr.
t_inv_item-dmbtr = 0 - t_inv_item-dmbtr.
endif.
endif.
append t_inv_item.
endselect.
if it is vendor
else.
if t_inv_hdr-bschl = '31'. "Credit note
t_inv_hdr-inv_type = 'CREDIT NOTE'.
else.
if t_inv_hdr-gst_no is not initial. "ne space.
t_inv_hdr-inv_type = 'Invoice'.
else.
t_inv_hdr-inv_type = 'Tax Invoice'.
endif.
endif.
select * into corresponding fields of t_inv_item
from bseg
where bukrs = t_inv_hdr-bukrs
and belnr = t_inv_hdr-belnr
and gjahr = t_inv_hdr-gjahr
and buzid eq '' .
if t_inv_hdr-inv_type = 'TAX INVOICE'.
if t_inv_item-shkzg = 'S'.
t_inv_item-wrbtr = 0 - t_inv_item-wrbtr.
t_inv_item-dmbtr = 0 - t_inv_item-dmbtr.
endif.
else.
if t_inv_item-shkzg = 'H'.
t_inv_item-wrbtr = 0 - t_inv_item-wrbtr.
t_inv_item-dmbtr = 0 - t_inv_item-dmbtr.
endif.
endif.
append t_inv_item.
endselect.
endif.
endloop.
‎2006 Sep 11 4:32 AM
Hi
If my understanding is correct, it should work this
way.
* if it is vendor
else.
if t_inv_hdr-bschl = '31'. "Credit note
t_inv_hdr-inv_type = 'CREDIT NOTE'.
else.
if t_inv_hdr-gst_no <b>eq space.</b>
t_inv_hdr-inv_type = 'Invoice'.
else.
t_inv_hdr-inv_type = 'Tax Invoice'.
endif.
endif.Kind Regards
Eswar
‎2006 Sep 11 4:32 AM
Hi
If my understanding is correct, it should work this
way.
* if it is vendor
else.
if t_inv_hdr-bschl = '31'. "Credit note
t_inv_hdr-inv_type = 'CREDIT NOTE'.
else.
if t_inv_hdr-gst_no <b>eq space.</b>
t_inv_hdr-inv_type = 'Invoice'.
else.
t_inv_hdr-inv_type = 'Tax Invoice'.
endif.
endif.Kind Regards
Eswar