Skip to Content

How to write the if condition on the AMDP in HANA

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 .



if.png (10.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 15, 2015 at 02:22 PM

    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 SAP HANA Developer Center.

    Cheers,
      Jasmin

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 15, 2015 at 02:25 PM

    Hi,

    Simply you can use case statement.

    For ref. Useful SQL in CASE WHEN you need it

    -Amol S

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 16, 2015 at 08:49 AM

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

    Add comment
    10|10000 characters needed characters exceeded