PARAMETERS: p_werks TYPE werks_d.
DATA:
lv_rebate TYPE p DECIMALS 2 VALUE '0.10',
lv_high_rebate TYPE p DECIMALS 2 VALUE '0.30'.
 
SELECT ebeln,
werks,
CEIL( netpr ) AS whole_ord_net,
( @lv_rebate * netpr ) AS rebate,
( netpr - ( @lv_rebate * netpr ) ) AS act_net,
 
CASE WHEN werks = @p_werks " For specific plant
THEN @lv_rebate
ELSE @lv_high_rebate
END AS rebate_type,
 
CASE WHEN werks = @p_werks " For specific plant
THEN 'low rebate'
ELSE 'high rebate'
END AS low_high
 
FROM ekpo
USING CLIENT '130'
UP TO 25 ROWS
INTO TABLE @DATA(lt_po_data).
 
IF sy-subrc = 0.
cl_demo_output=>display_data(
EXPORTING
value = lt_po_data
name = 'New AGE SQL : 4' ).
ENDIF.
 
 
 
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Consultant
Contact : serkurumsal@yandex.com