Hi i am trying to calculate total Qty in MSEG table based on indicator and i wrote ALV report in ABAP its working fine , but my requirement is to write it in AMDP and consume those result in CDS view. please help me how to write below ABAP code in SQL query .
LOOP AT it_mseg INTO wa_mseg WHERE matnr = wa_mslb-matnr
AND werks = wa_mslb-erks AND lifnr = wa_mslb-lifnr.
IF sy-subrc EQ 0.
WHEN 'S'. qas = qas + wa_mseg-menge.
WHEN 'H'. qah = qah + wa_mseg-menge.