Error in vendor selection while creating Purchase requistions

Hi,
I was using bapi_requestion_create to create purchase requistion with different quotas for different vendors.
Ex: vendor A   with 60%
      vendor B   with 40%
If the required quantity is 100 items then it has to split 60 items to vendor A and create seperate Puechase Requistion.
and for 40items with another Purchase requsition.
Currently iam able to split the noof purshcase requisiton but it was picking only with one vendor.
MY Code :
*******Split PRs with respect to Quota ************************
      data : lv_lines type i,
             lv_qty type  p DECIMALS 4.
      lv_qty = it_oo-qty.
      DESCRIBE TABLE t_equp LINES lv_lines.
      IF lv_lines GT 1.
        clear : w_equp.
        loop at t_equp into w_equp
                      where qunum = w_equk-qunum.
          refresh : t_req_item.
          clear   : w_eord,
                    t_req_item[],
                    t_req_item.
          READ TABLE t_eord INTO w_eord
          WITH KEY matnr = it_oo_sum_purch-matnr_sap
                   werks = it_oo_sum_purch-plant
                   lifnr = w_equp-lifnr.
          if sy-subrc is initial.
            it_oo_purch-AGREE     = w_eord-EBELN. "To Fill ALV
            it_oo_purch-ITEM      = w_eord-EBELP. "To Fill ALV
            it_oo_purch-FORNEC    = w_equp-LIFNR. "To Fill ALV
            t_req_item-doc_type   = c_zbmr.
            t_req_item-pur_group  = it_oo-ekgrp.
            t_req_item-material   = it_oo_sum_purch-matnr_sap.
            t_req_item-plant      = it_oo_sum_purch-plant.
          t_req_item-AGREEMENT   = w_eord-EBELN.
          t_req_item-AGMT_ITEM   = w_eord-EBELP.
          t_req_item-FIXED_VEND  = w_equp-LIFNR.
          t_req_item-QUOTA_ARR   = w_equk-qunum.
          t_req_item-QUOTARRITM  = w_equp-qupos.
            t_req_item-gr_ind     = c_x.
            t_req_item-ir_ind     = c_x.
          t_req_item-MRP_CONTR   = 'NOV'.
            CONCATENATE it_oo_sum_purch-due_dte+4(4)
                        it_oo_sum_purch-due_dte+2(2)
                        it_oo_sum_purch-due_dte(2)
                        INTO t_req_item-deliv_date.
            t_req_item-QUANTITY   = ( w_equp-QUOTE / 100 ) * lv_QTY.
          endif.
********Rounding off values*******************
          data : lv_int(20) type c,
                 lv_dec(20) type c,
                 lv_tot(20) type c.
          clear : lv_int ,
                 lv_dec,
                 lv_tot.
          lv_tot = t_req_item-QUANTITY.
          split lv_tot at '.' into lv_int lv_dec.
          if lv_dec(1) ge '5'.
            lv_int = lv_int + 1.
          endif.
          t_req_item-QUANTITY = lv_int.
          APPEND t_req_item.
          clear : v_number.
  Create purchase requisition by group
          CALL FUNCTION 'BAPI_REQUISITION_CREATE'
               IMPORTING
                    number            = v_number
               TABLES
                    requisition_items = t_req_item
                    return            = t_return.
ERRO
          IF t_return-type CO 'AE'.
            CLEAR: v_msg, v_x.
            CALL FUNCTION 'WRITE_MESSAGE'
                 EXPORTING
                      msgid = sy-msgid
                      msgno = sy-msgno
                      msgty = sy-msgty
                      msgv1 = sy-msgv1
                      msgv2 = sy-msgv2
                      msgv3 = sy-msgv3
                      msgv4 = sy-msgv4
                 IMPORTING
                      messg = v_msg.
            PERFORM zf_grava_log_erro_oo
                          USING it_oo_purch it_oo_sum_purch v_msg v_x.
