Accessing Account assignment in P.Req BADI -PROCESS_REQ_CUST~PROCESS_HEADER

I have implemented a BADI for Purchase requisition and in PROCESS_HEADER method of BADI Implementation for ME_PROCESS_REQ_CUST. I am trying to access account assignment lines on the purchase requisition (EKBN).
IM_HEADER is the only parameter available for me. But I am able to access the items indirectly via get_items method in its interface.
method IF_EX_ME_PROCESS_REQ_CUST~PROCESS_HEADER.
DATA: l_item_list TYPE mmpur_requisition_items,
       l_item_listx type mereq_itemx,
      l_item      TYPE mmpur_requisition_item,
      l_item_akt  TYPE mereq_item,
      l_item_account type MMPUR_ACCOUNTING_LIST,
      l_item_ref  TYPE REF TO if_purchase_requisition_item.
data :  lt_preq_items type standard table of mereq_item .
  FIELD-SYMBOLS:
    <lo_lcl>        TYPE ANY,
    <ls_item>       TYPE mereq_item,
    <ls_itemx>      TYPE mereq_itemx,
    <item>          TYPE mmpur_requisition_item.
  " Get items of purchase requisition
   l_item_list = im_header->get_items( ).
  check IM_COUNT <= 1 .
* Logic for approver determination goes here .
   LOOP AT l_item_list ASSIGNING <item>.
    l_item_akt = <item>-item->get_data( ).
    break-point.
*   l_item_account = <item>-item->get_items( ).
    append l_item_akt to lt_preq_items[].
  ENDLOOP.
I am able to collect all the items of the p.req (i.e EBAN entries) in lt_preq_items .
Now, my challege is to use get_items() method inside
IF_ACCT_CONTAINER_MM~GET_ITEMS   (  Return Account Assignment Objects ) which is inside IF_PURCHASE_REQUISITION_ITEM interface.
A simple  l_item_account = <item>-item->get_items( ) resulted in syntax error. How can I get account assignment objects inside this process header BADI of purchase requisition ? Any useful tips is greatly appreciated.
Regards,
Shareen
Edited by: Shareen Hegde on Jan 27, 2012 12:29 AM

Hi,
DATA: l_item_list TYPE mmpur_requisition_items,
       l_item_listx type mereq_itemx,
      l_item      TYPE mmpur_requisition_item,
      l_item_akt  TYPE mereq_item,
      l_item_account type MMPUR_ACCOUNTING_LIST,
      l_item_ref  TYPE REF TO if_purchase_requisition_item.
data :  lt_preq_items type standard table of mereq_item .
  FIELD-SYMBOLS:
    <lo_lcl>        TYPE ANY,
    <ls_item>       TYPE mereq_item,
    <ls_itemx>      TYPE mereq_itemx,
    <item>          TYPE mmpur_requisition_item.
  " Get items of purchase requisition
   l_item_list = im_header->get_items( ).
  check IM_COUNT <= 1 .
Logic for approver determination goes here .
   LOOP AT l_item_list ASSIGNING <item>.
    l_item_akt = <item>-item->get_data( ).
    break-point.
  *litem_account = <item>-item->IF_ACCT_CONTAINER_MM~GET_ITEMS( ).*_    
append l_item_akt to lt_preq_items[].
  ENDLOOP.
Check with the above code for l_item_account .
Thanks,
Shailaja Ainala.

