Maintain Services or Limits in BAPI_PO_CREATE1

Great day Friends,
Its my first day on SDN. Hoping to find helpful answers here and Wish you luck for your career also.
I am working on BAPI_PO_CREATE1.
I've used following tables.
return
poitem
poitemx
poaccount
poaccountx
poservices
I've passed the data for POSERVICES as following:
  wa_poservices-line_no  = '0000000010'.
  wa_poservices-ext_line = '0000000010'.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = wt_tab2-service
    IMPORTING
      output = wt_tab2-service.
  wa_poservices-service  = wt_tab2-service.
  wa_poservices-outl_ind = 'X'.
  wa_poservices-quantity = wt_tab2-quantity.
  wa_poservices-gr_price = wt_tab2-gr_price.
  APPEND wa_poservices TO poservices.
As there's only one service item so I've hard coded the Iine_no and Ext_no.
After Executing it's giving me error as 'Maintain Services or Limits'.
I've gone through the documentation but couldn't find it helpful.
Any suggestions ?

Hi Varun...
My query regarding "Maintain Services or Limits" has been resolvd.
It is now saying No account assignment exist for po service line 000000010..
Anyway I would be rating you for sure for solving my issue. But It will be more helpful if you help me on this also...
here's my code...
FORM po_services .
  CLEAR: wa_poservices, wa_posrvaccessvalues.
  wa_poservices-pckg_no = pckg_no.
  wa_poservices-line_no  = '0000000001'.
  wa_poservices-subpckg_no = pckg_no + 1.
  APPEND wa_poservices TO poservices.
  wa_poservices-pckg_no = pckg_no + 1.
  wa_poservices-line_no  = '0000000002'.
  wa_poservices-ext_line = '0000000010'.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = wt_tab2-service
    IMPORTING
      output = wt_tab2-service.
  wa_poservices-service  = wt_tab2-service.
  wa_poservices-outl_ind = 'X'.
  wa_poservices-quantity = wt_tab2-quantity.
  wa_poservices-gr_price = wt_tab2-gr_price.
  wa_poservices-subpckg_no = '0000000000'.
  APPEND wa_poservices TO poservices.
  wa_posrvaccessvalues-pckg_no = pckg_no + 1.
  wa_posrvaccessvalues-line_no = '0000000001'.
  wa_posrvaccessvalues-serial_no = '01'.
  APPEND wa_posrvaccessvalues TO posrvaccessvalues.
ENDFORM.                    " PO_SERVICES
FORM acc_assignment .
  CLEAR : wa_poaccount, wa_poaccountx.
  wa_poaccount-po_item      =  wt_tab2-po_item.
  wa_poaccount-serial_no    = '01'.
  wa_poaccount-gl_account   =  '400265'.
wa_poaccount-quantity     = '1.000'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
   EXPORTING
     input  = wt_tab2-orderid
   IMPORTING
     output = wt_tab2-orderid.
  wa_poaccount-orderid      = wt_tab2-orderid.
  APPEND wa_poaccount TO poaccount.
  wa_poaccountx-po_item      = wt_tab2-po_item.
  wa_poaccountx-serial_no    = '01'.
wa_poaccountx-quantity     = 'X'.
  wa_poaccountx-gl_account   = 'X'.
  wa_poaccountx-orderid      = 'X'.
  APPEND wa_poaccountx TO poaccountx.
ENDFORM.                    " ACC_ASSIGNMENT

