Wednesday, March 31, 2010

Condition Values For PO & Contract

I just have to jot this down! Took me forever to get the KNUMH value for contract!
Trickkayyy! :P

PO: 

To get the Item Conditions Value as in ME23N (Conditions tab at item level):

SELECT SINGLE kbetr FROM konv
      INTO gv_kbetr
      WHERE knumv = lv_knumv AND      "lv_knumv = EKKO-knumv
                      kschl = 'ZAVS'.

Item Conditions Value = GV_KBETR

To get the Item Conditions Type Text:

SELECT SINGLE vtext FROM t685t    
      INTO gv_vtext
      WHERE spras = 'E'        AND
                      kvewe = 'A'     AND
                      kappl = 'M'      AND
                      kschl = 'ZAVS'.     "based on your condition type

Item Conditions Text = GV_VTEXT.

Contract:

To get the Item Conditions Value as in ME33K:

 "lv_ebeln & lv_ebelp is from EKPO
CONCATENATE lv_ebeln lv_ebelp INTO lv_vakey.
SELECT SINGLE knumh FROM konh
      INTO lv_knumh
      WHERE vakey = lv_vakey.


IF lv_knumh IS NOT INITIAL.
   SELECT SINGLE kbetr FROM konp
      INTO gv_kbetr
      WHERE knumv = lv_knumv AND  "lv_knumv = EKKO-knumv
                      kschl = 'ZA00'.
ENDIF.


Item Conditions Value = GV_KBETR

To get the Item Conditions Type TEXT:

 SELECT SINGLE vtext FROM t685t    
      INTO gv_vtext
      WHERE spras = 'E'        AND
                      kvewe = 'A'     AND
                      kappl = 'M'      AND
                      kschl = 'ZA00'.     "based on your condition type

Item Conditions Text = GV_VTEXT.



With Much Love,

The Rookie ABAPer

No comments:

Post a Comment