SUCESSO - Atualiza Tabela zsytmm_pr_po
          ELSE.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                 EXPORTING
                      WAIT = c_X.
            CLEAR: v_msg, v_x.
            CONCATENATE text-026  v_number INTO v_msg
                                  SEPARATED BY space.
            it_oo_sum_purch-QTY =    t_req_item-QUANTITY.
            PERFORM zf_grava_log_sucesso_oo
                      USING it_oo_purch it_oo_sum_purch v_msg v_x.
            CLEAR: zsytmm_pr_po.
            vl_item = c_00001.
            zsytmm_pr_po-banfn    = v_number.
            zsytmm_pr_po-bnfpo    = vl_item.
            zsytmm_pr_po-ebeln    = c_false.
            zsytmm_pr_po-ebelp    = c_false.
            zsytmm_pr_po-zshmode  = it_oo_purch-shipm.
            MODIFY  zsytmm_pr_po.
          ENDIF.
        endloop.

Hi,
You have to fill DES_VENDOR & FIXED_VEND of structure REQUISITION_ITEMS while calling BAPI.  But while going through your code,
* t_req_item-FIXED_VEND = w_equp-LIFNR
is commented, uncomment the same and add line for DES_VENDOR also.
Regards
Vinod

Similar Messages

  • User Exit / BADI while creating Purchase Requistion

    Hi,
    I am trying to find a BADI that would get triggered before the purchase requisition gets created (so that I can edit the storage location). I observe that purchase requisitions could be created with transactions like MD41 or while creating a sales order (events trigger MRP in background ?)
    I tried to find the relevant BADIs using the transaction MD41 and function module SXV_GET_CLIF_BY_NAME and found the following BADI definitions but was not too sure which one to use in the case. Could anyone help
    MD_MRP_PARAMETERS
    MD_CHANGE_MRP_DATA
    MD_ADD_ELEMENTS
    MD_MODIFY_SOURCE
    MD_ALTERN_EXPLOSION
    MD_LAST_LOT_EXACT

    Used the BADI MD_PURREQ_CHANGE

  • While creating Purchase order the system is showing error: vendor 200001145

    Hi experts,
    while creating Purchase order the system is showing error: vendor 200001145 on line 00010 for ctype ZB12 not defined as head office vendor.
    Plz  give solution for this.
    Thanks&Regards
    sreenivas

    Hi,
    Please check vendor schema maintained in the vendor master,. through this condition type arepicking from system
    Aboue condition type not mainatained inthe caluation schame ,which you assigend to vendorand purchasing organization
    regards
    Channa
    Edited by: channadodawad on Dec 3, 2009 9:22 AM

  • Deleated Valuation Type --Need Error Message while creating Purchase Order

    Hi,
    In our scenario , i need a message should flash , if enduser by mistake select the deleated valuation type while creating Purchase Order.
    In current configuration , it's not there.
    Await your expert opinion.
    Regards
    Shyam Kogta

    I investigated this recently in our company and gave this answer:
    A deletion flag does not restrict anything. It is just an indicator to tell SAP that you want this record to be deleted with the next archiving run.
    The archiving run then checks if a deletion is possible or not.
    So you can set such deletion flags long time in advance, even at a moment where you still have inventory.
    To block materials from beeing used in business transactions, usually the material and sales status are used. But these statuses can only be set at overall, plant and sales organisation level.  
    In some transactions SAP issues warning messages if a material has a deletion flag. This messages could be customized to be an error and prevent any business. However, this type of restriction is not designed for our machine, as we use the material and sales status.
    Anyhow, there is no message for valuation types that have a deletion flag in procurement area.
    There is one for goods receipts (but only for a certain industry solution that is not used by us)
    There is one for deliveries ( VL 211 ).
    The valuation types are defaulted from customizing to the transaction e.g. purchase order. Or from info record to the PO. So a standard purchase order gets valuation type  ABC , while an internal order (production) gets the DEF.  Usually there should not be a need to change this valuation type manually.
    So the only solution is to archive the material master at valuation type level.
    But I guess, you already have POs with that wrong valuation type, which means you have to archive the POs first. It you have already batches with wrong valuation type, then thy have to be archived as well before a material can be archived.
    And finally if you had stock in current year, then you can archive your material in year after next year, as SAP archives only materials that have no stock in current and previous year.

  • Error occured while creating purchase info record in mm

    sir,
    while creating purchase info record  an error occured while inserting net price. it said
    NOT POSSIBLE TO DETERMINE A CONDITION TYPE FOR A PRICE
    when it attempted to generate the time dependent condition for the price you entered the systeem was unable to determine a condition type, price determination is therefore not possible.
    please inform me how to solve this problem.
    thankyou

    I think you are not using the stdard pricing becuse of that it is thrwing error
    Ok First check your pricing procedure which your using for PO
    than in that pricing procedure if you are using PB00 fro Gross price than you will have antoher pricing procedure attached to this condition.
    check in M/06 for your gross price conditon
    now did you assign the pricing procedure to vendor?
    bottom line is somthing missing in your config.
    Check all the config as below
    Pricing Procedure:
    In MM module, pricing procedure is used during RFQ and PO creation. Total value of material based on all addition and subtraction like discount, surcharge, tax, freight, etc. In this we are defining pricing procedure and linking to vendor and purchase department through the virtual schemas.
    Following steps for pricing procedure as,
    1. Define conditions.
    2. Define pricing procedure.
    3. Define virtual purchase organization and vendor.
    4. Info Record.
    Customization for Pricing Procedure :
    1. Definition of Conditions :
    /NMEK0-condition typeu2026condition types- definition (define for basic price, net price, discount, surcharge, tax etc.)
    2. Defining pricing procedure :
    /NMEK0- calculation schema-calculation schemasu2014New entries (Define procedure and put the conditions like formula so that final price will be net price / total value as per company requirement)
    3. Linking pricing procedure to independent condition types.
    /NMEK0-condition typeu2026condition types- definition for position for defined conditions (Enter the defined pricing procedure in the each independent conditions u201CPricing Procedureu201D box)
    4. Defining Schema group for Vendor :
    /NMEK0- calculation schema-schema groupsu2014vendoru2014New Entries.
    5. Defining Schema group for Purchase Organization--- New entries.
    /NMEK0- calculation schema- schema groups---- purchasing organization--- new entries.
    6. Linking Virtual Purchase Organization to actual Purchase Organization.
    /NMEK0- calculation schema- schema groups----- Assign P.Org. (in actual P.Org, enter virtual P.Org)
    7. Linking Pricing procedure to virtual P.Org and virtual vendor :
    /NMEK0- calculation schema- Determine Schema--- -Standard --- New entries (Enter virtual schema and P.Org. along with pricing procedure)
    8. Linking virtual vendor to actual vendor-- /NXK02 then enter schema group vendor in Purchasing Data )
    9. Info Records (/NME11)---- click on u201CPurch. Org. data1u201D and enter condition types and pricing procedure
    What are the steps in pricing determination in MM? Condition, Access sequence and schema.
    In the SAP MM Pricing is more important. Just yesterday I have completed the Pricing as I am doing the SAPMM now. I can give some light on this Topic, not 100%. After 2 days definitely some more I can share.
    The Basic thing is Condition Technique. In which there are
    1. Access Sequence 2. Condition Record 3. Condition Type 4. Condition Table.
    A Access Sequence access a Condition Record of a Condition Type in a Condition Table is a Condition Technique.This is a simple logic
    Here the Condition Type is very important like PB00, PBXX,RA01 etc.
    In the background every Condition Type has its own defition means the purpose of the Condition Type like, is it for Pricing or Percentage, Quntity base, Accrual Feilds etc is to be defined to work this functions.
    Normally we use the existing ones without any risk. But some cases, we have to Create a New Condition Types as per the organisation requirement.
    The Pricing Schema is useful to minimise condition types while mention prices for Vendor on the basis of Pricing Schema which we defined according to organisation requirement.
    The Pricing Schema means the calculations procedure of Condition Type.
    Ex. RA01 - Discoount % is caclulated on PB00 - Gross Price means
    RA01 is based on PB00 like that we have to define in the Pricing Schema
    which makes easy to use in realtime.
    Here PB00 has the Access Sequence - 0002.
    But RA01 does not have the Access Sequence.Why because it is a dependent on PB00. But both are Condition Types.
    In the system, by default some standard Scheme will be there at Vendor Schema Group in the Vendor Master Screen means the standard one is assigned which is very lengthy which may fullfil our requirement. But some cases which may not fullfil our requirement, in such we have to define.
    For the configuration, I may not able to explain properly through here but will give some Idea.
    Configuration: SPRO-IMG-Material Management- Purchasing- Conditions-Define Price Deternmination Process
    1. Define Access Sequence
    2. Define Condition Type
    3. Defince Calculation Schema:- Here you have to define the Schema
    Define Schema group
    1. Define Schema Group vendor
    2. Define Pricing Schema group
    3. Schema group for Purchase Organisation
    4. Assign Schema group to Purchase Organisation
    Define Schema determination
    1.define calculation schema for Standard purchase organisation
    After completion of the Schema Group, we have to assign it to Vendors.
    Then whenever we use any transaction with this Vendor, the concerned Schema will work as configured by us.
    I think this will help you. Actually the Pricing is a vast. Becuase each Condition have its own importance and each Access Sequence have its own importance. So you need not bother about this. First you learn how to define the Calculation Schema through the above.
    Here we can create many Calculation Schemas which can assign one schema to Local vendors
    another schema to out side vendor one more schema to foreign vendors like that we can classify.

  • Error while creating purchase requisition

    Hello
    I am getting following error when I try to create Purchase Requisition
    u201CField selection PT4B not definedu201D
    Cant progress any further due to the error
    Regards,
    sudhir

    Hi
    First Do you Have  created any new field selection for PR document types?
    IF not check your PR document type is attached with which field selection in Puchasing -> purchase requisition -> define document types -> check your document type and field selection. Is it PT4B?
    PT4B is not available then assign correct one in customization.
    If it is then check the settings for fields selection in purchasing -> PR - screen layout at document level -> field selection PT4B.
    Regards

  • Issue while creating Purchase order (ME21N)

    Hi Friends,
    Hope U Have a Good Day...
    My issue is while creating purchase order , I enter vendor and in org.data tab I enter Pur.Org,company code and purchase group. After entering these values if I check in communication tab, the sales person and telephone fields are filled with corresponding data.
    Now my requirement is after entering Pur.Org, Company code and purchase group, and if I go and check in Communication tab, these two fields ( sales person, telephone ) should be blank.
    Please help me in this issue...
    Thanks & Regards
      Ganesh Reddy

    Hi Ganesh,
    This is being fetched frm the vendor master and if u wan this field to be blank
    Then u hav to remove those data frm the vendor master .
    Put tat vendor, comp code n purchase org
    Then select pur org data alon - >chk in purch data
    u can find tat sales person n telp no being appeared in the PO
    lemme know if u hav any prob in getting tat .

  • PO doesnot exixt while creating purchase order

    Hi all,
    I am getting an error while creating purchase order that " PO number doesnot exist".
    When I repeat creating it, PO with next number is getting created.
    What could be the reason for this?

    Use SM13 and check if you have any entry for the update failure. If yes, analyse with tech person,

  • Error in message monitoring while creating new record in R/3

    Hi All,
    I am getting the following error in message monitoring while creating a new record from SAP Mobile client.
    Service name: Validation_Service
    Message: BackendKeys are not filled in table HEADER returned by getDetails
    I am passing some random number from Client to SAP R/3 create function module.
    When i pass the same value in create FM as in message monitoring. I am able to create the record successfully,
    Corresponding to newly created record, i can see the data in getdetail header also.
    Not sure why this error is coming.
    Appreciate your help!!
    Thanks & Regards
    Devendra

    The CREATE FM should not only create the entry, it should also EXPORT the key that it uses to create the entry. Is it doing that?
    i.e. the CREATE signature is usually something like:
    CREATE_BLAH
      IMPORTING header TYPE header_row
      EXPORTING key type header_row-key_field.
    So the 'key' here should be filled by the FM and returned to DOE.

  • While creating Purchase Requisition we need to send a mail for approvers

    Hi All,
    While creating Purchase requisition we need to send a mail to approvers.
    Dowe  need to create Function module ?
    if You know the steps can you please give me the steps.
    Thanks In advance
    Sriman.

    Hi Sriman
    Here we can try for 2 approach
    one is workflow and other his sending emails via user exit.
    I am not much aware about workflow, but you can explore for user exit.
    Try for enhancement component 'MEREQ001'.
    let me know, if you need further help
    Regards
    MD

  • Add a custom table for field selection while creating field catalog for LIS

    Hi,
    I have a requirement to add a Custom table to be available for field selection while creating a field catalog for LIS. Its required as there are many custom fields to be used for field catalog creation and adding them in one of the existing tables listed is not a feasible option for us. Please let me knw if its possible..?? If yes how to get it done..??
    Regards,
    Akash Sinha

    hi,
    You need to add your field in the Data Dictionary first. For example, if
    you want the new field in the Order Item field catalog do the following.
    Look at structure MCVBAPUSR (SE11). If you already have a user structure
    appended to this structure then you can add your new field to your existing
    structure. If there is no structure already appended to MCVBAPUSR then you
    must create a new structure with your field in it and then append the new
    structure to this one.
    If you look at structure MCVBAP you will see the data appended to the end
    of it.
    Now you should see it in the field catalog.
    regards,
    balajia

  • WHILE CREATING PURCHASE REQUISITION,THE AVAILABILITY CHECK FOR THE MATERIAL

    dear Friends,
    our users want to  WHILE CREATING PURCHASE REQUISITION,THE AVAILABILITY CHECK FOR THE MATERIAL SHOULD BE ENABLE,
    at present we maintaing KP in Material Master.  if we activated what will happen?
    please advice.
    with regards,
    Rajesh G

    Hi,
    The availability check is generally used for goods movements(GR,GI,reservation) & not for PRs.
    Regards,
    Vijay

  • Price not picking while creating purchase order

    hi all,
    i have created a pricing procedure and assigned to the vedor, but while creating purchase order the material price is not picking up.if i use the standard one the price is picking up. can anyone explaing any setting iam missing.
    regards
    thyagarajan

    Hi
    In your pricing procedure
    For the condition type Automatic Gross price PB00, you have assigned am Access sequence.
    <b>Access sequence</b>: An access sequence is a search strategy by means of which the system searches for valid records in various condition tables. It consists of one or more accesses. The sequence of accesses controls the priority of the individual condition records among each other. Through the accesses, the system is told where to look first and where to look next for a valid condition record in each case.
    Once the pricing procedure triggers, System looks for the valid condition recorrd for the condition type PB00 as per the priority listed in Access sequence.
    Example: If purchase info record is the first priority and you maintained the Info record then system picks the price from Info record into PO.
    If no valid condition record found then it will trigger PBXX Manual Gross price condition in PO and ask to enter the price manually.This is called condition technique.
    So check whether you maintained the Condition record for PB00 or not?
    Regards
    Ramakrishna

  • Error in Printer Selection while print the document

    Dear All,
    Error in Printer Selection,  while print the document in Quotation.
    Also both side Printing is not happening.
    My Report is in Crystal Report format.
    Suggest any solution on this as earlier as possible.
    Regards,
    Sumeet Vaity

    hi,
    are you printing locally or shared printer?
    pls check the ff.
    1. make sure your printer is on and Online (For local and shared)
    2. make sure the host PC is connected in the network., ping the host PC to make sure your host PC is Connected (Shared)
    3. make it as your default printer.
    regards,
    Fidel

  • Error while creating purchasing documents

    Hi,
    Iam a new user to Material Management unable to create any Purchasing docments (PR,RFQ,P.o..etc).
    As Iam trying to procure a material for stock, selected the Accountassignment as Unknown.
    got following two errors
    1.Unknown account assignment not defined for use here
    2.Source not included in list despite sorce list requirement
    pls suggest me something to avoid these errors and create P.Os.
    Thanks

    Hi,
    I got some clue ,
    1. As I have specified it is a stock material, It should not ask for any account assignment.
    It is asking because I have not updated the material quantity,value updations in IMG settings for the material type
    2.The issue was I have checked the source list for plant in the sorce list configuration settings (SPRO> Materials management>Purchasing>Sourcelist>Define source list requirement at plant level)
    And I have not maintained the source list.
    If you check the above setting, you need to maintain source list for the material
    As you specified I have checked the configuration for combination item category-account assignment for item category that was used when creating purchasing document.
    for standard itemcategory,unknown account assignment type has been defined.
    Now I could able to create P.Os for stock material by updating qty,value updation in material type, and if I don't update this, and use account assingment as unknown I'm getting the saemerror as "unknown account assignment not defind for use here"
    pls let me know how to avoid this error, hep me what are the required settings for making a P.O for accountassignment categories
    Thanks

Maybe you are looking for