on 2025 Feb 27 8:35 PM
Hi everyone, I am doing some experimentation and trying to create a custom routine. I am not familiar with the process and running into some problems at the moment. In my code below, I am trying to give a user a discount if in the current month they have more than 3 orders over the value of 3000. I see some people use "komp" in their code, but what is this and how can it be implemented in my scenario? Can someone please shed some light as to where I am going wrong?
DATA: lv_order_count TYPE i,
lv_total_value TYPE decimal10_2,
lv_discount TYPE decimal10_2,
lv_discounted_value TYPE decimal10_2,
lt_vbak TYPE TABLE OF vbak,
ls_vbak TYPE vbak,
lv_first_day_of_month TYPE sy-datum.
lv_first_day_of_month = sy-datum(6) && '01'.
SELECT * FROM vbak INTO TABLE lt_vbak
WHERE erdat BETWEEN lv_first_day_of_month AND sy-datum and netwr > 3000 AND kunnr = '1987653'.
lv_order_count = LINES( lt_vbak ).
LOOP AT lt_vbak INTO ls_vbak.
IF lv_order_count > 3.
lv_discount = ls_vbak-netwr * '0.03'.
ENDIF.
ENDLOOP.
Request clarification before answering.
Just return the 'xkwert=lv_discount' in your routine. You may check other routines('Alternative Calculation of Condition Amount' ) that are delivered by SAP in V/08 as a kind of example.
Instead of using ''Alternative Calculation of Condition Amount'' routine, for your case, it`s better to have 'Requirement', then only return TRUE/FALSE in there. But the prerequisite is first to define a discount VK12.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
21 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.