Skip to Content
Author's profile photo Pavan Kumar Raju Sagiraju

Creating a Simple Service PO using BAPI_PO_CREATE1(BAPI_PO_CHANGE)

Introduction:


For creating a PO we have BAPI’s like  BAPI_PO_CREATE1 and  BAPI_PO_CREATE, for amending a PO we have BAPI_PO_CHANGE.

For these BAPI’s to work the minimum required data has to be provided.


It is pretty simple to create a normal PO, but little complexity comes in while creating a Simple Services(Services) PO. In this document I would like to deal majorly with creating and amending a services PO, what are the tables that has to be filled, what data that has to be passed to these fileds, where to get this data from and how, so that the BAPI works smooth as honey.


This task has been taken up by me as I see lot of posts on the titled text unanswered or not completely answered.



How to acheive it:


The tables highlighted in the below image are the ones that carry the services information to the BAPI. The information we fill in these tables are crucial (we are taking a scenario where a services PO has to be created from a services PR).


BAPI_PO_CREATE.PNG


    

The services line item information should be filled in the POSERVICES table and the accounting information of the service line should be filled in the table POSRVACCESSVALUES.



Filling the POSERVICES table:


Every service line will have a package number assigned to it and every package number has a sub-package number assigned to it.


It is the subpackage number that will have all the service line item information filled in it (like unit price,value,material group etc,) so filling this is very important.


ESLL is the table where all the package realted data is saved for services. It will have service line item related details.


As we are using the scenario where a PO is created from PR,for filling the the table POSERVICES we can use the ESLL entries of the PR. First get the package number of the PR line item(this information is available in EBAN table eban-packno). Pass this package number to ESLL table and get the corresponding sub-package number.


Pass this sub-package number to package number field of ESLL and get all the service line item details like unit price,value,material group etc.


Fill the above obtained data to the POSERVICES table as below.


Every service line item should have two entries in this table, 1 for package number and 2 for subpackage number


   1’st entry:

             poservicespckg_no       = esllpackno.          “Package number

             poservicesline_no         = esllintrow.            “Package Line number

             poservicesoutl_ind        = esllpackage.        “If this is X then it is a service line( because limits also have package numbers, this will act as                                                                                                                                                     differentiator)

             poservices-subpckg_no  = esllsub_packno.  “Sub-Package number

   2nd entry:

               poservicespckg_no        = esllsub_packno.                                         “Sub-Package number

               poservicesline_no          = esllintrow.                                                “Sub-Package line number

               poservicesquantity        = pass quantity(can use esll entry)                   “PO service quantity

               poservicesbase_uom      = pass UOM(can use esll entry)                        “Unit of measure

               poservicesprice_unit      = pass  Unit Price(can use esll entry)                 “Unit Price

               poservicesgr_price        = pass Net Value(can use esll entry)                  “Net value

               poservicesshort_text     = esllktext1.                                                 “Short text

               poservicesmatl_group    = esllmatkl.                                                   “Material Group

               poservicespln_pckg       = esllsub_packno                                            “Sub-Package number

               poservicespln_line         = esllintrow.                                                  “Sub-Package line number


The above mentioned are the minimum required fields that has to be passed.

       

Q: Why poservicespln_pckg and poservicespln_line has to be passed ?


A: When a Shopping cart is created in portal a PR will be created in ECC corresponding to it. When a PO is created in ECC refering to this       PR, in the Shopping cart also this PO number should be update in the related documents tab.

    Only when you pass the above two fields this will happen.


Filling the POSRVACCESSVALUES table:


As mentioned above this table will have the acounting information of the service line. This table will have only one entry corresponding to the service line.


The accounting information of a service line is stored in the table ESKL with reference to sub-package number of the above service line item.


So take the above sub-package number, pass it to the package number field of the ESKL table and get the accounting details.


Fill the above obtained data to the POSRVACCESSVALUES table as below.



                posrvaccessvaluespckg_no      = esklpackno.                                            “Sub-Package number of ESLL entry

                posrvaccessvaluesline_no        = esklintrow.                                              “Line number of eskl

                posrvaccessvaluesserno_line    = esklnumkn.                                             “Seq. Number of Acc. Assignment Specification: Service Line

                posrvaccessvaluesserial_no      = esklzekkn.                                              “Sequential Number of Account Assignment in ESKN

                posrvaccessvaluesquantity       = pass quantity(can use eskl entry)       “PO service quantity


This way both the services tables should be filled and passed to BAPI.

*Note: Along with these tables all the required tables as shown in the above screen shot are also to be filled for the BAPI to work. Here we only covered service realted data.




Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Pavan ,

      I am passing the pack_no from ESLL to POSERVICES structure . PO creation is successful but its giving update termination error message as it tries to insert new entry in ESLH table for same package number.

      When I hardcoded package and subpackage number to 000000001 and 000000002 , PO created successfully and these packages are created and updated in ESLH/ ESLL. But when running second time... getting same termination message.

      Does these packages get newly created or is it just reference of package BAPI uses ?

      Author's profile photo Pavan Kumar Raju Sagiraju
      Pavan Kumar Raju Sagiraju
      Blog Post Author

      What is the scenario....yor are trying to create a simple service scenario or complex service scenario(Limits)??

      A new package number will be created for PO. If you are trying to change the PO data, it is this package number you need to mention.

      Author's profile photo Former Member
      Former Member

      This is simple service scenario where I need to get services details from central contract (ME33K) and use this to create work order (ME23N).

      I am not populating POSRVACCESSVALUES as no entries present in ESKL for contract's package no. ( This should not be an issue).

      Main concern is , if I pass some random number to PACK_NO , system creates this package automatically. My program will be running daily , so I cant hard code anything.

      Is there any way , so that package number (internal number) will be created by SAP and I don't need to mention any value. But in this case , how to map

      poservices-pckg_no  to poitem-pack_no.

      Author's profile photo Former Member
      Former Member

      This is to provide update, When we approched SAP they suggested us few SAP notes and asked one program to run which resolves the number range problem and creates number assignment for PO service lines by itself. So to conclude, pass package and subpackage number as 000000001 and 000000002 respectively to BAPI and SAP should generate new number for package and subpackage. If its not th case, do not waste much time and raise it to SAP.

      Author's profile photo Former Member
      Former Member

      Just an addition  to use it with Purchase Requuest.

      On the POITEM table, fill  PREQ_NO and PREQ_ITEM