Skip to Content
0
Former Member
Aug 09, 2009 at 03:23 PM

Creating settlement rule aborts

878 Views

Hi Experts,

I want to create a function module for creating a settlement rule. For that purpose I want to use the function moduls K_SRULE_CREATE, K_SETTLEMENT_RULE_FILL and K_SETTLEMENT_RULE_SAVE.

When I am executing my created FM it aborts always with a message, which is delivered to my postbox.

In SM21 (System log) are three entries: update terminated, transaction canceled, short dump created and run time error: "Raise exception" occured. For error analysis I have looked in SM13, where I get the following information: Module name(function): K_SRULE_SAVE_UTASK Update return code error. Status of update module: Update was terminated; Report LKOBRU03 Row 22. That seems to be the point where the update of the databases should be done. But I don`t know and understand why that error occures. I hope someone can help me.

For better understanding I have written the source code of my FM below.

Best regards

Phillip

*"----


""Local Interface:

*" IMPORTING

*" VALUE(IP_BELNR) TYPE J_OBJNR

*" EXPORTING

*" VALUE(EP_SUBRC) TYPE SY-SUBRC

*"----


data: lv_subrc type sy-subrc,

lv_objnr type cobrb-objnr,

ls_cobra like cobra,

lt_cobra type table of cobra,

ls_cobrb type cobrb,

lt_cobrb type table of cobrb.

lv_subrc = 0.

call function 'K_SRULE_CREATE'

exporting

i_objnr = ip_belnr

  • I_CHECK_ONLY_LOCAL = ' '

importing

e_cobra = ls_cobra

exceptions

rule_already_exists = 1

others = 2

.

if sy-subrc = 0.

append ls_cobra to lt_cobra.

ls_cobrb-objnr = ip_belnr.

ls_cobrb-bureg = '000'.

ls_cobrb-lfdnr = '001'.

ls_cobrb-perbz = 'FUL'.

ls_cobrb-prozs = '100'.

ls_cobrb-konty = 'FXA'.

append ls_cobrb to lt_cobrb.

call function 'K_SETTLEMENT_RULE_FILL'

tables

i_cobra = lt_cobra

i_cobrb = lt_cobrb.

call function 'K_SETTLEMENT_RULE_SAVE'

exporting

objnr = ip_belnr

dialog = ' '

exceptions

no_rule_for_objnr = 1.

if sy-subrc = 0.

commit work.

else.

ev_subrc = '20'.

endif.

else.

ev_subrc = '10'.

endif.

endfunction.