05-05-2008 1:35 PM
I wonder if there is any FM or BAPI to change settlement rule for network activity?
05-05-2008 2:13 PM
Hi,
Try these:
IBAPI_ALM_ORDERSRULE_CREATE
GCC_PS_SRULE_CREATE
Regards
05-05-2008 2:13 PM
Hi,
Try these:
IBAPI_ALM_ORDERSRULE_CREATE
GCC_PS_SRULE_CREATE
Regards
06-11-2008 3:09 PM
Hi everybody,
I found in a Rusian foruma way to create a settlement rule using the functions of the FM KOBS. I changed a bit the code because my requirement was just to update the field URZUO of the settlement rule. The original post (in Russian) can be found here.
My implementation is more simple because the requirement was different:
types: begin of ty_objnr,
objnr like prps-objnr,
end of ty_objnr.
*.COBRA-Buffer (see FM KOBS)
types: begin of ty_cobra_buf.
include structure cobra.
types: uflag like dkobr-upd_flag,
end of ty_cobra_buf.
types: ty_t_cobra_buf type ty_cobra_buf occurs 10.
*.COBRB-Puffer mit Änderungsflag (see FM KOBS)
types: begin of ty_cobrb_buf.
include structure cobrb.
types: uflag like dkobr-upd_flag,
end of ty_cobrb_buf.
types: ty_t_cobrb_buf type ty_cobrb_buf occurs 10.
***********************************************************************
* Internal tables *
***********************************************************************
data: it_abrechnug type standard table of ty_abrechnung,
it_objnr type standard table of ty_objnr,
it_cobra like table of cobra with header line,
it_cobrb like table of cobrb with header line.
***********************************************************************
* Data *
***********************************************************************
data: wa_cobra_buf type ty_t_cobra_buf,
wa_cobrb_buf type ty_t_cobrb_buf,
wa_objnr like line of it_objnr,
wa_urzuo like cobrb-urzuo,
l_mem_cobrb like wa_cobrb_buf[],
l_mem_cobra like wa_cobra_buf[],
l_mem_cobrb_zeile like line of l_mem_cobrb,
l_mem_cobra_zeile like line of l_mem_cobra.
form urzuo_aendern using p_objnr p_pspnr p_urzuo.
data: c_objnr like prps-objnr,
c_pspnr like prps-pspnr,
c_urzuo like cobrb-urzuo.
c_objnr = p_objnr.
c_pspnr = p_pspnr.
c_urzuo = p_urzuo.
refresh: it_objnr,
it_cobra,
it_cobrb,
l_mem_cobra,
l_mem_cobrb.
wa_objnr = c_objnr.
append wa_objnr to it_objnr.
* Reas settlement rule from the DM
call function 'K_SRULE_PRE_READ'
exporting
i_pflege = ' '
tables
t_sender_objnr = it_objnr
* T_COBRA =
exceptions
wrong_parameters = 1
others = 2.
if sy-subrc <> 0.
perform error using c_pspnr sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
* Fill internal buffer with settlement rules
call function 'K_SETTLEMENT_RULE_GET'
exporting
objnr = c_objnr
x_all = ' '
tables
e_cobra = it_cobra
e_cobrb = it_cobrb
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
perform error using c_pspnr sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
* Save settlement rule in ABAP-Memory
call function 'K_SRULE_EXPORT_IMPORT'
exporting
i_mode = 'EX'
exceptions
wrong_mode = 1
others = 2.
if sy-subrc <> 0.
perform error using c_pspnr sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
* Read ABAP-Memory
import l_mem_cobra l_mem_cobrb from memory id 'K_SRULE'.
* Change field URZUO and set Update-Flag
loop at l_mem_cobrb into l_mem_cobrb_zeile where urzuo is initial.
l_mem_cobrb_zeile-urzuo = p_urzuo.
l_mem_cobrb_zeile-uflag = 'U'. "Update Kennzeichen
modify l_mem_cobrb from l_mem_cobrb_zeile transporting urzuo uflag.
endloop.
* Clear internal buffer
call function 'K_SETTLEMENT_RULE_REFRESH'
exporting
objnr = c_objnr.
* Fill ABAP-Memory with new rules
export l_mem_cobra l_mem_cobrb to memory id 'K_SRULE'.
* Fill internal buffer with new rules
call function 'K_SRULE_EXPORT_IMPORT'
exporting
i_mode = 'IM'
exceptions
wrong_mode = 1
others = 2.
if sy-subrc <> 0.
perform error using c_pspnr sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
* SAve new rules
call function 'K_SETTLEMENT_RULE_SAVE'
exporting
dialog = 'X'
objnr = c_objnr
i_status_update = ' '
exceptions
no_rule_for_objnr = 1
others = 2.
if sy-subrc <> 0.
perform error using c_pspnr sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
commit work.
perform erfolg using c_pspnr.
endform. " URZUO_AENDERN
Hope it helps,
Jaime