cancel
Showing results for 
Search instead for 
Did you mean: 

How to remediate usage of VAKEY in where condition from KONH

Hi All,

we recently migrated from ECC to S/4 HANA and currently in remediation phase. We see the instances where VAKEY field is used in the where condition on KONH to fetch the records. But as we are aware, in HANA system VAKEY field is not available in KONH table. Want to know how this can be replaced.

SAP note 2220005 talks about certain class methods to fetch VAKEY but no where it mentions about the usage of VAKEY in where condition and its replacement in custom code.

Please suggest.

Regards,

Suman.

Accepted Solutions (0)

Answers (3)

Answers (3)

Hello Suman, did you find any solution for the selection in KONH using VAKEY?

Sudhakaran
Participant

Hi Suman,

Here is the code to get VAKEY value. ( reference include LV64AF0R, subroutine READ_KONH)

CLEAR gs_vakey.
      lo_cond_vakey_srv = cl_cond_vakey_srv=>get_instance( ).
      TRY.
          gs_vakey = lo_cond_vakey_srv->determine_vakey_from_db( iv_usage   = konh-kvewe
                                                                 iv_knumh   = konh-knumh
                                                                 iv_kotabnr = konh-kotabnr
                                                                 iv_bypassing_buffer = abap_false ).
        CATCH cx_cond_vakey INTO o_cx_ref.
* Try to read VAKEY from change document
          SELECT SINGLE MAX( changenr ) value_old
                       FROM cdpos
                       INTO ( lv_changenr, lv_value_old )
                       WHERE objectclas = 'COND_A'
                             AND objectid   = konh-knumh
                             AND chngind    = 'U'
                             AND tabname    = 'KONHAE'
                             AND fname      = 'VAKEY'
                             GROUP BY value_old.
          IF sy-subrc EQ 0.
            gs_vakey = lv_value_old.
          ENDIF.
      ENDTRY.<br>

Best Regards, Sudhakaran

nomssi
Active Contributor

Check the Cookbook for Customer Adoption named

Required Code and DDIC Changes for Customers using Pricing and Condition Technique in SAP S/4 HANA.