Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to write the if condition on the AMDP in HANA

Ganesh_Pandian
Explorer
0 Kudos

Hello Experts,

i have to check condition for two  fields  in AMDP , currently i have written the select query in amdp then i used a abap program to calculate the if condition and display the value in alv, but i dont want to use the  if condition on the abap program , i want to do these if conditions on the AMDP program itself.

  IF wa_mseg-bwart = '101' AND wa_mseg-sobkz = 'K'.

wa_final-mix_mat_qty_101 = wa_mseg-menge.

ELSEIF wa_mseg-bwart = '102' AND wa_mseg-sobkz = 'K'.

wa_final-mix_mat_qty_102 = wa_mseg-menge.

ELSEIF wa_mseg-bwart = '122' AND wa_mseg-sobkz = 'K'.

        

wa_final-cleaned_qty_122 = wa_mseg-menge.



please give me a solution for this , i want this conditions to be checked and the data should be feeded on the internal table on amdp..then i just want to use abap program to get value from internal table and display that in ALV.

thanks a lot .



1 ACCEPTED SOLUTION

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert

Hi Ganesh,

you can have a look at method AMDP_GET_BP_CLASSIFICATION in Class CL_EPM_OIA_BP_CLASSIFY_AMDP (should be available in 740 SP5).

Alternatively, you might want to use a CASE statement (see https://help.sap.com/saphelp_hanaplatform/helpdata/en/20/a4389775191014b5a6bf2ccc0df2ed/content.htm).

Or see further information in http://help.sap.com/hana/sap_hana_sql_script_reference_en.pdf.

Please also consider the performance aspects of such imperative logic - you might want to consult the HANA Development experts in .

Cheers,
  Jasmin

3 REPLIES 3

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert

Hi Ganesh,

you can have a look at method AMDP_GET_BP_CLASSIFICATION in Class CL_EPM_OIA_BP_CLASSIFY_AMDP (should be available in 740 SP5).

Alternatively, you might want to use a CASE statement (see https://help.sap.com/saphelp_hanaplatform/helpdata/en/20/a4389775191014b5a6bf2ccc0df2ed/content.htm).

Or see further information in http://help.sap.com/hana/sap_hana_sql_script_reference_en.pdf.

Please also consider the performance aspects of such imperative logic - you might want to consult the HANA Development experts in .

Cheers,
  Jasmin

amol_samte
Contributor
0 Kudos

Hi,

Simply you can use case statement.

For ref.

-Amol S

Ganesh_Pandian
Explorer
0 Kudos

Thank you Jasmin and amol .. i will check the conditions and let you know..