Skip to Content
0
Former Member
Mar 02, 2009 at 08:01 PM

handling condition

63 Views

Hi Gurus!

In my present code it is able to handle the list price i.e showing '01''s.

I would like to do something like this :-

we can only have 1 item for the billing document #/item # combination

otherwise the net values and quantities will be exaggerated.

The logic should be to read through the conditions and display in

the report the u201Clastu201D condition only. So, if list price(01),

read all and only show the last one with the 01 for list.

When it is Off List, as soon as you hit a record in the loop

that makes it Off List(02), no need to read any further and just

keep that condition with 02 for off list. End result is only 1 record.

We have some odd conditions that are considered u201Cactiveu201D(konv-kinak),

but donu2019t have any value yet show up in the conditions that we would loop through.

Need to add logic to NOT consider these condition records when

the Condition Value (KOMV-KWERT) = $0.00. The 02 this should

apply to are ZPTM and ZDSP. We cannot exclude anything that is

$0 as there are times when they produce a $0 list price(01) invoice

for customers and that may be the only condition.

data: lv_kotabnr type c length 15.
types: begin of it_konv ,
         kinak type konv-kinak,
         kschl type konv-kschl,
         kolnr type konv-kolnr,
       end of it_konv,
       begin of it_t685 ,
         kozgf type t685-kozgf,
       end of it_t685,
       begin of it_t682i,
        kotabnr type t682i-kotabnr,
        kolnr   type t682i-kolnr,
        kozgf type t682i-kozgf  ,
      end of it_t682i         ,
      begin of it_price ,
        ZPRICE_TYPE type zsd_price_type-ZPRICE_TYPE,
      end of it_price  .
      DATA: t_konv type table of it_konv, "Internal table
            wa_konv type it_konv, "Work Area
            t_t685 type table of it_t685,
            wa_t685 type it_t685,
            t_t682i type table of it_t682i,
            wa_t682i type it_t682i,
            t_price type table of  it_price,
            wa_price type it_price.        " replace ',' with '.'
refresh t_konv.
select KINAK
       KSCHL
       KOLNR
  from konv
  into table t_konv
 where kinak = ' '
   and knumv eq vbrk-knumv
   and kposn eq vbrp-posnr .
check not t_konv is initial.
refresh t_t685.
select kozgf
  into table t_t685
  from T685
   for all entries in t_konv
 where kappl = 'V'
   and kschl = t_konv-kschl.
if sy-subrc eq 0.
  refresh t_t682i.
Loop at t_konv into wa_konv.
    Loop at t_t685 into wa_t685.                                                                                
move : wa_konv-kolnr to wa_t682i-kolnr,                       
             wa_t685-kozgf to wa_t682i-kozgf.                       
      append wa_t682i to t_t682i.                                    
    endloop.
  endloop.
  select kotabnr
         kolnr
         kozgf
    into table t_t682i
    from T682I
     for all entries in t_t682i
   where kappl = 'V'
     and kolnr eq t_t682i-kolnr
     and kozgf eq t_t682i-kozgf.
  if sy-subrc eq 0.
     select  zprice_type
      into v_list from zsd_price_type
       where kotabnr = wa_t682i-kotabnr .
      exit.

endselect.
endif.
endif.

. Thanks