Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Generate settlement rules

Former Member
0 Likes
2,761

Hi,

I am looking for SAP code to generate default settlement rules from extension IWO10027. From there i will be able to change some fields values in relation with a customer table.

Help required.

Regards

7 REPLIES 7
Read only

Former Member
0 Likes
1,462

Re: Generate settlement rules

Posted: Mar 10, 2006 9:46 AM Reply

Hello Daniel,

This reply is probably too late, however I have had success generating default settlement rules for Cost Centers, WBS Elements and Internal Orders. The documentation in SMOD for IW10027 is pretty good and worked for me.

In the example below, the user enters the required receiver (eg. Cost Center or WBS Element or Internal Order) in the applicable account assignment field on the PM order (using TCode IW31 or IW32). These values are passed to the exit in parameter CAUFVD_IMP. The user exit IWO10027 is invoked when the order is released or when you choose menu Goto > Maintain Settlement Rule >> with default. Here are the key pieces of code..hope this was helpful. As a note, in the documentation where it says only certain account assignment categories are supported, believe it (eg. so far I've had no luck generating a settlement rule for a network activity, but I'm working on it).

&----


*& Include ZXWOCU24

&----


call function 'ZPM_CREATE_SETTLEMENT_RULE'

exporting

caufvd_imp = caufvd_imp

tables

pmdfu_tab = pmdfu_tab.

function zpm_create_settlement_rule.

*"----


*"Local interface:

*" IMPORTING

*" REFERENCE(CAUFVD_IMP) LIKE CAUFVD STRUCTURE CAUFVD

*" TABLES

*" PMDFU_TAB STRUCTURE PMDFU OPTIONAL

*"----


  • Reject if more than one account assignment object specified..

if caufvd_imp-kostl is not initial. "cost center

add 1 to object_count.

endif.

if caufvd_imp-iaufnr is not initial. "order

add 1 to object_count.

endif.

if caufvd_imp-proid is not initial. "wbs element

add 1 to object_count.

endif.

if object_count > 1.

message e002(zpm).

endif.

  • Reject if no account assignment object specified..

if object_count = 0.

message e003(zpm).

endif.

  • Create default settlement rule according to account assignment..

if pmdfu_tab[] is not initial.

message i000(zpm) with

'Existing settlement rule(s) will be overwritten..'.

endif.

refresh pmdfu_tab. "delete any existing rules..

clear pmdfu_tab.

  • Settle to Cost Center..

if caufvd_imp-kostl is not initial.

message s000(zpm) with

'Settlement Receiver = Cost Center'.

pmdfu_tab-konty = 'CTR'.

pmdfu_tab-fdind = caufvd_imp-kostl.

pmdfu_tab-perbz = 'GES'. "GES = Full,

"ref. TKB8A-PERBZ

pmdfu_tab-prozs = '100'.

append pmdfu_tab.

  • Settle to WBS Element..

elseif caufvd_imp-proid is not initial.

message s000(zpm) with

'Settlement Receiver = WBS Element'.

pmdfu_tab-konty = 'PR'. "means 'WBS'

pmdfu_tab-fdind = caufvd_imp-proid.

pmdfu_tab-perbz = 'GES'. "GES = Full

pmdfu_tab-prozs = '100'.

append pmdfu_tab.

  • Settle to an Order..

elseif caufvd_imp-iaufnr is not initial.

message s000(zpm) with

'Settlement Receiver = Internal Order'.

pmdfu_tab-konty = 'ORD'.

pmdfu_tab-fdind = caufvd_imp-iaufnr.

pmdfu_tab-perbz = 'GES'. "GES = Full

pmdfu_tab-prozs = '100'.

append pmdfu_tab.

endif.

Read only

0 Likes
1,462

hi it this work very good but:

I have a question

if I don't have Settlement percentage rate

I have Amount for amount rule.

who pass this Amount in the EXIT

Read only

0 Likes
1,462

Hi Sharon,

Even i am also having the same requirement. I have copied the code what u have given in the thread in the enhancement but it is not triggering. Could you help me on this.

Regards,

Zakir

Read only

elalan
Participant
0 Likes
1,462

hi , can anybody help me with this , i'm trying to use that exit but i doesn't stop there if i put a breakpoint , and everything is active , is ther something i'm missing ?

Read only

Former Member
0 Likes
1,462

Hi,

The same thing happens to me if i put a breakpoint , and everything is active.

Read only

Former Member
0 Likes
1,462

Hi Adil,

Did you set an external breakpoint? And did you turn 'update debugging' in the debugger settings on?

Then it should stop in the user-exit.

Kind regards,

Benjamin

Read only

Former Member
0 Likes
1,462

Hi Benjimin,

Thanks for your reply.. i tried with external break point and update debugging but not triggered.

I wrote above code for 'Settlement Receiver = Cost Center'. in 'Include ZXWOCU24' 

but not working..