How to populate Cost Center by BADi ME_PROCESS_PO_CUST ?

Hi Experts,
Could you help me with this issue?
I want to populate cost center automatically when create a Sotre Order.
I've already implemented this BADi. But I have no idea to do it.
get header data
  ls_header = im_item->get_header( ).
  ls_poheader = ls_header->get_data( ).
get item data
  ls_poitem   = im_item->get_data( ).
  IF ls_poheader-bsakz = 'T'.
  SELECT SINGLE prctr FROM marc INTO lv_prctr
    WHERE matnr = ls_poitem-matnr
    AND   werks = ls_poitem-werks.
    MOVE 'K'            TO ls_poitem-knttp.
    MOVE lv_prctr   TO ls_poitem-kostl.
    CALL METHOD im_item->set_data
      EXPORTING
        im_data = ls_poitem.
ENDIF.
My code didn't work for this request.
Could you help me? thanks in advance.

Hi
In method PROCESS ITEM try this:
  DATA: ls_mepoitem TYPE mepoitem,
        ls_header TYPE REF TO if_purchase_order_mm,
        ls_data_header TYPE mepoheader.
  ls_mepoitem = im_item->get_data( ).
  ls_header = im_item->get_header( ).
  ls_data_header = ls_header->get_data( ).
* coding to set data in LS_MEPOITEM, that you call LS_POITEM
  im_item->set_data( ls_mepoitem ).
I hope this helps you
Regards
Eduardo

