K_ORDER_SRULE_ADD
Hi Experts,
Please advice me how to use function module K_ORDER_SRULE_ADD to update the settlement rule for the maintenance order..
Hi,
Try for a Where used List for this FM and see how a SAP Standard Prog using this or any Zprog might also be using this.
Try this also:
DATA: it_rules TYPE srules_ext OCCURS 0.
CALL FUNCTION 'K_SRULE_CREATE'
EXPORTING
i_objnr = caufvd_imp-objnr
EXCEPTIONS
rule_already_exists = 1
OTHERS = 2.
srules-settl_type = 'FUL'.
srules-percentage = 100.
srules-amount = 0.
srules-costcenter = caufvd_imp-kostl.
APPEND srules.
CALL FUNCTION 'K_ORDER_SRULE_ADD'
EXPORTING
object_no = caufvd_imp-objnr
TABLES
srules = srules
EXCEPTIONS
wrong_input = 1
error_occurred = 2
object_not_found = 3
activity_not_allowed = 4
OTHERS = 5.
IF sy-subrc = 0.
COMMIT WORK AND WAIT.
ENDIF.
Similar Messages
-
How to use function module K_ORDER_SRULE_ADD?
Hi,
Can you provide me the details on how to use K_ORDER_SRULE_ADD especially criteria parameter? If possible, attached wit sample code? Thanks.
Best Regards,
Chee BoonHi,
Try for a Where used List for this FM and see how a SAP Standard Prog using this or any Zprog might also be using this.
Try this also:
DATA: it_rules TYPE srules_ext OCCURS 0.
CALL FUNCTION 'K_SRULE_CREATE'
EXPORTING
i_objnr = caufvd_imp-objnr
EXCEPTIONS
rule_already_exists = 1
OTHERS = 2.
srules-settl_type = 'FUL'.
srules-percentage = 100.
srules-amount = 0.
srules-costcenter = caufvd_imp-kostl.
APPEND srules.
CALL FUNCTION 'K_ORDER_SRULE_ADD'
EXPORTING
object_no = caufvd_imp-objnr
TABLES
srules = srules
EXCEPTIONS
wrong_input = 1
error_occurred = 2
object_not_found = 3
activity_not_allowed = 4
OTHERS = 5.
IF sy-subrc = 0.
COMMIT WORK AND WAIT.
ENDIF. -
Function module Prob with kostl
hi,good day guys.
Iam using K_ORDER_SRULE_ADD for settelment rules. In this other function module for read the fields one whic is K_DEFAULT_RULE_READ.. This is k_order_srule_add f.m source code as below as.
.default rule table TKB2C is maintained as 'I_SRULES' therefore
*.....aditional work area is needed.
i_srules = srules.
*.....fill COBL to find KONTY
cobl-kokrs = ld_kokrs.
cobl-gsber = srules-bus_area.
cobl-bukrs = srules-comp_code.
cobl-saknr = srules-gl_account.
cobl-prctr = srules-profit_ctr.
cobl-kostl = srules-costcenter. "here iam getting the cost center value
cobl-aufnr = srules-orderid.
CALL FUNCTION 'CJPN_EXTERN_TO_INTERN_CONV'
EXPORTING
ext_num = srules-wbs_element
IMPORTING
int_num = cobl-ps_psp_pnr
EXCEPTIONS
error_message = 2
OTHERS = 1.
EXIT.
ENDIF.
cobl-anln1 = srules-asset_no.
cobl-anln2 = srules-sub_number.
cobl-nplnr = srules-network.
cobl-vornr = srules-activity.
cobl-kdauf = srules-sales_ord.
cobl-kdpos = srules-s_ord_item.
cobl-kstrg = srules-cost_obj.
cobl-prznr = srules-co_busproc.
*.....get ASSIGN information in IT_DFTAB
CLEAR konty.
CALL FUNCTION 'K_DEFAULT_RULE_READ' "this FM reads the fields and assining to the lt_dftab
EXPORTING
dfreg = 'BAP'
obart = 'OR'
i_cobl = cobl
IMPORTING
e_konty = konty
TABLES
dftab = it_dftab "iam not getting the costcenter[kostl] field..
EXCEPTIONS
error_message = 2
OTHERS = 1.
IF ( sy-subrc <> 0 ).
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING error_occurred.
flg_leave = 'X'.
EXIT.
ENDIF.
Based on lt_dftab fields. K_POSTING_RULE_INSERT f.m willbe insert the values.prob with costcenter.
Edited by: balaji kiran on Apr 14, 2010 7:55 AM
Edited by: balaji kiran on Apr 14, 2010 7:57 AMHi,
Could you explain how you did it?
-Thanks -
Hello Experts,
I need to create settlement rule for work order.
Got one FM K_ORDER_SRULE_ADD but don't know how to use it.
Is this FM correct one to create settlement rule?
Can anyone please send sample code for FM?
Thanks in Advance,
Ripal.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 -
Problem with Settelment Rule for iw32
Hi,
Good day guys
Iam getting the problem while creating the settelment rule creation. Ive got a problem with " wa_srules-SOURCE = '1' ".
If i wont fill this field, settelment rule is going to be created. but i need to fill this field as per requirement.
Ive got a error message "Enter an Existing source assingment for souce stracutre CS.
Plz any one guide me, how to overcome this prob
DATA: srules TYPE srules_ext OCCURS 0,
wa_srules TYPE srules_ext,
lv_mandt type SYMANDT.
DATA IT_OBJNR TYPE STANDARD TABLE OF IONRB WITH HEADER LINE.
DATA: ls_copadata type BAPI_COPA_DATA occurs 0.
DATA: ls_cobrb type standard table of cobrb with header line.
IT_OBJNR-OBJNR = CAUFVD_IMP-OBJNR.
APPEND IT_OBJNR.
break-point.
CALL FUNCTION 'K_SRULE_PRE_READ'
EXPORTING
I_PFLEGE = ' '
TABLES
T_SENDER_OBJNR = IT_OBJNR
* T_COBRA =
EXCEPTIONS
WRONG_PARAMETERS = 1
OTHERS = 2
CALL FUNCTION 'K_SETTLEMENT_RULE_EXISTENCE'
EXPORTING
objnr = caufvd_imp-objnr
* FLG_LOCAL = ' '
* IMPORTING
* E_COBRA =
EXCEPTIONS
RULE_NOT_FOUND = 1
OTHERS = 2
CALL FUNCTION 'K_SRULE_CREATE'
EXPORTING
i_objnr = caufvd_imp-objnr
* I_CHECK_ONLY_LOCAL = ' '
* IMPORTING
* E_COBRA =
EXCEPTIONS
rule_already_exists = 1
OTHERS = 2.
wa_srules-SOURCE = '1'.
wa_srules-settl_type = 'FUL'.
wa_srules-percentage = '100'.
*wa_srules-amount = ''.
wa_srules-COMP_CODE = caufvd_imp-bukrs.
*wa_srules-PROFIT_CTR = caufvd_imp-PRCTR.
*wa_srules-costcenter = caufvd_imp-kostl.
wa_srules-costcenter = '10-60'.
APPEND wa_srules TO srules.
wa_srules-SOURCE = '1'.
wa_srules-settl_type = 'PER'.
wa_srules-percentage = '100'.
*wa_srules-amount = ''.
wa_srules-COMP_CODE = caufvd_imp-bukrs.
*wa_srules-PROFIT_CTR = caufvd_imp-PRCTR.
*wa_srules-costcenter = caufvd_imp-kostl.
wa_srules-costcenter = '10-60'.
APPEND wa_srules TO srules.
CALL FUNCTION 'K_ORDER_SRULE_ADD'
EXPORTING
object_no = caufvd_imp-objnr
* IMPORTING
* FLG_RULE_INSERTED =
tables
srules = srules
IF sy-subrc = 0.
commit work.
Endif
Regards
Edited by: balaji kiran on Mar 26, 2010 10:18 AMHello Vitaliy,
Nice to "see" you here
I did try remodelling and it works fine here. A constant value rule really gets a constant value.
The user exit option also works fine here. Here's an example of a very simple user exit for a KF:
method IF_RSCNV_EXIT~EXIT.
FIELD-SYMBOLS: <l_s_old> TYPE ANY,
<l_fillfield> TYPE ANY,
<l_newfield> TYPE ANY,
<fs_kfsource> type any.
* Assign the references to field symbols
ASSIGN c_r_newfield->* TO <l_newfield>.
ASSIGN i_r_old->* TO <l_s_old>.
* We will use the value of the 0AMOUNT KF. The value of the new KF is 0AMOUNT + 5.
ASSIGN COMPONENT 'AMOUNT' OF STRUCTURE <l_s_old> TO <fs_kfsource>.
<l_newfield> = <fs_kfsource> + 5.
endmethod.
For a KF, you can check the fields of the FACT Table (/BIx/Fzzzz) to know the field names for your source KFs.
Hope this helps. -
Exit/BADI for creating settlement rules in IW32 upon release of order
I need settlement rules to be populated in IW32 when an order is released.
The data for the settlement rules population will be obtained from a Z table based on Order type and Maintenance Activity Type.
I am not able to find out a suitable BADI/EXIT to fulfill this requirement. Has anybody worked on this kind of requirement earlier? Please suggest an EXIT/BADI/BTE for this.
Thanks in Advance!!Hi Harveen,
How did you populate the fields in K_ORDER_SRULE_ADD. Which ones did you populate. I keep getting an error message.
Receiver categ. is not allowed by settlement prof. PM0001 for this sender
Message no. KD031 Diagnosis The settlement profile specifies which receiver
categories you can settle a sender to. Receiver category is not allowed by
settlement profile PM0001 for this sender.
Procedure
You can do the following:
Assign a settlement profile to the sender, that implements the
required receiver category .
Choose "Goto -> Settlement Parameters".
Specify another receiver for distribution rule 009. If you already
used this rule for a previous settlement, enter a valid-to period. Then
enter a new rule for the next settlement with a receiver category. This
category must be one that is allowed by settlement profile PM0001.
Procedure for System Administration
If necessary, maintain a suitable settlement profile.
Would very much appreciate your help.
Cheers
Eunice
Maybe you are looking for
-
How to get the destination path in an photoshop sdk export plugin when using a batch action?
Hello, I've written an exporter plugin (not save-as) that exports a given file to a custom format. I was able to open a file selector dialog and choose a path that is then transported to the saving location. Now my problem is: Another intended use is
-
What's the coolest, slickest way to present multiple ALV reports?
Greetings and good day, everyone. Okay, I'm working on an update program, and the users have identified at least three different reports they would like coming out of this thing. One report is a list of transactions that fail internal logic checking
-
Save as PDF from IE loses images
Hello, I am dealing with a problem. I have Acrobat XI installed. I can open a letter in Internet explorer. This letter contains about 12 images. When I try to print the letter I chose Adobe PDF so it saves as PDF. Now the problem, when the letter is
-
HT1937 Use iphone 5 two different carriers one in U.S. other in CR?
I am getting a iphone 5 for sprint. Can i sue the simms card when in Costa Rica with their system without spirnt charg? I currently have a GMS phone for CR but want to use the iphone 5 instead. Can I switch between carriers as it appears to say on pa
-
I downloaded an app from the mac app store earlier called disk diag which was very good and told me that i had 127.64gb in my trash so i deleted it, it then deleted all my trash but left 57 applications in there. whenever i tried to empty my trash be