‎2009 Mar 05 3:11 AM
Hi!
I need to add in a condtion where if the contion type (kschl) is either 'za1' or when its is 'za2' the code should check if the field kwert is initial or 0. If it is zero , it should jump up to the next condition type to check if it is of what price type.I ahve a code which is running all well except that I need to add this condition when its chacking the condition types to select it as price list or offlist.Kind help please.
DATA:
tp_kotabnr TYPE kotabnr, " Condition table.
tp_kozgf TYPE kozgf,
tp_zprice_type TYPE zprice_type,
ta_konv TYPE
TABLE OF konv WITH HEADER LINE.
CLEAR: pricetype,conditiontype.
SELECT kschl kolnr FROM konv INTO CORRESPONDING FIELDS OF TABLE ta_konv WHERE
kinak = ' ' AND " Active
knumv EQ vbrk-knumv AND " Condition record number.
kposn EQ vbrp-posnr. " Item number.
LOOP AT ta_konv.
* Retreive the access sequence
SELECT SINGLE kozgf FROM t685 INTO tp_kozgf WHERE
kvewe = 'A' AND " Pricing.
kappl = 'V' AND " Sales application.
kschl = ta_konv-kschl. " Condition type.
* Retreive the pricing table.
SELECT SINGLE kotabnr FROM t682i INTO tp_kotabnr WHERE
kvewe = 'A' AND " Pricing.
kappl = 'V' AND " Sales application.
kozgf = tp_kozgf AND " Access sequence.
kolnr = ta_konv-kolnr. " Access sequence - Access number.
* Retreive the price type.
SELECT SINGLE zprice_type FROM zsd_price_type INTO tp_zprice_type WHERE
kappl = 'V' AND " Sales application.
kschl = ta_konv-kschl AND " Condition type.
kotabnr = tp_kotabnr. " Condition table.
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
* EXIT.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
ENDLOOP.Thanks
‎2009 Mar 05 5:36 AM
Hi,
data: v_index type sy-tabix.
LOOP AT ta_konv.
....
v_index = sy-tabix.
v_index = v-index + 1 .
IF wa_konv-kschl = 'ZA1' or ZA2.
--if wa-konv-kwert is initial.
--read ta_konv index v_index into wa_konv.
-
if sy-subrc = 0.
------>"price list or offlist add code
-
endif.
--endif.
ENDIF.
ENDLOOP.
Regards.
‎2009 Mar 05 5:06 AM
IF tp_zprice_type = 'ZA1' and kwert is not initial.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = 'ZA2' and kwert is not initial.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
‎2009 Mar 05 5:30 AM
Hi,
DATA:
tp_kotabnr TYPE kotabnr, " Condition table.
tp_kozgf TYPE kozgf,
tp_zprice_type TYPE zprice_type,
ta_konv TYPE
TABLE OF konv WITH HEADER LINE.
CLEAR: pricetype,conditiontype.
SELECT kschl kolnr *kwert* FROM konv INTO CORRESPONDING FIELDS OF TABLE ta_konv WHERE
kinak = ' ' AND " Active
knumv EQ vbrk-knumv AND " Condition record number.
kposn EQ vbrp-posnr. " Item number.
LOOP AT ta_konv.
if ta_konv-kschl = 'ZA1' or ta_konv-kschl = "ZA2'. " neha
if ta_konv-kwert is initial. " neha
* will jump to the next condition type
CONTINUE. " neha
else. " neha
* Retreive the access sequence
SELECT SINGLE kozgf FROM t685 INTO tp_kozgf WHERE
kvewe = 'A' AND " Pricing.
kappl = 'V' AND " Sales application.
kschl = ta_konv-kschl. " Condition type.
* Retreive the pricing table.
SELECT SINGLE kotabnr FROM t682i INTO tp_kotabnr WHERE
kvewe = 'A' AND " Pricing.
kappl = 'V' AND " Sales application.
kozgf = tp_kozgf AND " Access sequence.
kolnr = ta_konv-kolnr. " Access sequence - Access number.
* Retreive the price type.
SELECT SINGLE zprice_type FROM zsd_price_type INTO tp_zprice_type WHERE
kappl = 'V' AND " Sales application.
kschl = ta_konv-kschl AND " Condition type.
kotabnr = tp_kotabnr. " Condition table.
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
* EXIT.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
endif. " neha
endif. "neha
ENDLOOP.Regards,
Neha
Edited by: Neha Shukla on Mar 5, 2009 11:01 AM
‎2009 Mar 05 5:36 AM
Hi,
data: v_index type sy-tabix.
LOOP AT ta_konv.
....
v_index = sy-tabix.
v_index = v-index + 1 .
IF wa_konv-kschl = 'ZA1' or ZA2.
--if wa-konv-kwert is initial.
--read ta_konv index v_index into wa_konv.
-
if sy-subrc = 0.
------>"price list or offlist add code
-
endif.
--endif.
ENDIF.
ENDLOOP.
Regards.
‎2009 Mar 05 6:15 PM
HI1
I used all the the three methods but unfortunatley its wiping out all the other condition types and price type in the output just giving blank spaces.
I modified my code a little bit using a class zcl_konv=>get_price_list here and tried addinig the code part just after the loop but still it wipes away all other condition types as well as the price types.
DATA:
tp_zprice_type TYPE zprice_type,
ta_konv TYPE TABLE OF konv WITH HEADER LINE.
CLEAR: pricetype,conditiontype.
SELECT kschl kolnr FROM konv INTO CORRESPONDING FIELDS OF TABLE ta_konv WHERE
kinak = ' ' AND " Active
knumv EQ vbrk-knumv AND " Condition record number.
kposn EQ vbrp-posnr. " Item number.
LOOP AT ta_konv.
<<<added code>> here to accommodate the specaial condition
tp_zprice_type = zcl_konv=>get_price_type( itp_kschl = ta_konv-kschl
itp_kolnr = ta_konv-kolnr ).
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
ENDLOOP.output
Pr Ty Cond.
1712 10/02/2008 90628975 000010 118461 72808 9,459.51
1712 10/02/2008 90628975 000040 118461 72610 9,459.51
1712 10/02/2008 90628975 000070 118461 70052 9,459.51
1712 10/02/2008 90628975 000071 118461 72610 9,459.51
1712 10/02/2008 90628975 000072 118461 72808 9,459.51
1712 10/02/2008 90628975 000073 118461 72808 9,459.51
1712 10/02/2008 90628975 000074 118461 72610 9,459.51
Thanks
‎2009 Mar 05 6:43 PM
And actually it should be checaking ii condition type is ( 'Z1' or Z2) and the condition value komv-kwert is 0 then it hsould jump to next condition type.
Please if someonecan plz help out.
Thanks
‎2009 Mar 05 7:29 PM
Hi,
Check the entries in the internal table ta_konv if there is any entry with 'ZA1' or 'ZA2' or both of them...
if os then try with this one..
case ta_konv-KSCHL.
when 'ZA1' or 'ZA2'.
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
when 'OTHERS'.
endcase.
" also check if the method called is changing the value of ta_konv-kschl or not....Regards,
Siddarth
‎2009 Mar 05 9:41 PM
With this it will show me the condition type Z1 or Z2 with the price type and condition type wheeras what I want it to do is checak if the condition types are either ( Z1 or Z2 ) AND komv-kwert is initial then ignore that and go to teh next condition type in the line item. But with the above it will show me the price type and condition type for those two condition types when komv-kwert is 0.
Please correct me if I am wrong and let me knwo how to approcah it.
thanks
‎2009 Mar 05 10:17 PM
Hi,
"try using this condition with brackets it will surely work......
if ( ta_konv-kschl = 'ZA1' or ta_konv-kschl = 'ZA2' ) and ta_konv-kwert is not initial.
"*****processing steps
else.
"*****processing steps
endif.Regards,
Siddarth
‎2009 Mar 05 10:35 PM
Thanks that works , but not in all cases because as i said I need to compare the condition value from the field KOMV-KWERT and not KONV-kwert which si why in some cases its fine but in other cases it not fine.
DATA:
tp_zprice_type TYPE zprice_type,
ta_konv TYPE TABLE OF konv WITH HEADER LINE.
CLEAR: pricetype,conditiontype.
SELECT kschl kolnr kwert FROM konv INTO CORRESPONDING FIELDS OF TABLE ta_konv WHERE
kinak = ' ' AND " Active
knumv EQ vbrk-knumv AND " Condition record number.
kposn EQ vbrp-posnr. " Item number.
LOOP AT ta_konv.
tp_zprice_type = zcl_konv=>get_price_type( itp_kschl = ta_konv-kschl
itp_kolnr = ta_konv-kolnr ).
***
IF ( ta_konv-kschl = 'ZTPM' or ta_konv-kschl = 'ZDSP' ) and
ta_konv-kwert is not INITIAL. <<<<<<<<<< to compare with komv-kwert and not konv-kwert>
***
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
else.
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.Thanks
‎2009 Mar 05 10:55 PM
Hi,
just before the loop statement use the read statement reading the record from ta_komv with the field which is common in both the table and then
in the if condition change ta_konv to ta_konv-kwert
Regards,
Siddarth
‎2009 Mar 06 4:03 PM
Hi but ta_komv is not used in the code at all , that si what I wanted to know how to realate or read the komv table into konv and check for kwert from that table if zero or not?
Thanks
‎2009 Mar 06 4:08 PM
Hi,
if ta_komv table is not used at all in the code, could you please let me know how you will be getting the data into that table.....
is it that you have to copy the data of ta_konv or from somewhere else you will get the data in it.....
because to compare you need the data in it.....
Please be more specific.
Regards,
Siddarth
‎2009 Mar 06 4:15 PM
That is also fine if we use konv table as it should have the same value as in komv for the kwert field.
But the problem is in the below code it handles the situation when condition is (Z1 or Z2 ) and kwert is not intial but it dosent ahndle the situtaion when condtion is Z1 or Z2 and the value kwert is initial , it just does the other normal procedure as it does for others .
This condition is nt handled when kwert is 0 for those conditions.
IF ( ta_konv-kschl = 'ZTPM' or ta_konv-kschl = 'ZDSP' ) and
ta_konv-kwert is not INITIAL.<<<<<<<<<<handles only when its not initial but when its intial then
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
else.
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
‎2009 Mar 06 4:18 PM
Hi,
Could you let me know what is the type of kwert field.. (I, C, N, D or etc...)
Regards,
Siddarth
‎2009 Mar 06 4:38 PM
Kwert is the condition value field which is a currency field of lenght 13 and 2 decimal places.
Thanks
‎2009 Mar 06 5:09 PM
Hi Siddhart!
Please let me know if you were asking abt the same.
Thanks
‎2009 Mar 06 5:32 PM
‎2009 Mar 06 5:35 PM
If you see the code carefully the one which you have pasted recently...,
IF ( ta_konv-kschl = 'ZTPM' or ta_konv-kschl = 'ZDSP' ) and
ta_konv-kwert is not INITIAL.<<<<<<<<<<handles only when its not initial but when its intial then
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
else.
IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.IF tp_zprice_type = '01'.
conditiontype = ta_konv-kschl.
pricetype = 'List'.
ELSEIF tp_zprice_type = '02'.
conditiontype = ta_konv-kschl.
pricetype = 'Offlist'.
EXIT.
ENDIF.is same for if konv-kwert is initial and not initial....
due to which you are not able to find the difference in the output....
Regards,
Siddarth
‎2009 Mar 06 6:00 PM
Thansk siddharth1
Yes it indeed solved my problem , I changed it to when its initail and its working fine.
Thanks