Check on Settlement Rule in IW31

Hi,
I have to keep check on Settlement Rule in IW31. i have to compare the first four characters of Settlement rule with that of Planning Plant. If both are not equal an error message should be raised.
For example Settlement Rule--->1600009  and if plant = 1500 an error message should be raised.
Please suggest any suitable BADI or User Exit for this. I have tried many options like CL_EXITHANDLER  for BADIs. But the tables in them are not giving both Plant and Cost Center(Settlement Rule) values.
Please help.
Thanks
K Srinivas

Have a look at  exit IWO10009
* get settlement rules from ABAP memory
  call function 'K_SETTLEMENT_RULE_GET'
    exporting
      objnr     = p_caufvd_imp-objnr
      x_all     = ' '
    tables
      e_cobra   = lt_cobra
      e_cobrb   = lt_cobrb
    exceptions
      not_found = 1
      others    = 2.
  if not sy-subrc = 0.
* if not found, then go to database for settlement rules
    call function 'K_SRULE_READ_ARCHIVE'
      exporting
        i_archive_handle1 = 0
        i_objnr          = p_caufvd_imp-objnr
        i_append         = ' '
      tables
        t_cobra          = lt_cobra
        t_cobrb          = lt_cobrb
      exceptions
        not_enough_info  = 1
        others           = 2.
  endif.
Make the validations you need.
Hope it helps, saludos!