Similar Messages

  • Service purchase order bapi_po_create1 error: maintain services or limits

    I am trying to create service Purchase Order.
    I am getting error: 'Purchase order still contains faulty items, Please maintain services or limits'.
    Struggling to solve this. Can anybody shed some light on this to solve.
    I would appreciate your any help.
    thanks.
    The following is the code I am working.
    REPORT  ZAUTO_PO_CREATE1                        .
    constants: c_x value 'X'.
    DATA: i_poitem TYPE STANDARD TABLE OF bapimepoitem,
    i_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
    i_poitem_sch TYPE STANDARD TABLE OF bapimeposchedule,
    i_poitem_schx TYPE STANDARD TABLE OF bapimeposchedulx,
    i_acct_*** TYPE STANDARD TABLE OF bapimepoaccount,
    i_polimits type standard table of BAPIESUHC,
    i_acct_assx TYPE STANDARD TABLE OF bapimepoaccountx,
    i_services TYPE STANDARD TABLE OF bapiesllc ,
    i_srvacc TYPE STANDARD TABLE OF bapiesklc,
    i_return TYPE STANDARD TABLE OF bapiret2,
    wa_header TYPE bapimepoheader,
    wa_headerx TYPE bapimepoheaderx,
    wa_poitem TYPE bapimepoitem,
    wa_poitemx TYPE bapimepoitemx,
    wa_poitem_sch TYPE bapimeposchedule,
    wa_poitem_schx TYPE bapimeposchedulx,
    wa_acct_*** TYPE bapimepoaccount,
    wa_acct_assx TYPE bapimepoaccountx,
    wa_services TYPE bapiesllc,
    wa_srvacc TYPE bapiesklc,
    wa_return TYPE bapiret2,
    wa_BAPIESUHC type BAPIESUHC,
    ws_po TYPE bapimepoheader-po_number.
    data: wa_it_xlikp like line of it_xlikp.
    loop at it_xlikp into wa_it_xlikp.
    endloop.
    data: wa_it_xlips like line of it_xlips.
    loop at it_xlips into wa_it_xlips.
    endloop.
    data: wa_it_xvbpa like line of it_xvbpa.
    loop at it_xvbpa into wa_it_xvbpa.
    if wa_it_xvbpa-parvw = 'SP'.
    wa_header-vendor = wa_it_xvbpa-lifnr.
    endif.
    endloop.
    *data: it_komp type table of komp,
         wa_it_komp like line of it_komp.
         loop at it_komp into wa_it_komp.
         endloop.
    service PO is only for YLF delivery type.
    if wa_it_xlikp-lfart ne 'YLF'.
    exit.
    endif.
    shipping conditions.
    *case wa_it_xlikp-vsbed.
    *when '3P' or 'CP'.
    *exit.
    *endcase.
    wa_header-doc_type = 'YB'.
    wa_header-creat_date = sy-datum.
    wa_header-created_by = sy-uname.
    wa_header-vendor = '0005000000'.
    wa_header-comp_code = 'OB01'.
    wa_header-purch_org = 'OB01'.
    wa_header-pur_group = 'OB9'.
    wa_header-CURRENCY = 'USD'.
    wa_header-vper_start = '20061118'.
    wa_header-vper_end = '20061126'.
    wa_header-ref_1 = 1.
    wa_header-incoterms1 = 'AOS'.
    wa_header-incoterms2 = ''.
    wa_header-our_ref = 'N'.
    wa_headerx-comp_code = c_x.
    wa_headerx-doc_type = c_x.
    wa_headerx-creat_date = c_x.
    wa_headerx-created_by = c_x.
    wa_headerx-vendor = c_x.
    wa_headerx-purch_org = c_x.
    wa_headerx-pur_group = c_x.
    wa_headerx-vper_start = c_x.
    wa_headerx-vper_end = c_x.
    wa_headerx-ref_1 = c_x.
    wa_headerx-incoterms1 = c_x.
    wa_headerx-incoterms2 = c_x.
    wa_headerx-our_ref = c_x.
    wa_poitem-po_item = '00010'.
    wa_poitem-short_text = 'Automatic generation - Freight'.
    wa_poitem-plant = '0089'.
    wa_poitem-quantity = '1'.
    *wa_poitem-MATERIAL = '10'.
    wa_poitem-NET_PRICE = '23.00'.
    wa_poitem-po_unit  = 'ACT'.
    wa_poitem-item_cat = 'D'.
    wa_poitem-acctasscat = 'K'.
    *wa_poitem-matl_group = 'S1'.
    *wa_poitem-pckg_no = '10'.
    APPEND wa_poitem TO i_poitem .
    wa_poitemx-po_item = '00010'.
    *wa_poitemx-po_itemx = c_x.
    wa_poitemx-short_text = c_x.
    wa_poitemx-plant = c_x.
    wa_poitemx-quantity = c_x.
    wa_poitemx-net_price = c_x.
    wa_poitemx-po_unit = c_x.
    wa_poitemx-tax_code = c_x.
    wa_poitemx-item_cat = c_x.
    wa_poitemx-acctasscat = c_x.
    wa_poitemx-matl_group = c_x.
    wa_poitemx-pckg_no = c_x.
    APPEND wa_poitemx TO i_poitemx.
    wa_poitem_sch-po_item = wa_poitem-po_item .
    **wa_poitem_sch-delivery_date = ''.
    APPEND wa_poitem_sch TO i_poitem_sch.
    wa_poitem_schx-po_item = wa_poitem-po_item.
    wa_poitem_schx-po_itemx = c_x.
    wa_poitem_schx-delivery_date = c_x.
    APPEND wa_poitem_schx TO i_poitem_schx.
    wa_acct_***-po_item = wa_poitem-po_item.
    wa_acct_***-serial_no = 01.
    wa_acct_***-gl_account = '5210'.
    wa_acct_***-co_area = 'OB01'.
    wa_acct_***-costcenter = '36089'.
    wa_acct_***-funds_ctr = 'DUMMY'.
    APPEND wa_acct_*** TO i_acct_***.
    wa_acct_assx-po_item = wa_poitem-po_item.
    wa_acct_assx-serial_no = 01.
    wa_acct_assx-po_itemx = c_x.
    wa_acct_assx-serial_nox = c_x.
    wa_acct_assx-gl_account = c_x.
    wa_acct_assx-co_area = c_x.
    wa_acct_assx-costcenter = c_x.
    wa_acct_***-funds_ctr = c_x.
    APPEND wa_acct_assx TO i_acct_assx.
    *services/ limits
    *wa_BAPIESUHC-limit = '3000.00'.
    wa_BAPIESUHC-EXP_VALUE = '300.00'.
    wa_BAPIESUHC-no_limit = 'X'.
    *wa_BAPIESUHC-NO_FRLIMIT = 'X'.
    append wa_bapiesuhc to i_polimits.
    wa_services-pckg_no = '20'.
    wa_services-line_no = '2'.
    wa_services-service = '0005000000'.
    wa_services-subpckg_no = '10'.
    wa_services-quantity = '100'.
    wa_services-gr_price = '100'.
    wa_services-userf1_txt = 'TEXT'.
    wa_services-from_line = '1'.
    wa_services-to_line = '2'.
    APPEND wa_services TO i_services.
    wa_srvacc-pckg_no = '20'.
    wa_srvacc-line_no = '1'.
    wa_srvacc-serno_line = '02'.
    wa_srvacc-serial_no = '02'.
    wa_srvacc-percentage = '100'.
    APPEND wa_srvacc TO i_srvacc.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = wa_header
    poheaderx = wa_headerx
    POADDRVENDOR =
    TESTRUN =
    MEMORY_UNCOMPLETE =
    MEMORY_COMPLETE =
    POEXPIMPHEADER =
    POEXPIMPHEADERX =
    VERSIONS =
    NO_MESSAGING =
    NO_MESSAGE_REQ =
    no_authority = c_x
    no_price_from_po = c_x
    IMPORTING
    exppurchaseorder = ws_po
    EXPHEADER =
    EXPPOEXPIMPHEADER =
    TABLES
    return = i_return
    poitem = i_poitem
    poitemx = i_poitemx
    POADDRDELIVERY =
    poschedule = i_poitem_sch
    poschedulex = i_poitem_schx
    poaccount = i_acct_***
    *POACCOUNTPROFITSEGMENT =
    poaccountx = i_acct_assx
    POCONDHEADER =
    POCONDHEADERX =
    POCOND =
    POCONDX =
    POLIMITS = i_polimits
    POCONTRACTLIMITS =
    poservices = i_services
    posrvaccessvalues = i_srvacc
    POSERVICESTEXT =
    EXTENSIONIN =
    EXTENSIONOUT =
    POEXPIMPITEM =
    POEXPIMPITEMX =
    POTEXTHEADER =
    POTEXTITEM =
    ALLVERSIONS =
    POPARTNER =
    ***confirms the document creation by database commit.
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT          = 'X'
    IMPORTING
      RETURN        =
    LOOP AT i_return INTO wa_return.
       WRITE wa_return-message.
    ENDLOOP.

    Fill this tables:
    GT_POSRVACCESSVALUES  TYPE STANDARD TABLE OF BAPIESKLC,
    GT_POCONTRACTLIMITS   TYPE STANDARD TABLE OF BAPIESUCC,
    Glauco

  • Getting error Maintain services or limits while calling BAPI_PO_CREATE1

    Hi All,
    I am facing the problem with the BAPI for creating the Open Purchase Orders.
    I am using the BAPI_PO_CREATE1 and getting the error "Please maintain services or limits".
    I have check all the field which are required in the POSERVIES table and populating the same. But still getting the same error.
    Can any one please suggest me how to solve this error.
    Thanks for Helping.
    Regards
    Balu

    Hi Akash,
    May be for particular Document type you need to pass Payment terms..
    so pass value for Payment term and also pass 'X' in POHEADERX for payment terms...
    Regards,
    Ankit.

  • Getting error in bapi_po_create1 'Please maintain services or limits '

    Hi People,
    I am trying to create a service purchase order using Bapi_po_create1...... i have used POSERVICES ( LINE_NO ,
    SERVICE,  QUANTITY ,  GR_PRICE ,   MATL_GROUP,    FORM_VAL1,   FORM_VAL2 )  ( i also added header, item,
    schedule, account, details ) and when i execute this bapi  iam getting the following error :
    ' Please maintain services or limits  '
    I couldnt solve this issue ..........can you people tel me what are fields that need to be filled and how to solve this error ?
    ( i checked the threads but not able to find the solution ) ?
    Thanks in Advance,
    Siva

    Hi
    I think you missed some more fields. Check this:
    Field OUTL_IND is used to flag a line as an outline line. The service lines are assigned to the outline lines using the fields PCKG_NO (for the service line) and SUBPCKG_NO (for the outline line).
    The outline hierarchy is mapped using the fields LINE_NO and HI_LINE_NO. Field HI_LINE_NO links to field LINE_NO of the hierarchically superior outline.
    I found the above data in the Documentation of the BAPI which can be seen in se37 tcode.
    Regards,
    VIshwa.

  • SE029 Please Maintain Services or Limits

    Hi;
    For Account Assign K and item category D, I am trying to raise a PO, But I want to remove services or limits from mandatory fields and make them optional...Where can I make this setting?
    Thanks

    Hi,
    you can change the field selection in transaction ML90.
    Sorry, but I do not understand your problem, because it is a MUST in you use item category D for services to maintain services or limits or both. You can not save a service purchase item without entering limits or services (or both)....
    Regards,
    Edit

  • Service PO creation Using BAPI_PO_CREATE1

    Hi Friends,
    Can any body tell me how to create a service PO based on the existing service Agreement by using BAPI_PO_CREATE1 with sample code.
    Thanks,
    Kamlesh

    Hi Friends,
    Can any body tell me how to create a service PO based on the existing service Agreement by using BAPI_PO_CREATE1 with sample code.
    Thanks,
    Kamlesh

  • How to maintain Service Arrangements for employees in CRM 5.0

    Hello,
    in the CRM documentation on help.sap.com (http://help.sap.com/saphelp_crm50/helpdata/en/da/7d808043d244cf806dcf0d6e69381e/frameset.htm) it is mentioned that one can maintain service arrangements for employees. These service arrangements contain - for example - service areas and qualifications of the employee (ressource).
    I know where to maintain the customizing values, however, I didn't find out where to maintain the service arrangements for the employees.
    Any idea?
    Thanks & regards
    Wolfgang

    Hi ,
    for this you need to go to trnasaction PPOMA_CRM - Maintain Organizational Model
    and in this you need to open your organization model and there you need to assign employees.
    for this you need to select the post and right click on that and there is assign filed is there. after selecting that there is two position holder and owner.
    so you select holder for the position. then you can assign the employee to that service area.
    thanks
    hemant

  • Bapi_pr_create not working for package number for service and limits

    Hi Experts,
    I am copying the existing service and limits values from the existing package number to new package number using BAPI_PR_CREATE. I am getting Some error (In case of account assignment, please enter acc. assignment data for item).
    Please let me know any one get the solution for this problem. If anyone know some thing about this problem Please throw some light, so that I will check it out further.
    Thanks for you help in Advance.
    Regards,
    Nagaraju.

    Hello,
    I got almost the same problem.
    Im trying to copy existing PR's too, all works well until it comes to services. Functions return says to enter account data etc.
    How should i copy service records?
    Best regards
    P.S. Old function "BAPI_REQUISITION_CREATE" doesnt work because of Unicode system.

  • Problem in maintaining service user for CCM srm_cse

    Hello all,
    We are implementing SRM 4.0 (EBP 5.5) SSP scenario.
    To support shopping of EBP we are also implementing CCM 2.0 as an add on.
    Please note CCM and EBP are on same client and CAT & CSE are also on the same client.
    No XI is involved as the catalog will be only uploaded in CSV format.
    I am doing intial configurations for CAT and CSE.
    Now we know that we need to configure a service user in the service of srm_cse.
    I am adding the same in SRM client-> trans SICF -> default host -> sap -> bc -> bsp -> ccm -> srm_cse ->change service -> log on procedure- log on data reqd. -> Anonymous log on data - details of client, user, password, language.
    since my SRM and CCM are in same client I have put the same client no. and given the user with role "/CCM/CATALOG_SEARCH"
    But when I am saving this change in service I am getting an error messaeg that " Changes to Repository or cross-client Customizing are not permitted ".
    I am in a same client hence there is no question of cross client customizing .
    The other cause left is CHANGES TO REPOSITORY .
    Can anybody tell me where I should do config so that this "changes to repository" error message will be be corrected?
    Thanks for yr attention and apologies for lengthy matter.
    Kind Regards,
    Dinesh

    Hello Yann,
    Thanks a lot for your attention.
    But my question was regarding particular error I am getting while maintaining service user in the service "srm_cse" as given in my first message.
    Can you throw some light on that pl.?
    My client configration as per yr path is present.
    Regards,
    Dinesh

  • SAP Fiori - Transports Dev to QA/Prod issues (Activate and Maintain Service)

    Hi All,
        We have configured and activated Fiori - PO and PR scenarios in development environment using Central Hub Architecture (Gateway-Backend system). It is working great. However, we are facing an issue while transporting the configuration between the environments. We configured the entries (System Alias, Activate and Maintain Service and Scenario) for QA/Prod Environment in Development environment and transporting those (as it lets us to create TR's and as any SAP Configuration or technical Object). The transports are imported successfully, however the service is not activated or seen in "Activate and Maintain Services" in QA/Production Environment. But, scenario definition for PO and PR are imported successfully and visible
    Steps and Transports:
    1. System alias configured for QA/Production (Central hub) entries in Development box and transported - Successfully imported and entries are seen
    2. Activate and Maintain Service entries are configured (workbench request- Loads Oauth and Metadata along with the System Alias assigned) - Transport import successfully, However not seen in "Activate and Maintain Services" (tried even creating a customization TR's)
    3. Scenario Definition (PO and PR) - These are successfully imported as well as we are able to see the entries in SPRO
    Solution Options:
    1. Configure the entries and import (No success yet)
    2. Manually re-configure or Activate and Maintain Service in each system [QA/Prod] (Again, SAP let us transport for this step - So, my understanding option 1 should work).
    Any recommendation or suggestions ? Or is the Option 2 the only way to go!
    Thanks in advance
    Cheers,
    Sri

    Hi Sri,
    I think the Support Package for Gateway is old.
    1922510 - Activated Gateway Services are transported only incompletely
    Regards, Masa
    SAP Customer Experience Group - CEG

  • Maintaining Service Arrangement for Employees: Address type-ID not availabl

    Hello,
    I´m facing the following problem while implementing CRM Service via Best Practices for CRM V1.70:
    Building Block Configuration Guide C26 CRM SERVICE:
    Section 3.3.3 WFM Core Settings:
    3.3.3.1     Maintaining Service Arrangements for Employee
    Assignment Block u2018Service Arrangementsu2019:
    In Assignment block Location there is no address type-ID u2018XXDEFAULTu2019 for adress source u2018Organizationu2019. Thus I receive the following error message: u2018Enter a valid address usage typeu2019. Address type-ID u2018XXDEFAULTu2019 is only available for adress source u2018Individualu2019.
    What exactly do I have to do in order to make address type-ID u2018XXDEFAULTu2019 also available for adress source u2018Organizationu2019.
    Thanks in advance.
    Best regards,
    AEV

    Hi,
    I am facing similar problem what did you do to resolve it.
    Thanks in advance.
    Rahul

  • How to maintain two credit limits for the same customer.

    We have two lines of business for the same company code. One customer is trading in two lines of business.
    We want to maintain two credit limits for same customer. How is this possible.

    Hi,
    Credit Limits are assigned to customer master in a credit control area, so a customer can have different credit limits for the different credit control areas.
    (Please note that Credit Control Areas are normally assigned to company codes or sales area.)
    But if you are having only one credit control area, then only one credit limit can apply.
    However you can use the user exits to put any check you want for the customer. There are various user exits available for it like LVKMPTZZ,LVKMPFZ1,LVKMPFZ2 and LVKMPFZ3 in transaction SMOD
    Regards,
    Gaurav

  • SAP Custom Code Maintainability Service - SAP AG only

    As an Enterprise support customer I have a quick question on Custom Code Maintainability Service
    We have previously requested this service from SAP and they have generated and gave us the report.
    My question:
    Is this service ONLY being done by SAP, or are we (as customers) also allowed to run this service ourselves?.
    When I look in the services available I cannot find the service to create and run myself. I am currently putting in some serious time to set-up the custom code life cycle management (CCLM). As part of this I would also like to run the service and generate the report myself, as I have done with some other service like TEA (Transport execution analysis)
    I have no problems with using CDMC (Custom development management cockpit) and to generate reports there, but it would be nice to actually run the service and generate the report ourselves.
    Much apreciated your feedback.

    Hi Midhun,
    thank you for your quick response!
    I have already used SOAPUI to test my query.
    >it's creating an xml file in a specific format where you need to pass values to get the output.
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:ZGetcustomerWebservice>
             <!--Optional:-->
             <ImCount>5</ImCount>
             <!--Optional:-->
             <ImKunnr>
                <!--Zero or more repetitions:-->
             </ImKunnr>
          </urn:ZGetcustomerWebservice>
       </soapenv:Body>
    </soapenv:Envelope>
    Is this the xml file you mentioned?
    I checked the following blog and tried debugging, but I couldn't see any variables value...
    Debugging Custom Script in Integration Gateway
    Here is my custom code:
    function processRequestData(message) {
       message.setHeader("Authorization", "Basic XXXXXXXX=");
       importPackage(com.sap.gateway.ip.core.customdev.logging);
       importPackage(com.sap.gateway.ip.core.customdev.util);
       importPackage(org.apache.olingo.odata2.api.uri);
       importPackage(java.util);
       importPackage(com.sap.gateway.core.ip.component.commons);
       importPackage(com.sap.gateway.ip.core.customdev.api);
       parentMap = new LinkedHashMap();
       parentMap.put("IM_COUNT", "5");
       //Set the message body back
       message.setBody(parentMap);
       //Logger
       importPackage (com.sap.gateway.ip.core.customdev.logging);
       log.logErrors(LogMessage.TechnicalError, "This is first log"+message.getBody().toString());
      return message;
    Authorization is perfectly working but others are not.
    It would be great if you could have suggestions.
    BR,
    Hanae

  • TS4429 These are temporary fixes. is there a permanent way to maintain service since iOS 8.'

    SSince iOS 8, my iPads (I have 2) consistently display "No Service" in the status bar. I have tried all the recommended Aplle "fixes" but they only provide cellular access for short periods and then goes back to "No Service". Is there a way to get my iPads back to maintaining constant service as I have experienced for the 3 plus years prior to iOS 8?

    Hi blabla12345,
    (untested and without warranty)
    replace this line:
    const sSaveCUBE = "CUBE";
    with this:
    const sSaveCUBE = "cube";
    Have fun

  • Service fields problem in BAPI_PO_CREATE1 function

    hi all,
    I have a problem when I use BAPI_PO_CREATE1 to create a Purchasing order.
    I want to create a service PO in the system ( R3 4.6C ) .  I have the data from our key user and I can create PO sucessfully manually. But when using BAPI, It alway occurs a error.
    I use POSERVICE Structure, But i have NO idea about which field is MUST, Is there anyone have an example about these service PO??
    Any suggestion is helpful and thanks in advance.
    Regards
    Ned

    hi,
    WELCOME TO SDN.
    use this program for creating service po's using bapi.
    *& Report  ZMM_PO_CREATE1                                              *
    REPORT  ZMM_PO_CREATE1                          .
    data : POHEADER like BAPIMEPOHEADER occurs 0 with header line,
           POHEADERX like BAPIMEPOHEADERX occurs 0 with header line,
           POITEM like BAPIMEPOITEM occurs 0 with header line,
           POITEMX like BAPIMEPOITEMX occurs 0 with header line,
           POESLLC like BAPIESLLC occurs 0 with header line,
           POACCOUNT like BAPIMEPOACCOUNT occurs 0 with header line,
           POACCOUNTX like BAPIMEPOACCOUNTX occurs 0 with header line,
           POCONDHEADER like BAPIMEPOCONDHEADER occurs 0 with header line,
           POCONDHEADERX like BAPIMEPOCONDHEADERX occurs 0 with header line,
           POCOND like BAPIMEPOCOND occurs 0 with header line,
           RETURN like BAPIRET2 occurs 0 with header line.
    data : po_no(10).
    data : begin of it_head occurs 0,
           ref(10),
           bsart like ekko-bsart,
           lifnr like ekko-lifnr,
           ekorg like ekko-ekorg,
           ekgrp like ekko-ekgrp,
           bukrs like ekko-bukrs,
           verkf like ekko-verkf,
           telf1 like ekko-telf1,
           ihrez like ekko-ihrez,
           unsez like ekko-unsez,
           kdatb(10),
           kdate(10),
           end of it_head.
    data : begin of it_det occurs 0,
           ref(10),
           knttp like ekpo-knttp,
           pstyp like ekpo-pstyp,
           txz01 like ekpo-txz01,
           matkl like ekpo-matkl,
           werks like ekpo-werks,
           afnam like ekpo-afnam,
           ktext1 like esll-ktext1,
           srvpos like esll-srvpos,
           frmval1 like esll-frmval1,
           frmval2 like esll-frmval2,
           menge like esll-menge,
           kostl like eskn-kostl,
           sakto like eskn-sakto,
           zzcode like eskn-zzcode,
           kbetr like konv-kbetr,
           end of it_det.
    data : c_col1 TYPE i VALUE '0001',
           c_col2 TYPE i VALUE '0002',
           c_col3 TYPE i VALUE '0003',
           c_col4 TYPE i VALUE '0004',
           c_col5 TYPE i VALUE '0005',
           c_col6 TYPE i VALUE '0006',
           c_col7 TYPE i VALUE '0007',
           c_col8 TYPE i VALUE '0008',
           c_col9 TYPE i VALUE '0009',
           c_col10 TYPE i VALUE '0010',
           c_col11 TYPE i VALUE '0011',
           c_col12 TYPE i VALUE '0012',
           c_col13 TYPE i VALUE '0013',
           c_col14 TYPE i VALUE '0014',
           c_col15 TYPE i VALUE '0015',
           c_col16 TYPE i VALUE '0016'.
    data : v_currentrow type i,
           v_currentrow1 type i.
    data : itab_head like ALSMEX_TABLINE occurs 0 with header line,
           itab_det like ALSMEX_TABLINE occurs 0 with header line.
    data : file_head type RLGRAP-FILENAME,
           file_item type RLGRAP-FILENAME.
    file_head = 'C:\Documents and Settings\Desktop\head.xls'.
    file_item = 'C:\Documents and Settings\Desktop\item.xls'.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file_head
        i_begin_col                   = 1
        i_begin_row                   = 1
        i_end_col                     = 12
        i_end_row                     = 50
      tables
        intern                        = itab_head
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file_item
        i_begin_col                   = 1
        i_begin_row                   = 1
        i_end_col                     = 16
        i_end_row                     = 50
      tables
        intern                        = itab_det
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF itab_head[] IS INITIAL.
       WRITE:/ 'No Header Data  Exists '.
       STOP.
    ELSE.
    sort itab_head by row col.
    read table itab_head index 1.
    v_currentrow = itab_head-row.
    loop at itab_head.
    if itab_head-row ne v_currentrow.
       APPEND it_head.
       v_currentrow = itab_head-row.
       ENDIF.
    CASE itab_head-col.
            WHEN  c_col1.
              it_head-ref = itab_head-value.
            WHEN  c_col2.
              it_head-bsart = itab_head-value.
            WHEN c_col3.
              it_head-lifnr = itab_head-value.
            WHEN c_col4.
              it_head-ekorg = itab_head-value.
            WHEN c_col5.
              it_head-ekgrp = itab_head-value.
            WHEN c_col6.
              it_head-bukrs = itab_head-value.
            WHEN c_col7.
              it_head-verkf = itab_head-value.
            WHEN c_col8.
              it_head-telf1 = itab_head-value.
            WHEN c_col9.
              it_head-ihrez = itab_head-value.
            WHEN c_col10.
              it_head-unsez = itab_head-value.
            WHEN c_col11.
              it_head-kdatb = itab_head-value.
            WHEN c_col12.
              it_head-kdate = itab_head-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_head.
    CLEAR it_head.
    ENDIF.
    IF itab_det[] IS INITIAL.
       WRITE:/ 'No Item Data  Exists '.
       STOP.
    ELSE.
    sort itab_det by row col.
    read table itab_det index 1.
    v_currentrow1 = itab_det-row.
    loop at itab_det.
    if itab_det-row ne v_currentrow1.
       APPEND it_det.
       v_currentrow1 = itab_det-row.
       ENDIF.
    CASE itab_det-col.
            WHEN  c_col1.
              it_det-ref = itab_det-value.
            WHEN  c_col2.
              it_det-knttp = itab_det-value.
            WHEN c_col3.
              it_det-pstyp = itab_det-value.
            WHEN c_col4.
              it_det-txz01 = itab_det-value.
            WHEN c_col5.
              it_det-matkl = itab_det-value.
            WHEN c_col6.
              it_det-werks = itab_det-value.
            WHEN c_col7.
              it_det-afnam = itab_det-value.
            WHEN c_col8.
              it_det-srvpos = itab_det-value.
            WHEN c_col9.
              it_det-ktext1 = itab_det-value.
            WHEN c_col10.
              it_det-frmval1 = itab_det-value.
            WHEN c_col11.
              it_det-frmval2 = itab_det-value.
            WHEN c_col12.
              it_det-menge = itab_det-value.
            WHEN c_col13.
              it_det-kostl = itab_det-value.
            WHEN c_col14.
              it_det-sakto = itab_det-value.
            WHEN c_col15.
              it_det-zzcode = itab_det-value.
            WHEN c_col16.
              it_det-kbetr = itab_det-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_det.
    CLEAR it_det.
    ENDIF.
    loop at it_head.
    poheader-doc_type = it_head-bsart.
    poheader-vendor = it_head-lifnr.
    poheader-purch_org = it_head-ekorg.
    poheader-pur_group = it_head-ekgrp.
    poheader-comp_code = it_head-bukrs.
    poheader-sales_pers = it_head-verkf.
    poheader-telephone = it_head-telf1.
    poheader-REF_1 = it_head-ihrez.
    poheader-OUR_REF = it_head-unsez.
    poheader-VPER_START = it_head-kdatb.
    poheader-VPER_END = it_head-kdate.
    loop at it_det where ref = it_head-ref.
      poitem-acctasscat = it_det-knttp.
      poitem-item_cat = it_det-pstyp.
      poitem-short_text = it_det-txz01.
      poitem-matl_group = it_det-matkl.
      poitem-plant = it_det-werks.
      poitem-PREQ_NAME = it_det-afnam.
      POESLLC-SERVICE = it_det-srvpos.
      POESLLC-SHORT_TEXT = it_det-ktext1.
      POESLLC-FORM_VAL1 = it_det-frmval1.
      POESLLC-FORM_VAL2 = it_det-frmval2.
      POESLLC-QUANTITY = it_det-menge.
      POACCOUNT-COSTCENTER = it_det-kostl.
      POACCOUNT-GL_ACCOUNT = it_det-sakto.
      POCONDHEADER-COND_TYPE = 'R000'.
      POCONDHEADER-COND_VALUE = it_det-kbetr.
    endloop.
    endloop.
    poheaderx-doc_type = 'X'.
    poheaderx-vendor = 'X'.
    poheaderx-purch_org = 'X'.
    poheaderx-pur_group = 'X'.
    poheaderx-comp_code = 'X'.
    poheaderx-sales_pers = 'X'.
    poheaderx-telephone = 'X'.
    poheaderx-REF_1 = 'X'.
    poheaderx-OUR_REF = 'X'.
    poheaderx-VPER_START = 'X'.
    poheaderx-VPER_END = 'X'.
    poitemx-acctasscat = 'X'.
    poitemx-item_cat = 'X'.
    poitemx-short_text = 'X'.
    poitemx-matl_group = 'X'.
    poitemx-plant = 'X'.
    poitemx-PREQ_NAME = 'X'.
    *POESLLCx-SHORT_TEXT = 'X'.
    POACCOUNTx-COSTCENTER = 'X'.
    POACCOUNTx-GL_ACCOUNT = 'X'.
    POCONDHEADER-cond_type = 'X'.
    CALL FUNCTION 'BAPI_PO_CREATE1'
      EXPORTING
        poheader                     = poheader
       POHEADERX                    = poheaderx
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
      POEXPIMPHEADER               =
      POEXPIMPHEADERX              =
      VERSIONS                     =
      NO_MESSAGING                 =
      NO_MESSAGE_REQ               =
      NO_AUTHORITY                 =
      NO_PRICE_FROM_PO             =
    IMPORTING
       EXPPURCHASEORDER             = po_no
      EXPHEADER                    =
      EXPPOEXPIMPHEADER            =
    TABLES
       RETURN                       = return
       POITEM                       = poitem
       POITEMX                      = poitemx
      POADDRDELIVERY               =
      POSCHEDULE                   =
      POSCHEDULEX                  =
       POACCOUNT                    = poaccount
      POACCOUNTPROFITSEGMENT       =
       POACCOUNTX                   = poaccountx
       POCONDHEADER                 = pocondheader
       POCONDHEADERX                = pocondheaderx
      POCOND                       =
      POCONDX                      =
      POLIMITS                     =
      POCONTRACTLIMITS             =
       POSERVICES                   = poesllc
      POSRVACCESSVALUES            =
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POEXPIMPITEM                 =
      POEXPIMPITEMX                =
      POTEXTHEADER                 =
      POTEXTITEM                   =
      ALLVERSIONS                  =
      POPARTNER                    =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          =
    IMPORTING
       RETURN        =
    if sy-subrc = 0.
    loop at return.
    write return-MESSAGE_V1.
    write po_no.
    endloop.
    endif.

Maybe you are looking for

  • Deploying ADF Application to OC4J Using Jdeveloper

    I tried to deploy an application to standalone OC4J using Jdeveloper, through a process similar to this: Deploying a Web Application http://www.oracle.com/technology/obe/obe1013jdev/10131/deployment/deployment.htm [making WAR for view-controller, JAR

  • DTD's and getElementById

    Hi folks... Im getting myself in too deep here ... I wish to build a DOM object containing NodeElements I add ... I need to find these elements by getElementById .. and I keep getting null exceptions when using that method. I know that the DOM recomm

  • Adding keywords to eps, ai, pdf & jpeg

    Hi I'm new to bridge and I'm also new to keywords/tagging so I need little help. I'm trying to tag files with keywords then upload them to a service called fluxiom (which is like an online portfolio). Fluxiom allows you to search your files by keywor

  • Firefox 2.0.0.14 Flash Plugin

    I've used the instructions on installing flash for firefox as described in the wiki: http://wiki.archlinux.org/index.php/Ins - _on_Arch64, and although it was supposed to work ( http://wiki.archlinux.org/index.php?tit - ldid=36561 ), it doesn't: [fla

  • 11gr2 single instance to rac

    I'm looking for information what the steps required to convert 11gr2 single instance to 2 nodes rac database for ECC 60 EHP7 (db 11.2.0.3 aix 7.1) Every experience will be helpful. regards pablo