SAP RFKK_MA_SCHEDULER参数运行时修改:FKK_AKTIV2_PARA_BASICS_TO_DB缺失E_ADDONS参数的替代方案咨询
First, let's fix a small typo in your code: you called FRK_FEYM_READ_PARAMETERS, but the correct standard function module for reading payment run parameters is FKK_FPYM_READ_PARAMETERS – correcting this will avoid unnecessary runtime errors.
Now, to address your core issue: FKK_AKTIV2_PARA_BASICS_TO_DB is designed only to handle basic payment run parameters (from the E_BASICS structure), so it doesn't support passing E_ADDONS. Here are two reliable, standard-compliant approaches to update both basic and add-on parameters:
1. Use the Dedicated Add-On Parameter Update Function Module
SAP provides a matching function module specifically for updating add-on payment run parameters: FKK_FPYM_PARA_ADDONS_TO_DB. This is the recommended, supported method to pair with FKK_FPYM_READ_PARAMETERS.
Modified Code Example
*-- Correctly retrieve basic and add-on parameters CALL FUNCTION 'FKK_FPYM_READ_PARAMETERS' EXPORTING i_laufd = lv_laufd i_laufi = lv_laufi i_aktyp = c_aktyp IMPORTING e_basics = ls_basics e_addons = ls_addons EXCEPTIONS not_found = 1 OTHERS = 2. *-- Your existing logic to modify the customer range in basics SELECT SINGLE low FROM tvarvc INTO @lv_cutoff WHERE name = @lc_tvarvc_pyr_cutoff AND type = @lc_tvarvc_pyr_cutoff_type. LOOP AT lt_dfkkko INTO ls_dfkkko. AT NEW vkont. CLEAR ls_vkont. ls_vkont-sign = 'I'. ls_vkont-option = 'EQ'. ls_vkont-low = ls_dfkkko-vkont. APPEND ls_vkont TO ls_basics-ranges-r_vkont. ENDAT. ENDLOOP. *-- Step 1: Update basic parameters (existing call, fixed input variables) CALL FUNCTION 'FKK_AKTIV2_PARA_BASICS_TO_DB' EXPORTING i_aktyp = c_aktyp i_laufd = lv_laufd " Fixed: Use the same lv_laufd from input, not e_laufd i_laufi = lv_laufi i_basics = ls_basics EXCEPTIONS unexpected_error = 1 OTHERS = 2. IF sy-subrc <> 0. " Add error handling (e.g., log message, raise exception) ENDIF. *-- Step 2: Update add-on parameters with dedicated FM CALL FUNCTION 'FKK_FPYM_PARA_ADDONS_TO_DB' EXPORTING i_laufd = lv_laufd i_laufi = lv_laufi i_aktyp = c_aktyp i_addons = ls_addons " Pass the retrieved/modified add-ons structure EXCEPTIONS not_found = 1 unexpected_error = 2 OTHERS = 3. IF sy-subrc <> 0. " Handle error accordingly ENDIF.
2. Direct Database Update (Fallback Option)
If the dedicated add-on FM isn't available in your SAP version, you can directly update the underlying database table for payment run add-ons: DFKKPYM_A. Note: Only use this approach if the first method isn't feasible, as direct table updates bypass SAP's standard consistency checks.
Critical Notes for Direct Update:
- Always lock the payment run object first with
ENQUEUE_E_DFKKPYMto prevent concurrent modifications. - Unlock the object after the update with
DEQUEUE_E_DFKKPYM.
Example Snippet
*-- Lock payment run parameters to avoid conflicts CALL FUNCTION 'ENQUEUE_E_DFKKPYM' EXPORTING mode_dfkkpym = 'E' mandt = sy-mandt laufd = lv_laufd laufi = lv_laufi aktyp = c_aktyp x_laufd = 'X' x_laufi = 'X' x_aktyp = 'X' EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. IF sy-subrc <> 0. " Handle lock failure (e.g., exit with error message) ENDIF. *-- Update add-ons table (map fields from ls_addons to table columns) UPDATE dfkkpym_a SET pyr_addon1 = ls_addons-pyr_addon1, pyr_addon2 = ls_addons-pyr_addon2 " Add other relevant fields from ls_addons WHERE mandt = sy-mandt AND laufd = lv_laufd AND laufi = lv_laufi AND aktyp = c_aktyp. *-- Unlock the payment run object CALL FUNCTION 'DEQUEUE_E_DFKKPYM' EXPORTING mode_dfkkpym = 'E' mandt = sy-mandt laufd = lv_laufd laufi = lv_laufi aktyp = c_aktyp x_laufd = 'X' x_laufi = 'X' x_aktyp = 'X'.
Additional Tips
- Confirm event 1906 (Payment Run: Change Parameters Before Selection) triggers at the right time – it should run after the variant is loaded but before the selection process starts, so your custom ranges are applied.
- Test all changes thoroughly in a non-production environment to verify that both basic and add-on parameters are updated correctly, and that the payment run uses your modified ranges as expected.
内容的提问来源于stack exchange,提问作者RALF

