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.

Similar Messages

  • 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  ?

  • 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

  • Automatic creation of  settlement rule while creating sales order

    Hi Friends,
    Can any one help me how to create settlement rule automatically while creating sales order i.e saving sales order. Is there any function module or any badi which can be used.. please suggest.
    thanks
    bobby

    Hi,
    Here is the solution , First Create a sustitution by going into OPSN Transaction , only user exit say 'U902'
    and write the form routine in Program named 'ZRGGBS000'
    The code is below ,
    *&      Form  U902
       Automatic Generation of Settlement Rule For WBS and Company 4180
    FORM u902.
    Exit For Automatic Settlement Rule Creation for WBS Billing elements
      IF sy-tcode = 'CJ20N' or sy-tcode = 'CJ01' or sy-tcode = 'CJ02'.
        DATA   lv_proj TYPE ps_pspid.
        lv_proj = proj-pspid.
        EXPORT lv_proj TO MEMORY ID 'PSPID'.
    Calling YGPS_CJB1EXEC Program For Creating Settlement Rule
        SUBMIT ygps_cjb1exec AND RETURN.
      ENDIF.
    ENDFORM.                                                    "u902
    *& Program  YGPS_CJB1EXEC
    PROGRAM  ygps_cjb1exec.
       Automatic Generation of Settlement Rule For WBS and Company 4180
    Called From Exit For Automatic Settlement Rule Creation for WBS Billing elements
    DATA: bdcdata_wa  TYPE bdcdata,
          bdcdata_tab TYPE TABLE OF bdcdata,
          itab TYPE TABLE OF bdcmsgcoll.
    DATA :lv_currm LIKE bkpf-monat,
          lv_curry LIKE bkpf-gjahr,
          lv_prevm LIKE bkpf-monat,
          lv_prevy LIKE bkpf-gjahr,
          lv_proj TYPE ps_pspid,
          lv_mode TYPE c,
          lv_time TYPE sy-uzeit.
    DATA :g_datfm            LIKE usr01-datfm,
          g_dd(2)            TYPE c,                         " Day
          g_mm(2)            TYPE c,                         " Month
          g_yyyy(4)          TYPE c,                         " Year
          g_sydatum(10)      TYPE c.
    IMPORT lv_proj FROM MEMORY ID 'PSPID'.
    lv_mode = 'N'.
    CLEAR bdcdata_wa.
    bdcdata_wa-program  = 'SAPLKAZB'.
    bdcdata_wa-dynpro   = '1000'.
    bdcdata_wa-dynbegin = 'X'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_CURSOR'.
    bdcdata_wa-fval = 'PRZB-VARIANT'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'PRZB-VARIANT'.
    bdcdata_wa-fval = 'ZGPS0001'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CALL FUNCTION 'GET_CURRENT_YEAR'
      EXPORTING
        bukrs = '4180'
      IMPORTING
        currm = lv_currm
        curry = lv_curry
        prevm = lv_prevm
        prevy = lv_prevy.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'RKAUF-FROM'.
    bdcdata_wa-fval = lv_currm.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'RKAUF-GJAHR'.
    bdcdata_wa-fval = lv_curry.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = '=VARC'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-program  = 'RKPSEL00'.
    bdcdata_wa-dynpro   = '1000'.
    bdcdata_wa-dynbegin = 'X'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_CURSOR'.
    bdcdata_wa-fval = 'CN_PROJN-LOW'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'CN_PROJN-LOW'.
    bdcdata_wa-fval = lv_proj.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'CN_PSPNR-LOW'.
    bdcdata_wa-fval = space.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'CN_NETNR-LOW'.
    bdcdata_wa-fval = space.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'CN_ACTVT-LOW'.
    bdcdata_wa-fval = space.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'CN_MATNR-LOW'.
    bdcdata_wa-fval = space.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = '/00'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = '=SAVE'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = '=VBAC'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-program  = 'SAPLSPO1'.
    bdcdata_wa-dynpro   = '0100'.
    bdcdata_wa-dynbegin = 'X'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = '=YES'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-program  = 'SAPLKAZB'.
    bdcdata_wa-dynpro   = '1000'.
    bdcdata_wa-dynbegin = 'X'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'RKAUF-BATCH'.
    bdcdata_wa-fval = 'X'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'RKAUF-TEST'.
    bdcdata_wa-fval = space.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = '=RUN'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-program  = 'SAPLKABA'.
    bdcdata_wa-dynpro   = '0210'.
    bdcdata_wa-dynbegin = 'X'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'KABA01-JNAME'.
    bdcdata_wa-fval = 'CJB1_EXEC'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_SUBSCR'.
    bdcdata_wa-fval = 'SAPLKABA'.
    APPEND bdcdata_wa TO bdcdata_tab.
    Extract the date format from the user settings
    PERFORM f_get_dateformat CHANGING g_datfm.
    Changing the current date format to User Profile Date Settings
    PERFORM f_format_date USING   g_datfm
                                  sy-datum+4(2)
                                  sy-datum+6(2)
                                  sy-datum+0(4)
                         CHANGING g_sydatum.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'KABA01-STDAY'.
    bdcdata_wa-fval = g_sydatum.
    APPEND bdcdata_wa TO bdcdata_tab.
    lv_time = sy-uzeit  + 30.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'KABA01-STTME'.
    bdcdata_wa-fval = lv_time.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'KABA01-PRIKZ'.
    bdcdata_wa-fval = space.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = '=TAKE'.
    APPEND bdcdata_wa TO bdcdata_tab.
    Calling Transaction 'CJB1' for creating settlement rule
    CALL TRANSACTION 'CJB1'  USING bdcdata_tab MODE lv_mode .
    IF sy-subrc = 0.
    ENDIF.
    *&      Form  F_GET_DATEFORMAT
          This subroutine returns the date format in the user setttigs
         <--P_G_DATFM  Date Format
    FORM f_get_dateformat CHANGING p_g_datfm.                   "#EC *
      SELECT SINGLE datfm FROM usr01 INTO p_g_datfm
      WHERE bname = sy-uname.
    ENDFORM.                    " F_GET_DATEFORMAT
    *&      Form  F_FORMAT_DATE
          This subroutine returns the date as per the user settings
         -->P_G_DATFM  Date Format
         -->P_G_MM  Month
         -->P_G_DD  Day
         -->P_G_YYYY  Year
         <--P_G_DATE  Date
    FORM f_format_date USING    p_g_datfm
                                p_g_mm
                                p_g_dd
                                p_g_yyyy
                       CHANGING p_g_date.                       "#EC *
      CONSTANTS: c_dot VALUE '.',
                 c_slash VALUE '/',
                 c_dash VALUE '-',
                 c_1 VALUE '1',
                 c_2 VALUE '2',
                 c_3 VALUE '3',
                 c_4 VALUE '4',
                 c_5 VALUE '5',
                 c_6 VALUE '6'.
      DATA: l_day(2),
            l_month(2).
      l_day = p_g_dd.
      l_month = p_g_mm.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = l_month
        IMPORTING
          output = l_month.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = l_day
        IMPORTING
          output = l_day.
      CASE p_g_datfm.
        WHEN c_1.
          CONCATENATE l_day l_month p_g_yyyy INTO p_g_date
              SEPARATED BY c_dot.
        WHEN c_2.
          CONCATENATE l_month l_day p_g_yyyy INTO p_g_date
           SEPARATED BY c_slash.
        WHEN c_3.
          CONCATENATE l_month l_day p_g_yyyy INTO p_g_date
              SEPARATED BY c_dash.
        WHEN c_4.
          CONCATENATE p_g_yyyy l_month l_day INTO p_g_date
              SEPARATED BY c_dot.
        WHEN c_5.
          CONCATENATE p_g_yyyy l_month l_day INTO p_g_date
              SEPARATED BY c_slash.
        WHEN c_6.
          CONCATENATE p_g_yyyy l_month l_day INTO p_g_date
              SEPARATED BY c_dash.
      ENDCASE.
    ENDFORM.                    " F_FORMAT_DATE
    thanks
    bobby

  • Creating Settlement Rule

    Is there any BAPI to create/change Settlement Rule?(Transaction code: KO01/KO02)
    Regards,
    Savitha

    Hi
    try with this BAPI
    BAPI_INTERNALORDER_CREATE      Create Internal Order From Transferred Data                         
    BAPI_INTERNALORDER_GETDETAIL   Display master data, status, and allowed business trans.for internal
    BAPI_INTERNALORDER_GETLIST     Display list of internal orders according to various criteria       
    Thanka manju

  • 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

  • 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!

  • 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.

  • 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

  • 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 .

  • BAPI For settlement rule for IW33 transaction

    hi,
    good day guys
    Iam searching for BAPI for iw33 for settelment rule..but i couldnt get it..
    Settlement rule is nothing but Rule that determines which portions of a sender's costs are allocated to which receivers.
    If you go to iw33 t.code.. give the order numbe and then enter..
    Go to tab--->Settlement Rule..
    plz can anyone tell me which bapi is fit for it...
    Regarsd

    hi,
    try the following BAPI
    BAPI_ALM_ORDERSRULE_CREATE
    hope this helps
    Regards
    Ritesh

  • BAPI for transaction IW31 (creating a work order)

    Hi all,
    I need to be able to create a work order ( IW31) using ABAP code and was wondering if any knew if there was a BAPI that should be used for this functionality.
    Thanks in advance
    Mart

    hi,
    You can use
    BAPI_ALM_ORDER_MAINTAIN.
    Have a look at the following documentation.
    FU BAPI_ALM_ORDER_MAINTAIN
    Text
    Process Maintenance-/Service Order
    Functionality
    This Business Application Programming Interface (BAPI) is used for changing maintenance- or service orders and their lower-level objects. The following objects of an order can be processed (for restrictions, see the note at the end of the documentation):
    Order header
    Partner
    User status
    Order operations
    Relationships
    Components
    Long texts for order header, operations, and components
    Function
    Calling up this BAPI once allows you to perform all the operations. For this the system supplies the function module with a method table containing the methods to be performed. The entries in the method table refer to data records in the optionally filled-out data tables. All the methods from the method table are performed. Alternatively, just lower- level objects from existing orders can be changed.
    You can process the transferred data with the Business Add-In (BAdI) IBAPI_ALM_ORD_MODIFY to, for example, merge data from the external system with data from the R/3 system. The BAdI is called up as soon as the transferred data is converted into the internal format. The tests then take place after this.
    Construction of Method Table
    REFNUMBER Reference number for linking object methods - attributes
    The reference number is the line of the database which contains the corresponding data. The data table is determined by the object type.
    OBJECTTYPE Object category
    The object category specifies which object from the order should be processed. The key words listed here are not language-dependent and must be transferred exactly as they are. The following objects exist:
    HEADER Order header
    PARTNER Partner data
    USERSTATUS User status
    OPERATION Operation data
    RELATION Relationships
    COMPONENT Components
    TEXT Long texts
    (empty) ,General BAPI functions (save)
    METHOD Methods
    The methods with which the data should be processed. The following functions exist:
    CREATE Create objects
    CHANGE Change objects
    DELETE Delete objects
    RELEASE Release
    TECHNICALCOMPLETE Technically complete
    ATPCHECK Availability check
    CALCULATE Calculate
    SCHEDULE Schedule
    DELELTEDSEX Delete the status for external scheduling at operation level
    SAVE Save all data
    DIALOG Call-up dialog. See explanation below.
    TRACE Write trace file in the specified file to the frontend
    OBJECTKEY SAP external object key
    This key is for assigning the lower-level objects correctly to the corresponding objects, as there is always just one key in the data table. The key must have the following structure:
    1-12 Order number
    When creating orders with internal number assignment, a reference number beginning with % must be entered here. The BAPI then returns this number and the number actually assigned.
    13-16 Operation number
    17-20 Sub-operation number
    For relationships, the key is structured as follows:
    1-12 ,Order number from
    13-16 Operation number from
    17-28 Order number to
    29-32 Operation number to
    The following methods are permissible for the individual objects:
    HEADER:
    CREATE, CHANGE, RELEASE, TECHNICALCOMPLETE, ATPCHECK, CALCUALTE, SCHEDULE
    OPERATION
    CREATE, CHANGE, DELETE, DELETEDSEX
    PARTNER, RELATION, COMPONENT, USERSTATUS, TEXT:
    CREATE, CHANGE, DELETE
    (empty):
    SAVE, DIALOG, TRACE
    Data tables and update tables
    The objects have one or more data tables. For some objects you can specify which of the fields specified in the structure should be changed. For this you must set the field in the corresponding table to X as in the data table. If no update-table is transferred, then only those fields are set that have a value that is not initial. This simplifies the transfer data. However, this means it is not possible to delete fields. If an update structure should only be specified for some data records, the table with the update fields must nonetheless have the same amount of lines as the data table. The empty lines are then treated as if no update structure was transferred. The objects "Partner", "User Status", and "Text" have no update tables. The whole data record is always copied here.
    References
    The objects use the field REFNUMBER from the method table to refer to the lines in the data table. Counting always begins with 1. In doing this, REFNUMBER also refers to the update table. However, in the method table there is a second reference to higher-level objects for lower-levels objects. The field OBJECTKEY must be filled with order number, operation number, and sub-operation number, as specified above. If lower-level objects of a newly-created order should be changed, then you must enter a temporary order number that must begin with %. Several orders can be numbered serially, for example, with %00000000001, %00000000002 ... .
    The following objects have special treatment for REFNUMBER:
    Partner
    Texts
    Partners have an order number in the data table. During processing of the method table, all those entries in the data table are processed which have an order number that is the same as that in the line to which the method refers. Thus, through just one entry in the method table, several partners can be changed.
    Texts are composed of two tables. The first table (IT_TEXT) is made up of the header data of the text. Here you must specify the object and the first and last line of the text table (respectively inclusive, counting from 1). Through this, a line segment is specified in the text line table (IT_TEXT_LINES).
    Peculiarities in processing
    The BAPI processes the transferred methods in a particular sequence, which must not correspond to the sequence in the methods table.
    Write trace file
    Change user status time period 1
    Delete objects (dependent first)
    Create new objects
    Change existing or newly-created objects
    Change user status time period 2
    Status change of order
    Save data
    The methods are performed such that lower-level objects can also be assigned to newly-created objects. For example, first the operations are created, and then the components. Long texts can also be created for the objects.
    Components have an exceptional position. Components are created through the assignment to an operation, that is, using the "key" order/ operation (item number). However, as this is not the unique component key, you can only access the components to change them, delete them, or add long texts by using the reservation number/-item, which is only given after saving. This means that, for example, you cannot create a long text when you create the component.
    User status changes can take place at two different time points. Time point 1 is before the object changes, time point 2 is after the object changes and before the status change of the system. These time points should be defined in the transfer table in the field CHANGE_EVENT. The field documentation contains the possible values.
    The external scheduling is offered by the BAPI as a special function. THe BAPI can set the date field directly at the operation level, and select the operation with the status DSEX "Date set by external system". This status prevents any further scheduling of the operation, it keeps the transferred dates. For this, set the category 'X' in the restriction categories. When reading the operation, this category is also returned, independent of the category of restriction set in the dialog. To delete the status, you can call up the method DELETEDSEX for the object operation. The external scheduling cannot be influenced in the dialog. All changes to the scheduling restrictions in the dialog are saved as normal, but are not relevant for the scheduling as long as the status DSEX is active.
    Every time the BAPI is called up, a SAVE or DIALOG method must be transferred. Normally, calling up a BAPI is seen as a transaction. All data that is changed in the BAPI should be saved to the database immediately. The BAPI checks whether a SAVE method exists, otherwise it terminates processing. A test run of the BAPI is composed of a normal call-up using the SAVE method and a subsequent BAPI_TRANSACTION_ROLLBACK. To call up the BAPI without the SAVE method, for example, to realize dialog transactions, the BAPI can be called up with the DIALOG method. This switches off the check for the SAVE method. The processor must then ensure that later either a SAVE method or a BAPI_TRANSACTION_ROLLBACK is called up.
    A BAPI_TRANSACTION_COMMIT without SAVE method terminates processing in the update to ensure that no inconsistent data is written to the database. The processor who called up the BAPI does not receive any confirmation for the termination of the update in the target system. This logic is necessary as the order data was flagged for updating with BAPI_TRANSACTION_COMMIT through the SAVE method. However, the status information was already flagged for updating when the BAPI was called up. A BAPI_TRANSACTION_COMMIT without SAVE method then just saves the status information and would generate inconsistent orders, if the updating was not terminated.
    Customer Enhancement
    The BAdI IBAPI_ALM_ORD_MODIFY can be used to change the transferred data. The BAdI is called up after the conversion of the transfer structure into the structures used internally. Additional data can be transferred using the table EXTENSION_IN. Only then is the data checked.
    Example
    The following examples should clarify the use.
    Creating an order
    OBJECTKEY should be filled with a temporary key. The BAPI returns this key together with the assigned order number in the return table ET_NUMBERS . The order number in the HEADER table should also be filled with the number. For external number assignment, the external number should be specified. The update structure can be transferred if necessary.
    Methods table
    REFNUMBER OBJECTTYPE METHOD OBJECTKEY
    1 HEADER CREATE %00000000001
    IT_HEADER
    ORDERID ORDER_TYPE PLANPLANT ...
    %00000000001 PM01 1000 ...
    Creating an order with operation and long text
    Methods table
    REFNUMBER OBJECTTYPE METHOD OBJECTKEY
    1 HEADER CREATE %00000000001
    1 OPERATION CREATE %00000000001
    1 TEXT CREATE %000000000010010
    IT_HEADER
    ORDERID ORDER_TYPE PLANPLANT ...
    %00000000001 PM01 1000 ...
    IT_OPERATION
    ACTIVITY SUB_ACTIVITY CONTROL_KEY WRK_CNTR ...
    10 PM01 MECHANIC ...
    IT_TEXT
    ACTIVITY ... TEXTSTART TEXTEND
    10 ... 1 2
    IT_TEXT_LINES
    TDFORMAT TDLINE
    Longtext for operation 10, line 1
    Line 2 of the long text
    Notes
    Using the BAPI to process the order data cannot support all the functions of the transaction. This applies in particular for the following functions:
    Order header data
    The object list cannot be processed.
    Refurbishment orders are not supported.
    The estimated costs cannot be processed - only the estimated overall costs of the order.
    Notification data cannot be processed with the order BAPI. Even if the settings in Customizing are such that the orders and notifications can be maintained on one screen, no notification is created for the order.
    Permits cannot be processed.
    The order addresses cannot be processed.
    Individual partner addresses cannot be maintained.
    The settlement rule cannot be maintained.
    Order functions
    Printing the papers is not possible.
    Locking and unlocking the order is not possible.
    Accepting and rejecting quotations is not possible.
    Business completion is not possible.
    Flagging for deletion is not possible.
    The log cannot be displayed.
    User default values are not used.
    The field selection is not checked.
    The Customer Exits/BAdIs are not executed completely.
    Joint ventures are not supported.
    Funds Management is not supported.
    Investment orders are not supported.
    No integration of service products with task lists possible.
    No integration of configurable service products possible.
    Assignment of sales document items with service products in accordance with the aforementioned conditions.
    Operation data
    A change of the control key in the operation is not possible, if this leads to a change of the processing type (internal-/external processing)
    User status change not possible.
    Production resources and tools cannot be processed.
    Service lines cannot be processed.
    Task list integration is not supported.
    Linking operations with object list is not supported.
    Component data
    User status change not possible.
    BOM data cannot be processed.
    The delivery address cannot be processed.
    Further Information
    See also the documentation for the individual transfer tables.
    Parameters
    IT_METHODS
    IT_HEADER
    IT_HEADER_UP
    IT_HEADER_SRV
    IT_HEADER_SRV_UP
    IT_USERSTATUS
    IT_PARTNER
    IT_PARTNER_UP
    IT_OPERATION
    IT_OPERATION_UP
    IT_RELATION
    IT_RELATION_UP
    IT_COMPONENT
    IT_COMPONENT_UP
    IT_TEXT
    IT_TEXT_LINES
    EXTENSION_IN
    RETURN
    ET_NUMBERS
    Exceptions
    Function Group
    IBAPI_ALM_ORDER
    ~~Guduri

  • Error while attaching settlement rule for AuC asset

    Getting error "The share to be settled in rule 001 is not unique"  "Enter a unique number (001) (view: Actual settlement) "  when trying to attach a settlement receiver in transaction AIAB  - where to view the duplication of rules, and where to delete the rules ?

    Hello
    Check the transfer variant / receiving asset / transaction type.
    Check all rules again.
    Reg

  • 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.

  • GR/IR expenses not affected with the settlement rule run process in the GL

    <i><b>Please neglect by previous post with the same title</b></i>
    There is a problem I face while running the settlement rule process related to internal orders on the GR/IR expenses.
    According to the internal order settlement rule every expense associated to an Internal order no. whether its an account payable or manual journal accounts it should be settled (distributed) on the cost centers specified in each internal order after the monthly settlement run process is done through T.Code "KO8G", and this actually happens on the entries that are booked manually through T.Code "FB50", but the GR/IR entries is the biggest problem, it didn't reflect the settlement rule distributions in the GL it just gives me the original transaction once its was automatically created through T.Code "MIGO" they are only allocated to a one profit center with no cost center and without being distributed to a multiple cost centers according to the distribution strategy.
    After a long search I found that the cost center distribution occurred only on a secondary none GL account named A&P Settlement (720010), all GR/IR expenses was settled correctly only on this account not through the ordinary GL accounts (e.g. Gifts, printed materials) and of course the correct distribution didn't appear in the GL,
    So is there a transaction or any way to allocate the GR/IR expenses to there correct cost centers with the correct cost element in the GL?
    Is there anything to do with the GR/IR calculation that depends on quantity base not value base?
    <i><b>The Process as follows:</b></i>
    (<b>1) Creating Internal order with a settlement rule (E.g. Cost center 1 (50%) Cost center 2 (50%)</b>
    <b>2) Creating a purchase order associated to an internal order</b>
    <b>3) The Goods received and creating the GR transaction T.Code "MIGO"</b>
    Acc/DR Expenses accounts
    Acc/CR GI/IR Account 400301
    Profit enter ###### (eg. 111177)
    Cost Center <blank>
    Internal order no. ####### (e.g. 9810512)
    <b>
    4) Closing the GR/IR accounts when receiving the invoice T.Code "MIRO"</b>
    <b>When we receive vendor invoice:</b>
    Acc/Dr GI/IR Account 400301
    Acc/Cr Vendor Account
    Profit enter ###### (eg. 111177)
    Cost Center <blank>
    Internal order no. ####### (e.g. 9810512)
    <b>5) Performing the Internal order settlement rule run process</b>
    <b>(N.B.</b> By entering the report of the cost center (Actual/Plan/ Variance) T.Code S_ALR_87013611
    I found that GR/IR expenses was not charged on the concerned cost centers as shown in the GL <b>)</b>
    <b>Your Reply is highly appreciated</b>

    Thanks for your kind reply,
    But is there a way solve this problem?
    And what is the use of leaving a field in the account assignment tab for an internal order while creating a PO and it will not take advantage of the settlement rule????????
    And as you know the internal order settlement is a way to create a multiple account assignment
    Can we solve the problem by making an automatic fake transaction that reverse the value of the GR/IR and creating another transaction can apply on it the settlement rule??
    You know that settlement rule process is one of the best features in the SAP system it save time and effort to make distributions manually

Maybe you are looking for