Hello,
i have the following scenario in an END ROUTINE where i need to populate a characteristic field "Product Group" (ZPMCPROGR) based on the values in a Key Figure "Net Price" (ZF31GSREV). Product Group is an attribute of Product (ZF31PRODU). The condition is as follows.....
if Net Price >= 200000 then fill Product Group with value A
if Net Price >= 400000 then fill Product Group with value B
if Net Price > 400000 then fill Product Group with value C
I am a beginer in ABAP and tried implementing the following code. There are no syntax errors but the field "Product Group" is not getting filled. My question is if such an implementation is possible and how can it be solved?
Thanks,
SD
-
Data Definitions
DATA: it_tab5 TYPE TABLE OF /BIC/PZF31PRODU,
wa_tab5 TYPE /BIC/PZF31PRODU.
Select the fields Product and Product Group and write to internal table
SELECT /BIC/ZF31PRODU /BIC/ZPMCPROGR
FROM /BIC/PZF31PRODU
INTO CORRESPONDING FIELDS OF TABLE it_tab5.
sort it_tab5 by /BIC/ZF31PRODU.
LOOP AT RESULT_PACKAGE
ASSIGNING <result_fields>.
read table it_tab5
with key /BIC/ZF31PRODU = <result_fields>-/BIC/ZF31PRODU
into wa_tab5
binary search.
if sy-subrc eq 0.
Implement the If condition
IF <result_fields>-/BIC/ZF31GSREV <= '200000'.
wa_tab5-/BIC/ZPMCPROGR = 'A'.
ELSEIF <result_fields>-/BIC/ZF31GSREV <= '400000'.
wa_tab5-/BIC/ZPMCPROGR = 'B'.
ELSEIF <result_fields>-/BIC/ZF31GSREV > '400000'.
wa_tab5-/BIC/ZPMCPROGR = 'C'.
ENDIF.
endif.
ENDLOOP.