Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

validations

Former Member
0 Likes
374

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
348

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

1 REPLY 1
Read only

Former Member
0 Likes
349

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