‎2009 Mar 02 8:01 PM
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
‎2009 Mar 03 6:15 PM
I just want to select the price list if its 01 or 02 as per the code. I would like to selecet it in such a manner that 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, 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, no need to read any further and just keep that condition with 02 for off list. End result is only 1 record.
if sy-subrc eq 0.
select ZPRICE_TYPE
into table t_price
from zsd_price_type
for all entries in t_t682i
where kotabnr = t_t682i-kotabnr .
loop at t_price into wa_price .
if wa_price-zprice_type = '01'.
continue.
if wa_price-zprice_type = '02'.
v_list = wa_price-zprice_type.
exit.
endif.
endif.
* endif.
endloop.
If someone can please help out would be highly apprectaited.
Thanks
Aarav
‎2009 Mar 02 8:57 PM
‎2009 Mar 03 6:15 PM
I just want to select the price list if its 01 or 02 as per the code. I would like to selecet it in such a manner that 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, 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, no need to read any further and just keep that condition with 02 for off list. End result is only 1 record.
if sy-subrc eq 0.
select ZPRICE_TYPE
into table t_price
from zsd_price_type
for all entries in t_t682i
where kotabnr = t_t682i-kotabnr .
loop at t_price into wa_price .
if wa_price-zprice_type = '01'.
continue.
if wa_price-zprice_type = '02'.
v_list = wa_price-zprice_type.
exit.
endif.
endif.
* endif.
endloop.
If someone can please help out would be highly apprectaited.
Thanks
Aarav
‎2009 Mar 03 6:23 PM
Hi,
try with this select statement
select ZPRICE_TYPE
into table t_price
from zsd_price_type
for all entries in t_t682i
where kotabnr = t_t682i-kotabnr
and ( zprice_type = '01' or zprice_type = '02' ).
and later in the loop statement remove the if conditions i think they will not be necessary as you will get only the records of 01 and 02.
Regards,
Siddarth
‎2009 Mar 03 7:05 PM
Its giving me runtime error and not only that we havent specified as to what field the value of zprice_type goes in , maybe thats wyy its going into runtime error. Even it has to select the last condition showing 01 to print for list price and the first condition type showing 02 to print and on first 02 it should print and exit, while in the case of 01 it looks for the next 01 and next and the last 01 it finds it prints that.
This v_list is one of teh fields of the query created.
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 table t_price
from zsd_price_type for all entries in t_t682i
where kotabnr = t_t682i-kotabnr
and ( zprice_type = '01' or zprice_type = '02' ).
v_list = wa_price-zprice_type.
Loop at t_price into wa_price where ZPRICE_TYPE is initial. " included into wa_price
exit.
endloop.
endif.
endif.
‎2009 Mar 03 7:08 PM
>
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.
> if not t_t682i[] is initial. "<<<<< mandatory
> 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.
>if not t_t682i[] is initial. "mandatory
> select ZPRICE_TYPE into table t_price
> from zsd_price_type
> for all entries in t_t682i
> where kotabnr = t_t682i-kotabnr
> and ( zprice_type = '01' or zprice_type = '02' ).
> v_list = wa_price-zprice_type.
> Loop at t_price into wa_price where ZPRICE_TYPE is initial.
> exit.
> endloop.
> endif.
> endif.
endif.
endif.
‎2009 Mar 03 7:26 PM
This ig giving me all 00 values in my v_list column, which is nnot the case.
It should show me as per the list price or offlist price i.e 01 or 02 and only when not applicable 00.But here it shows all as 00.
Thanks
‎2009 Mar 03 10:04 PM
When I debugg, I see that Kotabnr value is always 000 which shouldnt be right , its never 000. This si teh reason most of the time the output for v_list that is the price list is opposite i.e where it has to be 02 its 01 and where it has to be 01 its 02, its not showing up correctly . Please if someonece can please help me out with tis would be highly appreciated.
thanks
‎2009 Mar 03 10:13 PM
Try this: Its using custom tables...so you need to bedug and find out...
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.
clear: wa_t682i. "<<change
endloop.
endloop.
if not t_t682i[] is initial. "<<<<< mandatory
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.
if not t_t682i[] is initial. "<<mandatory
select ZPRICE_TYPE into table t_price
from zsd_price_type
for all entries in t_t682i
where kotabnr = t_t682i-kotabnr
and ( zprice_type = '01' or zprice_type = '02' ).
v_list = wa_price-zprice_type.
Loop at t_price into wa_price where ZPRICE_TYPE EQ Space. "<<change
exit. "<< try skip
endloop.
endif.
endif.
endif.
endif.
‎2009 Mar 03 10:57 PM
This returns all values for that field as 00.
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.
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.
clear: wa_t682i.
endloop.
endloop.
if not t_t682i[] is initial.
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.
if not t_t682i[] is initial.
select ZPRICE_TYPE into table t_price
from zsd_price_type for all entries in t_t682i
where kotabnr = t_t682i-kotabnr
and ( zprice_type = '01' or zprice_type = '02' ).
v_list = wa_price-zprice_type.
Loop at t_price into wa_price where ZPRICE_TYPE EQ Space.
exit.
endloop.
endif.
endif.
endif.
endif.Thanks