Similar Messages

  • How to restrict cost center in ME51N

    Hi all,
    can anyone please let me know,how to restrict cost center in ME51N transaction?
    Thanks in advance for your efforts

    Dear,
    Go to Transaction,
    KS02- Change Cost Center.
    Go to the Control Tab.
    Tick on the checkbox for desired transaction activity you want to lock this cost center.
    Any postings made against the cost center will not be allowed.
    Regards,
    Syed Hussain.

  • How to assign cost center to cost element.

    Hello,
    Can any one please guide how to assign cost center to cost element.
    Thanks in Advance..
    Have a nice day...

    Hi ,
    There are 3 ways :
    1. Default the cost center in cost element - Ka02 - account assingment tab enter cost center .
    2. Use OKB9 for diffrent combinations as per your requirement .
    3. Use GGB1 for substituting the cost center based on some conditions .
    Regards ,
    Dewang T.

  • How to use cost center hierarchy?

    Hi,
                  How to use cost center hierarchy?I have created that but how to use that.Can somebody help me?
                                        Sekar

    Once the Cost Centre Hierarchy is Created, it can be used in Profit Centre Reports.
    Choose Financials -> Cost Accounting -> Profit Center Report ->Template.
    Here Choose, the Cost Centre Hierarchy the you had created and generate the report.
    Also refer these threads
    [Reg... Costcenter hierarchy;
    [cost centre hierarchy;

  • How to Enable Cost Center Field in Infotype 0001

    Dear all my Friends,
    Can anybody please tell me that how to Enable Cost Center Field in Infotype 0001, actually the problem is while hiring the employee the field itself disable and not allowing me to put any CC on that field but which should be enable while hiring or if we intend to change in future through PA30 and after that i thought i can do in Infotype 0027 also but in infotype 27 the field called Master Cost Center field is still disabled which will reflect in 0001 or Vice Versa.
    So friends pls tell me where my configuration is wrong or how will i get enable that field in 0001 infotype so that i calculated the cost of that employee.
    Waiting for ur Reply friends,
    Thanks,
    Prashant.

    Dear Rajesh,
    Thanx for ur Solution and i got the answer, actually i m maintaining through OM and u gave me the exact solution .
    Gr8 job dear. Thanx allot once again
    Thanks,
    Prashant.

  • How to Override Cost Center in IT 1 based on certain conditions

    Hi,
    I have a pretty good understanding on how Cost Center gets defaulted based on Org Structure.  The standard SAP solution for Cost Center will not work for my client and I need to determine the cost center based on certain conditions. I understand that I have to write custom code in some user exit or badi. I tried user exit EXIT_SAPFP50M_001, but it did not work.
    Here is my code:
    DATA: I0001 LIKE P0001.
    CASE INNNN-INFTY.
        WHEN '0001'.
          CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN
            EXPORTING
              PRELP = INNNN
            IMPORTING
              PNNNN = I0001.
    This is just an example to test the concept
    I0001-kostl = 'COST_CENTER'.
         CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
            EXPORTING
              pnnnn = i0001
            IMPORTING
              prelp = innnn.
    endcase.
    When I change IT 1 record and hit enter, I can see that my code is being executed. I can see cost center being updated on the screen, but when I save it, its not able to retain that new cost center value. This might be because cost center is not an open field.
    How can I change my code so it retains its value after saving?.
    Thanks!

    Contd to manoj
    Cost Center will be a Open feild when the value of   the  switch PLOGI ORGA  should be balnk if it is haveing 1 than it will not default the value kindly check

  • How batch append cost center group to standard hierarchy by batch

    Hi Guys,
    Would you please tell how me how append cost center groups to standard hierarchy by batch, every time I have to do it one by one, is there  a convenient way? thanks.
    Best Regards
    FS

    Hi,
    You can create any number of cost center groups as per your requirement.
    But one thing is crucial. If you crin your eate the groups using the T Code:OKEON. those will effect  to the standard hierarchy.
    Cost centers created wil KSH1 will not effect to standard Hierarchy.
    Main point here is the main hierarchy should be maintained in OKEON. Later you can add any number of groups to that. LSMW will work, before that Hirarchy Area(Cost center group) should be maintained in the system for effective work of LSMW.
    Regards,
    Pavan Kumar Arvapally

  • How to add cost center field to IT0001

    Hi
       How to add a cost center filed in IT 0001...I know normally this will be there but in my client system it is been hided or removed ..So can I know where to make a changes to get it back.
    Thanks

    hi
    check your infotype customizing in IMG .
    note down the screen number , and in there you can check if the fld is hidden or not.
    Regards
    sameer

  • Report Painter- How to make cost center report for Jun07-Jul08 ?

    Hi Experts,
    I need to make a P&L (Actual/ Plan) report for Jun 07 - Jul 08 by using Report Painter, but I'm having difficulty to make column for the next year period (2008) and some other things.
    We are using K4 Fiscal Year Variant in ECC 6.0.
    The layout is somehow like this:
    Header : Cost Center
                 Actual/Plan Report
                 June 2007 to July 2008
    Body:
    Cost Element     |   Total Actual   |   Total Plan |  Actual  June | Plan June .................Actual July | Plan July    
    xxxx       
    xxxx
    Account Group (total)
    xxxx
    xxxx
    Account Group (total)
    Grand Total  
    How to:
    a. make the header "June 2007 to July 2008" ?
    b. make the selection screen to provide parameter for June 2007 to July 2008? (e.g.: period 6 fiscal year 2007 to period 7 fiscal year 2008)
    c. provide layout (rows and columns) as described above? it should provide detail cost elements and also calculate it as the total per account group, then finally the Grand Total for all of account groups. 
    Thank you before,
    -=Meila.S=-

    Hi,
    1. Put Year and Month as your General Selection parameters
    2. In the label of the fields, if you put the parameter name with & before, it will display the value
    3. If you put cost element in General selection, it will come with a group, and when you selecting the group, the report does the sub-totals automatically.
    Regards,
    Eli

  • How to SeeThe Cost Center Budgeting Report

    Hi Experts,
    I am preparing the scnario for Cost Center Budgeting,once we enter the details in the budgeting plan,,we will post to the cost centers as well.after that how can we see the Cost Center Budgeting Report....will it be available in S_ALR_87013611 or anything else????
    Regards
    Sap Guru

    You are right, i.e you can view the budget/planning  report from S_ALR_87013611. But some other reports are available to view the planning data like S_ALR_87013612, S_ALR_87013613, S_ALR_87013614 where you can view the actual vs planning data. You can view only planning data from KSBL, KSBP etc.
    Thanks,
    Regards,
    Ramnath V.

  • How to control cost center authorization when do ABSO/ABAA

    Dear :
    As our system organization structure is with mutiple profit center and
    cost centers, in order to avoid processing TCODE ABSO/ABAA with wrong
    input, we want to make authorization check with cost centers, as there
    is no standard authorization check and control in TCODE ABSO/ABSS , we
    want to know how could we realize the requirement
    to control the TCODE with cost center authorization check, thanks in
    advance.

    Hi,
    check SAPNET note 370082 + related notes + 698401 / 565436.
    Best regards, Christian

  • How to delete cost center - KS04

    Hi,
    we need to delete the current cost centers however we can not do it due to the fact thar records available in table COKA.
    In order to get rid of this problem we have tried to change the valid through date as, for example, 01.01.2011 - 31.12.9999 and tried to delete with these values and got the message cost center can be deleted, KS04, but how to delete it?
    i looked for a butto etc to delete the cc but could not find any.
    All heplful answers will be appreciated.
    Thanks.

    Try to follow the process mentioned in standard sap Help.
    http://help.sap.com/saphelp_46c/helpdata/en/03/7c9d3962749d08e10000000a11402f/content.htm

  • How to capitalise cost center based purchase

    Hi Friends ,
    Presently we are buying all plant and machine and Building related on cost center based purchase with GL accounts . We want to capitalise these once project compleate , how to capitalise material with cost center based purchases .
    Raghu

    Hi,
    This as a manual posting in FI from your cost center to the asset.
    TC like FB01
    Use for the asset posting key 70  asset number TTtype 100 fill in the information
    Credit you cost center with posting key 50 GL accounts.
    Wy you don't use Internal orders or projects? From there you can settle your investment to AUC and the final asset.
    Paul

  • How to capitalise cost center based purchases

    Hi Friends ,
    Presently we are buying all plant and machine and Building related on cost center based purchase with GL accounts . We want to capitalise these once project compleate , how to capitalise material with cost center based purchases .
    Raghu

    Hi,
    This as a manual posting in FI from your cost center to the asset.
    TC like FB01
    Use for the asset posting key 70  asset number TTtype 100 fill in the information
    Credit you cost center with posting key 50 GL accounts.
    Wy you don't use Internal orders or projects? From there you can settle your investment to AUC and the final asset.
    Paul

  • How to delete cost center

    Hi,
    I created some wrong cost center in SAP, how to delete it?

    hi,
    go to T.Code : KS04 and delete the cost center.
    regards,
    mohammed

Maybe you are looking for

  • ?? I thought there was a mac-mini, DVI to RCA /S-video adapter. If no, can I get 37.5mhz on display to composite video out?a composite video

    ?? I thought there was a mac-mini, DVI to RCA /S-video adapter. If not can display be set to 37,5 hertz then my crt can accept composite video. Thanks.

  • White screen of death with flashing question mark

    After a year and a half of frequent freezing of the screen, my expensive apple mac book has crashed. I thought this only happened to microsoft. I tried reloading the software, just like the manuel suggested, and this failed. Should I go buy a decent

  • Analysis of Active Availability Control

    Hi PS gurus, I'd like to know what is the meaning of the columns in the Availability Control Analysis report (accessible via Extras --> Availability Control --> Analysis in CJ30 or Cj32) NWA 4054504 0020                                               

  • Psd to swf

    Imageready CS2 had a fantastic export to swf option that as far as I can tell has completely dissapeared. Can we please get this back? It allowed you to take vector based layers in photoshop (with solid fills) right into flash and maintain full edita

  • Duplex printing control on Mac

    Running Reader 10.1.3 under Mac OS X 10.6.8. According to Help, Page Sizing and Handling should look like but instead I see which I suspect is the 10.1.2 version, and it doesn't print duplex, which is what I want. Yes, my printer is a duplex printer.