Similar Messages

  • Access Account assignment data inside custom search help

    Hi Experts,
    I have faced with a challenge and I am stuck. Need some expert advise.  I am developing a custom search help for GL account. Inside the search help exit I have to know what is the account assignment category of the accounting line i am currently accessing in WEB UI. for example i have one item in SC and there is a cost distribution between cost center and WBS element. Now i want to access GL account search help from second line in the account assignment ( ie from line having WBS as Acc Assignment).
    one approach that i can think of is Enhance Accounting WD component and capture the details in a static attribute of a custom class and access them inside the search help exit. I know this will work. But i am looking for more clean approach.
    I saw below code in WD comp method GET_BO_INFO of component controller.
    lo_task_container = /sapsrm/cl_ch_wd_taskcont_fact=>get_task_container_instance( ).
       CHECK lo_task_container IS BOUND.
    * Get the BO type
       ev_bo_type = lo_task_container->get_bo_type( ).
    * Get the BO mapper, BO GUID, and item GUID of the lead selection
       CASE ev_bo_type.
         WHEN /sapsrm/if_pdo_obj_types_c=>gc_pdo_shop.
           lo_bom_sc ?= lo_task_container->get_bom_sc( ).
           ev_hdr_guid = lo_bom_sc->/sapsrm/if_cll_bo_mapper~get_bo_guid( ).
           ev_item_guid = lo_bom_sc->/sapsrm/if_cll_bo_mapper~items_get_lead_selection( ).
    I am not sure if this works. But even if this works I can not get the exact accounting line that the user is currently processing. Any ideas????
    thanks
    sankar.

    Hi,
    Any Ideas?

  • Account Assign Category in Req. Class

    Hi experts,
    Can anyone please let me know about the Account Assignment Category in Requirement Class(TC:OVZG)? What its control? My client bus process is 3rd party MTO what acct assign cat is suit to this process? let me explain an example......
    1. In req.class i have given M in acc.assign.cat. what is the impact with this category? While creating a PO i am giving Z account assign category. which one is correct? please do help
    Looking forward your valuable ideas
    regards
    anifi
    Edited by: Anifi on Sep 17, 2008 6:39 AM

    Hello
    To enable goods movements to take place through the sales order stock, you must select the requirement class that specifies that account assignment category that specifies that goods movements takes through sales order. If u want collect the costs and revenues to the sales order make the consumption  posting field E, if u don;t want collect the costs and revenues to the sales order then that field should be empty.
    Regards
    Madhav

  • Purchase order : get Account assignment into BADI

    Hi,
    i'm using the BADI ME_PROCESS_REQ_CUST method POST ; in this method i need to access to items and it's work (i use im_header->get_items( ) ). But now i need to access to Account assignment, how can i do this ? the only object available is im_header.
    Be careful, i can't read database because when i create a new document, the data are not saved again.
    Thanks for help.
    Cheer

    IM_HEADER->get_items( ) returns the internal table RE_ITEMS type ref to MMPUR_REQUISITION_IITEMS (of line type MMPUR_REQUISITION_ITEM) which gives the list of  line items.
    Loop through the internal table RE_ITEMS, refer to the component RE_ITEMS-ITEM (type ref to IF_PURCHASE_REQUISITION_ITEM) & use the method RE_ITEMS-ITEM->IF_ACCT_CONTAINER_MM~GET_ITEMS( ) to get the account assignment details related to each item.  This method is to be called in the loop for each line item.
    Regards, Vinod
    P.S : Is it purchase order or Purchase requisition ? By going through the post it is PR, your subject line seems to be wrong.
    Edited by: Vinod Kumar on Jul 15, 2011 2:21 PM

  • User Exit/Badi for G/L account assignment in ME21n/ME22n

    Hi All,
    I need user exit/badi for account assignment in item details for following requirement.
    If user changes G/L account of the first line item then I have to copy same G/L account to all line items.
    Please suggest me suitable user exit for this.

    hello,
    follow the steps.......
    For User Exit's
    goto to tcode->status->program name->double click on that,
    then goto to-> attribute take the package name and
    Goto SMOD tcode ->Utilities->give the package name and F8
    then a list of exits will display for that tcode as well as that package.
    u can check the table MODSAP
    For BADI's,
    1)goto to tcode SE24 give the CL_EXITHANDLER and display and then double click on the GET_INSTANCE
    keep Break point at this location 'call method cl_exithandler=>get_class_name_by_interface'
    then the tcode it will trigger there and we can debugg there we can find badi'for that tcode and then remove the break point.
    2)Goto to tcode->status->program name->double click on that program will display's
    then  press crtl+F then cl_exithandler
    Thank u,
    santhosh

  • Setting flag account assignment element in PS within BADI doesn't work

    Hello,
    I would like to set the flag for account assignement element and billing element in PS depending on some fields of cProjects. Hint 993642 says that can be done in GCC_PS_PROJECT_LABEL. Unfortunately I don't know how to pass some parameters from cProjects to the relevant method.
    For transfering the standard fields I am using (thanks to Matthias) the BADI DPR_FIN_GECCO_ATTR.
    There are several blocks with fields I set. Each block looks similar to (except the field and the value)    
    ls_attribute-data_element     = space.
          ls_attribute-value            = space.
          ls_attribute-field_name_orext = 'WBS_ACCOUNT_ASSIGNMENT_ELEMENT'.
          ls_attribute-fldname_receiver = space.
          ls_attribute-struc_name_copa  = space.
          ls_attribute-field_name_copa  = space.
          ls_attribute-ext_attr_name    = space.
          ls_attribute-ext_attr_value   = space.
          INSERT ls_attribute INTO TABLE ct_attributes.
    In the default method the WBS_ACCOUNT_ASSIGNMENT_ELEMENT and WBS_BILLING_ELEMENT are overridden constant to 'X' like hint 993642 describes. But at least I have no glue how to pass my relevant parameters to the method to be able to set the values in my own implementation of this method.
    So, does someone knows how to pass values to this method?
    Thx,
      Vanessa
    Edited by: Vanessa Martinez on Oct 28, 2008 9:23 AM

    Hi Vanessa,
    I tested the proposal I told you today, and when I came into debug mode in BADI F_EX_GCC_PS_PROJECT_LABEL~GET_WBS_ELEMENT, here is what I obtain in structure ATTRIBUTES_OF_EXT_OBJ.
    Line  | Data_element |    value       |        field_name_orext
    1        |                     |    TEST      |         USER_FIELD_CHAR20_1
    2        |                     |    TEST2    |         USER_FIELD_CHAR20_2
    3        |                     |    TEST3    |         USER_FIELD_CHAR10_1
    4        |                     |    TEST4    |         USER_FIELD_CHAR10_2
    So if you build an enhancement at the end of the method (don't hesitate to copy standard code if it helps), you should be able to retrieve your values, and set the flags as wanted.
    read table ATTRIBUTES_OF_EXT_OBJ
    into ls_attribute
    with key field_name_orext = 'USER_FIELD_CHAR10_2' (actually the name you set on cProjects side, so you might be able to do it as well for WBS_ACCOUNT_ASSIGNMENT).
    Matthias
    Edited by: Matthias BRISSEAU on Oct 28, 2008 2:21 PM

  • BADI to populate Asset Master Class valu in Account Assignment Item Detail?

    Hi All,
    In Shopping Cart  - COST ASSIGNMENT - Account Assignment Item Details   Tab 
    we have
    Create New Asset Master Record    section  and the field
    Choose an Asset Master Class 
    I need to populate this field (Choose an Asset Master Class) with my own value.
    What BADI I can use to populate value on this field? Any ideas?
    Thanks in advance.

    Hi,
    As i told you there is no badi to do this.
    1-What you can do is to create a CUF in the accounting tab to store your asset category.
    You will then have to
    2- hide the standard field but let the standard populate it with a default value from the org structure
    3- add in the SRM iMG the cuf field for the accounting data.
    4- code bbp_doc_change_badi to populate your CUF field
    5- code bbp_driver_determine in order to call the FM to create the asset
    6- create 1 FM in ECC to create the asset (copy of bapi_fixedasset_create1)
    Hope this helps,
    Kind regards,
    Yann
    Edited by: Yann Bouillut on Apr 15, 2009 5:23 PM

  • Badi For Account Assignment Category in me21n

    Hi All,
    I am trying to implemnt badi for me21n for assigning default account assignment category as  E.
    i got the badi for  ME_PROCESS_PO_CUST .
    But the the problem is i dont find account assignment category field(KNTTP) in trhe metyhods tab.
    No othe badi is getting triggered.
    Please help me out in  this regard.
    Thanks and regards
    Ibrahim

    hi,
    i hope this will help you.
    DATA:
             ls_acc TYPE REF TO if_purchase_order_account_mm,
             ls_item     TYPE REF TO if_purchase_order_item_mm   ,
             ls_hdata    TYPE mepoheader                            ,
             ls_header   TYPE REF TO if_purchase_order_mm           ,
             ls_idata    TYPE mepoaccounting,
             ls_data     TYPE mepoitem_data    .
      DATA : lv_werks TYPE wrf1-locnr .
      DATA : vlfkz  TYPE wrf1-vlfkz.
      DATA : matkl  TYPE mara-matkl.
      DATA : ls_ana   TYPE zmm_ana_hesap.
      DATA : lv_okset TYPE c.
      ls_acc = im_account .
    *get item from account
      CALL METHOD ls_acc->get_item
        RECEIVING
          re_item = ls_item.
    *get item header
      CALL METHOD ls_item->get_header
        RECEIVING
          re_header = ls_header.
    *- Get item header data
      CALL METHOD ls_header->get_data
        RECEIVING
          re_data = ls_hdata.
    *- Get item data
      CALL METHOD ls_item->get_data
        RECEIVING
          re_data = ls_data.
    *- Get account data
      CALL METHOD ls_acc->get_data
        RECEIVING
          re_data = ls_idata.
      lv_werks = ls_data-werks.
    ***Conversion Exitler
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = lv_werks
        IMPORTING
          output = lv_werks.
      SELECT SINGLE vlfkz FROM wrf1 INTO
         vlfkz
        WHERE locnr EQ lv_werks.
      SELECT SINGLE matkl FROM mara INTO
         matkl
        WHERE matnr = ls_data-matnr.
      SELECT SINGLE sakto INTO ls_ana-sakto FROM zmm_ana_hesap
        WHERE matkl = matkl
        AND vlfkz = vlfkz
        AND bsart = ls_hdata-bsart
    AND knttp = ls_data-knttp
      IF sy-subrc EQ 0 .
        ls_idata-sakto = ls_ana-sakto.
        lv_okset = 'X' .
      ENDIF .
    * buraya lv_check ya da sakto bou015F ise için kosul gelecek
    IF lv_okset IS NOT INITIAL .
    *- Set item
        MOVE-CORRESPONDING ls_data TO ls_idata .
        CALL METHOD ls_item->set_data
          EXPORTING
            im_data = ls_idata.
      ENDIF.
    ENDMETHOD.

  • Need a Userexit for ME51N, ME52N to access data in Account Assignment Tab

    Hi,
    I am currently using Enhancement MEREQ001, EXIT_SAPLMEREQ_005 to check line item data and display an error message.   That works fine.   My need now is to access the Order Number entered under the Account Assignment tab.
    The import parameter IM_DATA_NEW does not contain this info.   Can anyone please let me know if there is an exit that can be used to access the order number from the screen?
    Thank-you,
    Priscilla LeMay

    First of All, you have to get the information about item, so yo have to call the next method:
    DATA: lv_acc_list TYPE mmpur_accounting_list.
    CALL METHOD im_req_item->if_acct_container_mm~get_items
          RECEIVING
            re_items = lv_acc_list.
    Secondly you must do loop to this table, and call another method for get the information about Account Assigment:
    data: lv_model TYPE REF TO if_accounting_model_mm,
       LOOP AT lv_acc_list INTO ls_acc.
          lv_model = ls_acc-model.
          CALL METHOD lv_model->get_exkn
            RECEIVING
              re_exkn = lv_exkn.
    In variable lv_exkn you have the values.
    I hope it runs ok.

  • BADI-ME52N - Getting Account Assignment Data

    Experts
        I'm Implementing BADI , ME_PROCESS_REQ_CUST~Process_Account
    Method ME_PROCESS_REQ_CUST~Process_Account
    CALL METHOD im_account_ref->get_persistent_data
        RECEIVING
          re_persistent_data = re_persistent_data1.
      CALL METHOD im_account_ref->get_data
        RECEIVING
          re_data = re_data1.
      CALL METHOD im_account_ref->get_previous_data
        RECEIVING
          re_previous_data = re_previous_data1.
    EndMethod.
    All These Data will Fetch Information About Account Assignment and some Header ITemFields.
    But Oly After Trigeering The Account Assignment Tab only it's Fetching
    I want the values to be fetched immdly after giving the transaction ME52N
    After Giving Transaction Me52N , these data shows Values are as 0. Just giving any small changes or triggering the Account Assignment tab the values are fetching.
    Any ways to solve this
    Thanks.

    METHOD if_ex_me_process_req_cust~open.
      GET PARAMETER ID 'PRO' FIELD lv_wbs."getting the WBS ELEMENT
    ENDMETHOD.
    getting the Parameter id in the
    initialize method of the badi will solve the issue

  • BAdI Account Assignment

    Hi,
    does anyone know of a BAdI that is called when creating / changing the account assignment on item level while creating a service order (type SRVO)?
    I found a BAdi (created an implementation, activated it and put a break in both methods (check & merge)) but the BAdI implementation of BAdI definition CRM_ACASSIGN_BADI is not called at that very moment.
    Kind regards,
    Micky.

    Hello Micky,
    Another solution should be to use the events (transaction CRMV_EVENT).
    In the assignments, enter AC_ASSIGN in the object name and push on the button "callback for cat./obj./event". You will find a list of callback functions.
    Maybe you can copy one of these records to use your own FM with your own coding.
    Hope this will help you.
    Regards,
    Frédéric

  • Adding new field in SC Account Assignment Screen (only for information)

    Hi guys,
    we have a requirement, to <b>show</b> additional fields within the account assignment screen. The contents should only be displayed as information for the user. It is not necessary, respectively not wanted to save this data within SRM or the Backend-System.
    2 questions:
    a) Is it necessary to expand the item-structure of the SC (INCL_EEW_PD_ITEM_CSF_SC) AND to expand the accounting structure (INCL_EEW_PD_ACC_CSF) for this fields?
    b) Is it sufficient, that the INCL_EEW*-structures of the PO-/billing-document etc. are <b>NOT</b> expanded with the additional fields to avoid the saving? In OSS-Note 458591 it is mentioned, that it is necessary to expand the CI-COBL-structure within the Backend-System.
    Thanks in advance with best regards.
    Bernd
    ps. We are using SRM 4.0.

    Hi
    <b>We have done this several times, in our past previous SRM implemenatations.</b>
    a) Yes. You need to expand the item structure at the Shopping cart level to display your Custom fields in the We bapage. As Per OSS Note - 672960, you can see the details. For display purpose, at least these custom fields must be created in the standard include structures [e.g., INCL_EEW_PD_ACC_CSF, etc ].
    b) Yes, no need to expand any other SAP Include structure, incase you don't want the field contents to be saved in backend system (incase of Purchase Order / Purchase Req).
    <u>Please see the follwoing links, which deal with the similar requirements, you have asked for in detail with code and other relevant details -></u>
    Re: Item Field Appearing In Account Assignment Field
    Re: Control Busniess Area Field in Account Assignment..
    Re: Add new account assignment field
    Re: Account assignment category not passed into Target Objects Badi
    Re: Add customer fields in Shopping cart and purchase order
    Re: Hiding CUF fields in SC Basic data
    displaying custom fields on shopping cart
    Custom Fields in Cost Assignment Tab
    How to add the custom field in SRM EBP shopping cart?
    Add customer fields in Shopping cart and purchase order
    Hope this will definitely help. Do let me know, incase you face any issues.
    Regards
    - Atul

  • Multiple Account Assignment Distribution by Percentage in EBP

    Hi Gurus,
    We are in SRM 4 SP13  and ECC 4.6C ,Classic Scenario.The SC creates a PR in the backend and from that  PO subsequently.
    When we are creating a SC with Multiple Account Assignment  and Distribution by Percentage to different cost centres   the PR created  with
    Distribution :  Distribution by percentage  and
    Partial Invoice : Distribute in Sequence. This is for materials
    But for Services it is created as
    Distribution :  Distribution by percentage  and
    Partial Invoice :Distribute Proportionally.
    For services Partial Invoice is working fine and for materials it is Picking "Distribute in Sequence"
    Is this a standard behaviour  or any thing to be changed .Please let me know.
    Thanks in Advance.
    Rajesh

    Hi there,
    Standard SRM Hardcodes the partial invoice indicator to Progressive when          
    sending POs to SAP in the Classice Scenario:                                                                               
    SPOOL_PO_READ_BAPI_EXPORTS hard codes the value of po_items-part_inv              
    to 1 that is equivalent to "Progressive fill-up" in R/3 POs & REQ.                                                                               
    It is not possible to create from EBP to backend some PO-documents with           
    multiple account assignment and partial invoice indicator = 2 (which is           
    proportional distribution because there is no possibility to set this             
    indicator on the account assignment creen in EBP and theris no Badi               
    to do it so far. This is a missing functionality from SAP.                                                                               
    You still could use LIV with partial invoice indicator= 1 and then you            
    can change to partial invoice propotional in backend manually.                    
    This is not comfortable but it is possible so far.                                
    You can see in the following code from the mentioned Function how Service and material documents are treated differently
    ======================================                                                                               
    set distr. indicator only for the dummy item for services         
    for material items and the service lines                          
    it is derived from distribution type in EBP                       
        IF next > 1.                                                    
          IF po_items-item_cat = '9' OR                                 
             po_items-item_cat = '1' .                                  
            po_items-distrib = '2'.    "prozentuale Verteilung          
          ENDIF.                                                        
          po_items-part_inv = '1'.      <<<<       Hard Coded to "1"    
          MODIFY po_items INDEX h_index.                                
        ELSE.                                                           
          CLEAR po_items-distrib.    "prozentuale Verteilung            
          MODIFY po_items INDEX h_index.                                
        ENDIF.                                                          
      ENDLOOP.                                                                               
    CHECK NOT po_items[] IS INITIAL.                                                                               
    ======================================         
    Or possibly use Badi BBP_CREATE_PO_BACK
    Hope this points you in the right direction.
    Regards,
    Matthew

  • Extension of input fileds in Sales order for account assignment

    Dear Gurus,
    Can anyone tell me how to extend input fields like Statistical order(COBL-AUFNR)  and cost center(COBL-KOSTL) in sales order for accounting assignment and these fields have to be ready for manual entries. The order types are ZHGA and ZHV.
    Which program has to be modified and how it can be modified?
    Thanks a lot for help and advice.
    Cheers,
    Ricky
    Edited by: Ricky.Martin on Apr 23, 2010 10:45 AM

    Dear Rajendra,
    There is a manual change for tax classification for material master in va02 initially it was blank now it is changed to ' 0 ' is any way influencing....?
    Definitely material Tax classification will influence to determine the Tax code.
    -->So Make sure that customer and material master having proper tax classification indicator.
    -->Have you Update the price after changing the tax classification in the sales order.by going to item dat -->condition tab then click on Update push button bottom of the conditions screen.
    -->Once again the check the condition record maintanence also for your MWST access sequence.
    I hope this will help you,
    Regards,
    Murali.

  • Team members access thru Assignment rule

    When defining the Assignment Rule for Account f.e. the administrator can define the Team Members to be assigned to the account, and their access levels.
    My doubts refers to this level of access x the level of access defined thru the user role/access profile. In other words... if thru the Access Profile the user X has a Read-Only access to Account object... and if thru the Assignment Rule - Team Members I give the user X the access Full...
    Should I understand that for every other account (except the ones assigned thru assignment) the user X has a Read Only access...and for these accounts assigned thru Assignment the user X has the Full access ?
    Txs. for any hints.
    Antonio

    Antonio, your understanding is correct.

Maybe you are looking for