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

Getting minimum charge indiactor on form

Former Member
0 Likes
516

Hi Gurus!

I have a slight issue in printing of the minimum charge flag

on my invoicewhen there are transportation line on the document.

A minimum value charge is charged when the total of the invoice is lesser than

the minim set charge , in our case is 250 , so whenever the invoice total

is less than 250 automatically the invoice should print 'min charge' in place of

unit price and the value in the total. I am having the problem when theer are

transportation line on the documnet , then the minimum charge indicator dosent act correctly and

shows min charge flag even when it should not be a min mun charge one.

my code doing it is as follows:


** Set minimum charge flag when there is transportation line
read table gt_gen_del into ws_gen_del
 with key uepos = gs_gen_del-itm_number.
if sy-subrc = 0.
  loop at gt_konv into gs_konv
  where kposn = gs_gen_del-itm_number
    and kschl = 'ZAMW'   "minimun value
    or  kposn = ws_gen_del-itm_number.
    ws_kwert = ws_kwert + gs_konv-kwert.

* Method of excluding the markup and adding the minimum value
    if ws_kwert >= g_item_tot and ws_kwert <> 0.
      g_item_tot = ws_kwert.
      read table is_bil_invoice-it_kond into ls_kond
      with key
      itm_number = gs_gen_del-itm_number
      kschl      = 'ZSER'.
      if sy-subrc = 0.
        ls_kond-kwert = ls_kond-kwert - gs_gen_del-kzwi3.
        modify is_bil_invoice-it_kond from ls_kond index sy-tabix.
      endif.
      clear gs_gen_del-kzwi3.
      g_min_charge_flag = 'X'.
    endif.
  endloop.
else.
* When there is no transportation line
  loop at gt_konv into gs_konv
    where kposn = gs_gen_del-itm_number
      and kschl = 'ZAMW'.   "minimun value

* Method of excluding the markup and adding the minimum value
    if gs_konv-kwert >= g_item_tot and gs_konv-kwert <> 0.
      g_item_tot = gs_konv-kwert .
      read table is_bil_invoice-it_kond into ls_kond
        with key
            itm_number = gs_gen_del-itm_number
            kschl      = 'ZSER'.
      if sy-subrc = 0.
        ls_kond-kwert = ls_kond-kwert - gs_gen_del-kzwi3.
        modify is_bil_invoice-it_kond from ls_kond index sy-tabix.
      endif.
      clear gs_gen_del-kzwi3.
      g_min_charge_flag = 'X'.
    endif.
    exit.
  endloop.
endif.

Could anyone please help me out correcting this so that this works ok.

Regards

Aarav

Hi Gurus!

I have a slight issue in printing of the minimum charge flag

on my invoicewhen there are transportation line on the document.

A minimum value charge is charged when the total of the invoice is lesser than

the minim set charge , in our case is 250 , so whenever the invoice total

is less than 250 automatically the invoice should print 'min charge' in place of

unit price and the value in the total. I am having the problem when theer are

transportation line on the documnet , then the minimum charge indicator dosent act correctly and

shows min charge flag even when it should not be a min mun charge one.

my code doing it is as follows:


** Set minimum charge flag when there is transportation line
read table gt_gen_del into ws_gen_del
 with key uepos = gs_gen_del-itm_number.
if sy-subrc = 0.
  loop at gt_konv into gs_konv
  where kposn = gs_gen_del-itm_number
    and kschl = 'ZAMW'   "minimun value
    or  kposn = ws_gen_del-itm_number.
    ws_kwert = ws_kwert + gs_konv-kwert.

* Method of excluding the markup and adding the minimum value
    if ws_kwert >= g_item_tot and ws_kwert <> 0.
      g_item_tot = ws_kwert.
      read table is_bil_invoice-it_kond into ls_kond
      with key
      itm_number = gs_gen_del-itm_number
      kschl      = 'ZSER'.
      if sy-subrc = 0.
        ls_kond-kwert = ls_kond-kwert - gs_gen_del-kzwi3.
        modify is_bil_invoice-it_kond from ls_kond index sy-tabix.
      endif.
      clear gs_gen_del-kzwi3.
      g_min_charge_flag = 'X'.
    endif.
  endloop.
else.
* When there is no transportation line
  loop at gt_konv into gs_konv
    where kposn = gs_gen_del-itm_number
      and kschl = 'ZAMW'.   "minimun value

* Method of excluding the markup and adding the minimum value
    if gs_konv-kwert >= g_item_tot and gs_konv-kwert <> 0.
      g_item_tot = gs_konv-kwert .
      read table is_bil_invoice-it_kond into ls_kond
        with key
            itm_number = gs_gen_del-itm_number
            kschl      = 'ZSER'.
      if sy-subrc = 0.
        ls_kond-kwert = ls_kond-kwert - gs_gen_del-kzwi3.
        modify is_bil_invoice-it_kond from ls_kond index sy-tabix.
      endif.
      clear gs_gen_del-kzwi3.
      g_min_charge_flag = 'X'.
    endif.
    exit.
  endloop.
endif.

Could anyone please help me out correcting this so that this works ok.

Regards

Aarav

2 REPLIES 2
Read only

Former Member
0 Likes
480

HI!

COuld anyone please be kind enough to help m eout with this .

Thanks

Read only

0 Likes
480

Hi Gurus!

Could anyone please help me out with this if possible? The work done mentioned above fails somehow for some invoices.

Thanks. Help will be gretaly appreciated .