Similar Messages

  • Inserting PO and Item fileds in settlement rule in IW31/32/33

    Hi ,
    My requirement is as follows:
    I want to store a PO and PO Item to a CS Order (IW31/32/33) in Settlement rule screen  exclusively.
    I came to know that it is not possible to associate a purchase Order through configuration.
    Plz suggest the possible Enhancement / exits/BADIs or any other methd for inserting a PO and Item field in settlement rule in transaction IW32.

    Hi,
    I am unable to attach the Screen Shot for your refrence, Here SCN is not supporting me .
    So i have send you the Code:
    I created ztable name ZPM_TABLE
    with fields ZEBELN
                      ZEQUNR
                      ZTPLNR
    In which PO No Equipment No and Functional Location Data is stored..
    Then in Exit IWOC0003..
    I written Code to fetch the Po Vendor Details  for that particular Equipment No or Functional Location Value as follows :
    Please Note :
    In My Code I have used Submit Program Name to get the Po Item Values :
    Code as Follows:
    { if sy-tcode eq 'IW21' or
       sy-tcode eq  'IW31'.
    tables : ekko,
             lfa1,
             adrc,
             t005u,
             t005t,
             zpm_table.
    data : wa_lfa1 like lfa1 occurs 0 with header line,
           it_lfa1 like lfa1 occurs 0 with header line,
           wa_popup like zpm_table occurs 0 with header line,
           it_ekko like ekko occurs 0 with header line,
           wa_adrc like adrc occurs 0 with header line,
           po_serv type zpo_service1 with header line.
          it_ser  type zpo_service1 with header line.
    *data : text_val type string.
    data : begin of it_popup occurs 0,
           po_no like ekko-ebeln,
           po_no1 like ekko-ebeln,
           lifnr like lfa1-lifnr,
           name1 like lfa1-name1,
           mobile like lfa1-telf2,
           street1 like adrc-str_suppl1,
           street2 like adrc-str_suppl2,
           street like adrc-street,
           pin    like  adrc-post_code1,
           tel    like adrc-tel_number,
           fax    like adrc-fax_number,
           ext    like adrc-tel_extens,
           country like  t005t-landx,
           po_text(100) type c,
           end of it_popup.
    data : begin of it_ser occurs 0,
          extrow type string,
          SRVPOS type string,
          KTEXT1 type string,
           menge  type esll-menge ,
           meins  type esll-meins,
           netwr  type esll-netwr,
           end of it_ser.
    data : scrn_popup like it_popup occurs 0 with header line.
    data: po type string,
           text_val type string,
          ven_add type string,
          ven_no type string,
          ven_name type string,
           antwort(1) type c,
           answer(1) type c,
           choise type sy-tabix,
          text1 type  string.
    data: l_answer like sy-input.
    if i_equnr  is not initial.                           "here I_equnr is the Equipment No which flows in the Screen .
      select * from zpm_table into
               corresponding fields of table wa_popup
               where zequnr = i_equnr.
    elseif  i_equnr is not initial and i_tplnr  is not initial. "here I_tplnr is the FL No which flows in the Screen .
      clear : wa_popup.
      select * from zpm_table into
               corresponding fields of table wa_popup
               where zequnr = i_equnr and
                     ztplnr = i_tplnr.
    elseif i_tplnr is not initial.
      clear : wa_popup.
      select * from zpm_table into
               corresponding fields of table wa_popup
               where ztplnr = i_tplnr.
    endif.
    if wa_popup[] is not initial.
      read table wa_popup.
      select ebeln lifnr from ekko
        into corresponding fields of table it_ekko
        where ebeln = wa_popup-zebeln.
      if it_ekko[] is not initial.
        select * from lfa1 into
          corresponding fields of table wa_lfa1
          for all entries in it_ekko
          where lifnr = it_ekko-lifnr.
      endif.
    *endloop.
      loop at wa_lfa1 . "into it_lfa1 WITH TABLE KEY lifnr = it_ekko-lifnr.
        select * from adrc into
          corresponding fields of table wa_adrc
          where addrnumber = wa_lfa1-adrnr.
        data:wa_t005u type t005u occurs 0 with header line.
        select * from t005u into
              corresponding fields of table wa_t005u
                      where spras = 'EN'
                      and land1 = wa_adrc-country
                      and bland = wa_adrc-region.
        data:wa_t005t type t005t occurs 0 with header line.
        select * from t005t into
           corresponding fields of table wa_t005t
                    where spras = 'EN'
                    and land1 = wa_adrc-country.
        it_popup-po_no = wa_popup-zebeln.
        it_popup-lifnr  = wa_lfa1-lifnr.
        it_popup-name1  = wa_lfa1-name1.
        it_popup-mobile  = wa_lfa1-telf2.
        read table wa_adrc index 1.
        it_popup-street1 = wa_adrc-str_suppl1.
        it_popup-street2 = wa_adrc-str_suppl2.
        it_popup-street  = wa_adrc-street.
        it_popup-pin     =  wa_adrc-post_code1.
        it_popup-tel     = wa_adrc-tel_number.
        it_popup-fax     = wa_adrc-fax_number.
        it_popup-ext     = wa_adrc-tel_extens.
        it_popup-country = wa_t005t-landx.
        append it_popup.
      endloop.
      text1 =  'This Equip/Func.Location is Maintained or Service is undertaken by'.
      concatenate  'Vendor No      :  ' it_popup-lifnr
                   into ven_no  .
      concatenate  'Vendor Name   :   ' it_popup-name1
                   into ven_name  .
      concatenate it_popup-street1
                  it_popup-street2
                  it_popup-street
                  it_popup-pin
                  it_popup-country
                 'Mob:' it_popup-mobile
                 'Tel:' it_popup-tel '-' it_popup-ext
                      into ven_add  separated by space.
      concatenate  'Please Refer this PO No. :   ' it_popup-po_no
                   into po  .
    message 'Warning!!!' type 'I'.
      Function Module for Pop Up *
      call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'
      exporting
    DEFAULTOPTION = 'Y'
       diagnosetext1 = text1
       diagnosetext2 = ven_no
       diagnosetext3 = ven_name
       textline1 = ven_add
       textline2 = po
       titel = 'Warning!!!'
    START_COLUMN = 25
    START_ROW = 6
        cancel_display = 'X'
       importing
        answer =  antwort.
      " Area for option Yes or No "" .  
      if antwort = 'J'.
        if it_popup-po_no is not initial.                      " Please Note here im checking for PO No
          export it_popup-po_no to memory id 'Memo1'.  "Po No is exported to another Program there i coded for Po items
          submit zpm_po_services and return.
        endif.
      else.
    *call TRANSACTION 'iw21'.
        call transaction 'IW21' and skip first screen.
      endif.
    endif. " End of  Total itab value/
    else.
    exit.
    endif.     }
    This is the Code for zpm_po_services
    For any Clarification Revert Back..
    With Regards,
    Vinu.R

  • Settlement order in iw31 / iw32

    Hi all,
    I am working on work order validation during release.
    Using iw31/iw32, without selecting release button or additional data ;i am not able to get details of Settlement rule for a work order.
                My requirement is to check this settlement rule before saving the work order.Since settlement rule is generated and saved in table COBRB only if i select RELEASE , i am not able to check the work order if it is not released. Kindly provide me a solution for the same.
    Anil..

    Hi,
    Search is there any BADI/USER EXIT which triggering before clicking save button.
    Hope this helps u.
    thanks.

  • Delet the settlement rule

    hi 
    How to delet the settlement rule , after realease project.
    if i check in settlement rule for Activity it will show all option in disply mode .
    thanks
    sunil

    Has settlement from the Network Activity already ran?
    On the settlement rule line ....check the values in the First Used & Last Used fields
    If both of these are not blank, then settlement has already ran.
    To delete you would need to undo each run of settlement to remove the date.
    If in Production this is probably not an option. Therefore you will need to end the existing settlement rule with an end date in end period & year.
    Then create new settlement rule.
    If both First Used and Last used are blank then I would try entering /SU53 into the command field to check for missing authorisations.
    I am automatically generating settlement rules from Activity to parent WBS and have no problem changing or deleting the settlement rule prior to settlement running.
    Steve

  • Determine settlement rule application

    Hi Folks!
    I'm trying to find out how can you determine when a settlement rule has been applied to an element from a PS project.
    I've tried researching on table COBRB but I haven't found any difference between an element that has a settlement rule applied and one that hasn't. Initially I thought that with the field Konty would do the trick, but I realized it won't work because in an element that has not been applied and in one that has been applied they are the same konty. Other thing is that I don't get why they are registers on the table for elements that no settlement rule have been applied on this table.
    I will appreciate any help.
    Thanks in advise.
    Regards,
    Gilberto Li

    Hi,
    You can use function module K_SETTLEMENT_RULE_EXISTENCE for it.It requires a import parameter which can be obtained from PRPS table corresponding to a WBS element.
    Even you can directly refer the table COBRA for checking the settlement rule existance.
    Hope this helps you.
    Thank you.
    Regards,
    M.Karun.

  • Badi for IW31 to keep check on Funds Center and Settlement rule

    Hi,
    My requirement is that While running IW31,if the first four characters of Settlement Rule(Cost Center) and FundsCenter is not equal to Planning Plant then an error message should be raised . Can you suggest any appropriate BADI or User Exit for this?
    Path for Funds Center-->Go to>Assignment--->Funds Management
    Thanks
    K Srinivas

    Hii Srinivas,
    Did you find any solution for this, i am also encountering the same problem.
    Regards,
    meenakshi

  • How can I make settlement rule mandatory in create work order (IW31)

    How can I make settlement rule mandatory in create workorder and saving without release.
    I kanow we can make settlement rule mandatory upon Release order but here requirement is
    Create work order (IW21) save without releasing that time settlement rule should default.

    Hi,
    1.If you want the settlement rule default then maintain account assignment data in technical object and when MO is created on that it would be copied into the settlement rule...
    2. If you want to make those fields mandatory .... plz check up field selections in config , if you cannot find those then use SHD0 Transaction variant to make those fields mandatory.
    3. Enter SHD0 , Enter IW31 in transaction and ZIW31 for transaction variant ..click create option and this takes you to IW31 initial screen , here enter required values of technical object etc and press enter and this gives you IW31 Initial scree screen variant , click continue and this takes you to inside screen and here enter required field values and on pressing enter gives you screen variant .. so you need to enter field values and check the flow of screen variants and on getting settlement rule screen variant select required option for the fields you need.
    4. Finally you can save that in package created in SE80 for transporting to other client .., you can activate the variant in SHD0 -->Standard variants -->you can find activate option ..
    regrds
    pushpa

  • Problem in Settlement Receiver during Settlement Rule in T.code IW31/32

    Hi,
    We have created an Equipment Number 11001212 with Business Area 1451 / Cost center 145130100. After that when are create Order in respect to that Equipment Number through IW31.
    During Settlement Rule, when we select Account assignment category CTR - Cost Center...and press F4 on Settlement Receiver column, it shows the value in respect to all Cost Centers. 
    We want that in settlement receiver column, values should show in respect to related cost center. (defined as per Equipment Master).
    Please guide...

    Hi,
    Pass the Order number in AFIH to get Equipment Number (EQUNR) value.
    Pass the Equipment No in V_EQUI table with Valid to date (DATBI) as 31.12.999 & get the value of ILOAN value.
    Pass this value in ITOB table & get Cost Center KOSTL value.
    In IWO10027 user exit, in F4 possible entry option, ABAP people can restrict the required cost center.
    IWO10009 PM Order: Customer Check for 'Save' Event
    Even though the user enters manually some other cost center without going for F4 option, by check that value, you can give the error message, while saving the order.
    Pass the Order number in AUFK table to get Object Number (OBJNR).
    Pass OBJNR value in COBRB table to get KOSTL value.
    Compare both the value & you can give the error message.
    Give these tables, fields & user exits to ABAP people. They can form the correct logic.
    Incorporate both the logic.
    Regards,
    Maheswaran.

  • Check settlement rule at save WBS

    Hi guys,
    I have a question and I'd very thankful if someone answered me.
    I would need create a validation in the at save on CJ20N transaction. This validation should check settlement rule ( Really is need that checks fixed asset in the settlement rule).
    We are usign this BADI WORKBREAKDOWN_UPDATE and the method AT SAVE, is this possible to check in this BADI :
    1. WBS status ( current status, not information stored in JEST table)
    2.  and check that WBS division is the same as Fixed asset division ( ANLA) , being fixed asset the reciver in the WBS settlement rule. ????
    really our problem is that we are not sure how to retrieve information at this point  from another tables different from PROJ, PRPS,  RCJ_PRPSUP and SYST.
    Thank you!!!!

    Hi Muralidhar!!!!
    Thank you very much for your reply!!! We are trying to use that BAPI for check WBS status before it is saved.
    Related to settlement rule information our problem is we don't know how obtain information from another table different from PROJ, PRPS, ....in this BADI, ( really is a technical question). We are creating a WBS ( which it has not be saved yet), settlement rule information is going to be saved in COBRA and COBRB but it is not yet.
    Do you know how do I have to program it in order to obtain this information?
    Thanks a lot!!!
    Sara

  • Settlement rules in transaction IW31

    Hi gurus,
    Here is the requirement.
    After going into transaction IW31, we usually create settlement rules using the separate icon for that on the IW31 screen.
    Instead of that is it possible to create settlement rules either when we release the order or when we save the the order? The settlement rules has to be created automatically. Is it possible using user exits or BADIs?
    Thanks
    Nobz

    Customizing
    Plant Maintenance and Customer Service->Maintenance and Service Processing->
    Maintenance and Service Orders->Functions and Settings for Order Types->
    Settlement Rule: Define Time and Creation of Distribution Rule->
    Order type + 1 Mandatory for release
    ================================================================================
    CMOD - Enhancement: IWO10027 User exit: Generate user-defined settlement rule
    Example
    *&  Include           ZXWOCU24                                         *
      data char24(24).
      CLEAR pmdfu_tab.
      REFRESH pmdfu_tab[].
      pmdfu_tab-konty = 'PR'.
      pmdfu_tab-fdind = caufvd_imp-pspel.
      pmdfu_tab-perbz = 'PER'.
      pmdfu_tab-prozs = 100.
      APPEND pmdfu_tab.
      CLEAR pmdfu_tab.
      pmdfu_tab-konty = 'PR'.
      pmdfu_tab-fdind = caufvd_imp-pspel.
      pmdfu_tab-perbz = 'GES'.
      pmdfu_tab-prozs = 100.
      APPEND pmdfu_tab.
      CLEAR pmdfu_tab.

  • Validate Settlement Rule for Transaction IW32 / IW31

    Hi All,
    I want to validate Settlement Rule for trx IW31 and IW32. When someone tries to create Settlement rule for cost center, I have to validate that cost center against some criteria.
    Do anyone know any BADI or user-exit for this?
    I tried user-exit IWO10027 but it did not get triggered.
    Appreciate your help!
    Thanks,
    Chirag

    Hello ,
    As i just tried the above BADI . But when it is triggered  . It should trigger at the time of release icon.
    BIt it didn't . Can you please help when it is trigger  ?

  • Iw31 auto settlement rule creation

    Hi
    We have to create sett rules for Maint orders automatically based on additional data tab either wbs or cc.
    The rules are created fine if the order is assigned to an object (ie Functional location with wbs or cc) with the maint order.  But if the maint order is not assigned to a FL without a wbs or cc, the automatic settl. rule creation with default is not created. 
    I would like not to assign a wbs or cc to the FL since the maint orders will be generated from one FL but could be settled to sevral wbs/cc.

    Hi ,
    The requirement cannot be met through standard behaviour of the system , for your requirement you will have to go for the below mentioned user Exit .
    Go to SMOD and give the name of the enhancement as IWO10027
    In the components you will find the fucntion module - EXIT_SAPLCOI1_027 , which will serve the prupose that you are looking for .
    Regards ,
    Dewang .

  • Can User Exit works for Settlement Rule in Maintenance Order creation?

    Dear Experts,
    I have this situation where I tried to create an Internal Maintenance Order via IW31 for multiple equipments from different functional location (different cost centers) using the Object List.  However, the settlement rule has a problem to pull out as there's no Equipment in the reference object. That's the reason, I'm looking at the User Exit which I understand the IWO10027, can do the work.  Since I'm new to User Exit, can I enhance the settlement rule by the following condition.
    The costs spent on each equipment will be used as a basis of calculating the weightage (via equivalence no) for the settlement rule.
    Can it be done that way?
    regards,
    Abraham

    Sanjay,
    This data can be checked in the following user-exits:
    COZF0001: Change purchase req. for externally processed operation
    COZF0002: Change purchase req. for externally procured component
    PeteA

  • How to Make Settlement Rule Mandatory in Sales Order(In Acct Assigt Tab)

    Hi Gurus,
    I have a business requirement. For Free of charge 3rd party orders (yes they have FOC orders delivered by third party) the business wants to ensure that the Settlement rule should be mandatory. They enter cost center & receiver in the settlement rule.
    i.e the order should not save till Settlement rule is maintained in the line item in the Acct Assignment tab.
    Please let me know how this can be done.
    1: Applied my brains on incompletion procedure but does not seems like it can be done there.
    2: Is there something in CO where some setting can make it mandatory to enter settlement rule in Sales order?
    3: I s there any other way in user-exits or ABAP?
    4: Is there any setting in Item category(I could not locate any)?
    5: Can this be done via Requirement class.
    Please assist to resolve this one.

    Dear,
    It depends on settings in Requirement Class (OVZG) and Account Assignment Catg (AAC) in OME9
    If your AAC is E in Req Class, then your sales order is a CO object.
    Requirement Class in IMG can be checked - IMG > Controling > Prod Cost Planning > Cost Obj Controling > Prod Cost By Sales Order > Control of Requirement.
    Or any filed any you can Make mandatory through Transaction variant SHD0.

  • Settlement Rule

    Can anyone please advise on the following.
    We have a project (WBS) created that has a settlement rule just for AUC in 07/08, was settled in both 07/08 and 08/09 with automatic settlement. We know want to add a rule for full settlement to transfer it to a GL. We are receiveing an error message to say system does not support this for previous years postings???

    Hi Jamie,
    Please, check this node:
    Re: First settle items from the previous year in the previous year
    There must be also an OSS note mentioned in the same thread.
    BR
    Paulo

Maybe you are looking for