Bapi BAPI_POEC_CREATE I_PO_LIMIT problem

Hi all,
I have the problem with creation of BAPI_POEC_CREATE and limit position.
If I create the Purchase Order without Limit Position the badi work correctly, if I create the Purchase Order with limit position and I the structure I_PO_LIMIT is valued, the badi doesn't work and generate the below message:
BBP_PD 386 For purchase orders with limit, a limit must be specified (and only here)
Any suggestion?
Thanks.
Kindly regard.
Salvatore

Hi Atul,
Thanks for your help.
Now I post my code, this is an example program for create PO from Contract, may be copy and past in abap editor on SRM 5.5 system.
Also, I have checked the new notes posted, but not work.
program ztest02.
DATA: event        TYPE REF TO cl_htmlb_event,
  head_ctr     type BBP_PDS_ctr_HEADER_D,
  org_data     type HRS_OBJEC,
  ctr_org      type BBPT_PDS_ORG,
  wa_ctr_org   type BBP_PDS_ORG,
  wa_obj       type CRMD_ORDERADM_H-OBJECT_ID,
  bapi_head_po type BAPI_PO_HEADER_C,
     ret          type table of BAPIRET2,
  lt_item_ctr  type table of BBP_PDS_CTR_ITEM_D,
  wa_item_ctr  type BBP_PDS_CTR_ITEM_D,
  lt_item_po   type table of BAPI_PO_ITEM_C,
  wa_item_po   type BAPI_PO_ITEM_C,
  lt_part_ctr  type table of BBP_PDS_PARTNER,
  wa_part_ctr  type BBP_PDS_PARTNER,
  lt_part_po   type table of BAPI_BUP_C,
  wa_part_po   type BAPI_BUP_C,
  lt_org_ctr   type table of BBP_PDS_ORG,
  wa_org_ctr   type BBP_PDS_ORG,
  lt_org_po    type table of BAPI_ORG_C,
  wa_org_po    type BAPI_ORG_C,
  lv_item_number     TYPE bbp_item_no,
  lt_text      type BBPT_PDS_LONGTEXT,
  wa_text      type BBP_PDS_LONGTEXT,
  lt_po_text   type TABLE OF BAPI_TEXT_I,
  wa_po_text   type BAPI_TEXT_I,
  lt_att_ctr   TYPE BBPT_PDS_ATT_T,
  wa_att_ctr   type BBP_PDS_ATT_T,
  lt_att_po    type TABLE OF BAPI_ATT_C,
  wa_att_po    type BAPI_ATT_C,
  lt_limit     type table of BAPI_LIMIT_C,
  ls_limit     type BAPI_LIMIT_C,
e_bapi_hpo type BAPI_PO_HEADER_D,
e_item_po type table of BAPI_PO_ITEM_D,
ewa_item_po type BAPI_PO_ITEM_D,
*event = cl_htmlb_manager=>get_event( runtime->server->request ) .
*DATA: event        TYPE REF TO cl_htmlb_event,
     head_ctr     type BBP_PDS_ctr_HEADER_D,
     org_data     type HRS_OBJEC,
     ctr_org      type BBPT_PDS_ORG,
     wa_ctr_org   type BBP_PDS_ORG,
     wa_obj       type CRMD_ORDERADM_H-OBJECT_ID,
     bapi_head_po type BAPI_PO_HEADER_C,
     ret          type table of BAPIRET2,
     lt_item_ctr  type table of BBP_PDS_CTR_ITEM_D,
     wa_item_ctr  type BBP_PDS_CTR_ITEM_D,
     lt_item_po   type table of BAPI_PO_ITEM_C,
     wa_item_po   type BAPI_PO_ITEM_C,
     lt_part_ctr  type table of BBP_PDS_PARTNER,
     wa_part_ctr  type BBP_PDS_PARTNER,
     lt_part_po   type table of BAPI_BUP_C,
     wa_part_po   type BAPI_BUP_C,
     lt_org_ctr   type table of BBP_PDS_ORG,
     wa_org_ctr   type BBP_PDS_ORG,
     lt_org_po    type table of BAPI_ORG_C,
     wa_org_po    type BAPI_ORG_C,
  ret          type table of bapiret2.
data : msg type table of BBP_PDS_MESSAGES,
       wa_msg type bapiret2.
*wa_obj = '4400001124'.
if 1 eq 1.
  wa_obj = '4400001220'.
  CALL FUNCTION 'BBP_PD_CTR_GETDETAIL'
   EXPORTING
     I_OBJECT_ID               = wa_obj
   IMPORTING
     E_HEADER                  = head_ctr
     ET_ATTACH                 = lt_att_ctr
  ET_CONDITIONS             =
TABLES
   E_ITEM                    = lt_item_ctr
   E_PARTNER                 = lt_part_ctr
   E_LONGTEXT                = lt_text
   E_ORGDATA                 = lt_org_ctr
  E_MESSAGES                =
  E_HCF                     =
  E_ICF                     =
  E_ACTVAL                  =
  E_ACC_ACTVAL              =
  E_HEADER_REL              =
  E_ITMLIM_REL              =
  E_TOL                     =
  E_DIS                     =
  E_STATUS                  =
  E_VERSION                 =
*controllare che l'Organizzazione acquisti dell'utente che crea ordine sia nel contratto
  CALL FUNCTION 'BBP_OM_STRUC_GET_ORG_FROM_USER'
    EXPORTING
      USER                    = sy-uname
    IMPORTING
      ORGUNIT                 = org_data
    EXCEPTIONS
      PATH_NOT_FOUND          = 1
      ERROR_READING_STRUCTURE = 2
      NO_ROOTS                = 3
      INVALID_ROOTS           = 4
      INTERNAL_ERROR          = 5
      USER_NOT_ASSIGNED       = 6
      OTHERS                  = 7.
  read TABLE lt_org_ctr into wa_org_ctr index 1.
if wa_ctr_org-PROC_ORG_OT ne org_data-OTYPE or
    wa_ctr_org-PROC_ORG_ID ne org_data-OBJID.
   message = 'L\''utente non ha i permessi adeguati per la creazione dell\''ordine'.
endif.
  if 1 eq 1.
    MOVE-CORRESPONDING head_ctr to bapi_head_po.
    bapi_head_po-process_type = 'ECPO'.
    bapi_head_po-LOGSYS_FI = 'SV4CLNT100'.
    bapi_head_po-EXT_DEM_LOGSYS = 'SV5_100'.
    bapi_head_po-gr_ind = 'X'.
    bapi_head_po-CO_CODE = 'Z001'.
    bapi_head_po-BUSINESSPROCESS = head_ctr-guid.
    clear lv_item_number.
    loop at lt_item_ctr into wa_item_ctr.
      lv_item_number             = lv_item_number + 1.
      MOVE-CORRESPONDING wa_item_ctr to wa_item_po.
      wa_item_po-ITEM_GUID = wa_item_ctr-guid.
      wa_item_po-ITEM_NUMBER = lv_item_number.
      wa_item_po-category_guid = wa_item_ctr-category.
      wa_item_po-PRODUCT_SRC_SYS = wa_item_ctr-LOGSYS_FI.
      wa_item_po-CTR_NUMBER = head_ctr-object_id.
      wa_item_po-CTR_GUID = head_ctr-GUID.
      wa_item_po-CTR_ITEM_NUMBER = wa_item_ctr-NUMBER_INT.
     wa_item_po-subtype = 'EP'.
      wa_item_po-PRODUCT_SRC_SYS = 'SV5_100'.
      append wa_item_po to lt_item_po.
      MOVE-CORRESPONDING wa_item_po to ls_limit.
      ls_limit-PARENT_GUID = wa_item_ctr-guid.
     ls_limit-LIM_REF_H_GUID = wa_item_ctr-guid.
      ls_limit-LIMIT = wa_item_ctr-PRICE.
      ls_limit-EXP_VALUE = wa_item_ctr-PRICE * 50.
      ls_limit-LIM_REF_LOG_SYS = 'SV4CLNT100'.
     ls_limit-lim_type = 'G'.
      ls_limit-unlimited = 'X'.
       ls_limit-LIM_REF_H_ID = bapi_head_po-DOC_NUMBER.
       ls_limit-LIM_REF_I_ID = wa_item_po-ITEM_NUMBER.
       ls_limit-LIM_REF_H_GUID = head_ctr-guid.
       ls_limit-LIM_REF_I_GUID = wa_item_po-ITEM_GUID.
      append ls_limit to lt_limit.
    endloop.
    loop at lt_part_ctr into wa_part_ctr.
      if wa_part_ctr-PARTNER_FCT ne 51 and
         wa_part_ctr-PARTNER_FCT ne 38 and
         wa_part_ctr-PARTNER_FCT ne 26.
        MOVE-CORRESPONDING wa_part_ctr to wa_part_po.
        wa_part_po-PARTNER_guid = wa_part_ctr-PARTNER_NO.
        append wa_part_po to lt_part_po.
      endif.
      if wa_part_ctr-PARTNER_FCT eq 26.
        MOVE-CORRESPONDING wa_part_ctr to wa_part_po.
        wa_part_po-PARTNER_guid = wa_part_ctr-PARTNER_NO.
        move '00000016' to wa_part_po-PARTNER_FCT.
        append wa_part_po to lt_part_po.
      endif.
      clear : wa_part_ctr,wa_part_po.
    endloop.
    loop at lt_org_ctr into wa_org_ctr.
      MOVE-CORRESPONDING wa_org_ctr to wa_org_po.
      wa_org_po-parent_guid = head_ctr-guid.
      append wa_org_po to lt_org_po.
    endloop.
   tabelle testi
    loop at lt_text into wa_text.
      wa_po_text-PARENT_GUID = wa_text-GUID.
      wa_po_text-TEXT_ID = wa_text-TDID.
      wa_po_text-TEXT_LINE = wa_text-TDLINE.
     wa_po_text-LANGU_ISO = wa_text-TDSPRAS.
      append wa_po_text to lt_po_text.
    endloop.
   tabella allegati
    loop at lt_att_ctr into wa_att_ctr
       where p_guid eq head_ctr-guid.
      MOVE-CORRESPONDING wa_att_ctr to wa_att_po.
      wa_att_po-PARENT_GUID = wa_att_ctr-P_GUID.
      wa_att_po-url = wa_att_ctr-DISP_URL.
     wa_att_po-classname = wa_att_ctr-phio_class.
      wa_att_po-doc_id = wa_att_ctr-phio_objid.
      append wa_att_po to lt_att_po.
    endloop.
    CALL FUNCTION 'BAPI_POEC_CREATE'
      EXPORTING
        I_PO_HEADER            = bapi_head_po
    I_PO_HEADER_CUST       =
    I_TESTRUN              = 'X'
      IMPORTING
        E_PO_HEADER            = e_bapi_hpo
    E_PO_HEADER_CUST       =
      TABLES
        I_PO_ITEMS             = lt_item_po
    I_PO_ITEMS_CUST        =
    I_PO_ACCASS            =
    I_PO_ACCASS_CUST       =
       I_PO_PARTNER           = lt_part_po
       I_PO_TEXT              = lt_po_text
      I_PO_ATTACH            = lt_att_po
      I_PO_ORGDATA           = lt_org_po
    I_PO_LIMIT             = lt_limit
    I_PO_SDLN              =
     E_PO_ITEMS             = e_item_po
    E_PO_ITEMS_CUST        =
    E_PO_ACCASS            =
    E_PO_ACCASS_CUST       =
    E_PO_PARTNER           =
    E_PO_ORGDATA           =
    E_PO_LIMIT             =
    E_PO_SDLN              =
    E_PO_TEXT              =
    E_PO_STATUS            =
    E_PO_ATTACH            =
       RETURN                 = ret
    commit work AND WAIT.
  endif.
endif.
Regards.

Similar Messages

  • BAPI parameters mismatch problem

    Hi All,
    I have been assigned to object wherein i need to insert bapi BAPI_GOODSMVT_CREATE in function module ZQM06_FM_TASK_GOODS_MOVEMENT. The problem is that i need to fill the structure that i can pass it to BAPI but the import parameters of FM ZQM06_FM_TASK_GOODS_MOVEMENT contain  structure that is mismatching. I mean to say that the FM is importing VIQMEL data and from that data i need to fill up structure that would be paased to Bapi BAPI_GOODSMVT_CREATE .
    As of now i am not able to map data into structure from VIQMEL so is there any FM or BAPI available for which i can pass VIQMEL data and it returnns me sales order data which in turn i can pass it to the specified bapi BAPI_GOODSMVT_CREATE ?
    Your response is highly appreciable.
    Thanks & Regards,
    Parag

    Hi Parag,
    There is no any such function module to pass the data from Bapi to normal function modules.
    If the structure of the Function modules are different, only way is finding the matching fields of the both function modules.
    Check what all are the matching fields and populate internally after calling the Bapi BAPI_GOODSMVT_CREATE fm. within the function module code itself. Then commit your work. It will definitely work.
    But increases the program overhead for you populating and checking all the fields. It is the way to solve this issue.
    Because BAPI structures some times will not match with standard structures.
    First you try to populate the Item data, with structure BAPI2017_GM_ITEM_CREATE. if this is done correctly you can handle the rest.
    Regards,
    Santosh Kumar M.

  • RFC Lookup - BAPI-TABLE Parameters problem

    Hello All,
    I had a scenario where i need to export parameters and am supposed to get import parameters from BAPI between source and target structures.
    like -
    source --> BAPI execution = result --> target
    We had succeeded in getting those but the only problem is with TABLE parameters in that BAPI.
    How can we achieve it.
    Faster reply would be appreciated.
    Thanks & regards
    Reddy

    Hi VJ,
    Its not a simple source-target mapping .
    For Ex :
    Source-Bapi-Idoc
    Source will send some parameters to BAPI and bapi will execute it and respond with values in table parameter of the bapi and result would be assigned to idoc-field.
    For this i am using RFC Look up with sample code as :
    String rfcxml ="<ns0:Z_BAPI xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\">" +
    "     <A>" + A + "</A>" +       --- Export parameters
    "     <B>" + B + "</B>" +       --- Export parameters
    //"                       <TABLE><FIELD1>" + FIELD2 + "</FIELD1></TABLE>" +
    //"                       <TABLE><FIELD2>" + FIELD2 + "</FIELD2></TABLE>" +
    //"                       <TABLE><FIELD3>" + KDMAT+ "</FIELD3></TABLE>" +
    //          "<FIELD1>" + FIELD1 + "</FIELD1>" +
    "</ns0:Z_BAPI> "  ;
    Passing A & B as export parameters and getting TABLE-FIELD1&2&3 as response.
    I hope some problem in the syntax.
    Regards,
    HP

  • BAPI Web Service problem...

    Hi everyone,
    I do not success executing a simple BAPI like BAPI_COMPANYCODE_GETLIST.
    In my Controller : I connect the controller to the model and "drag and drop" the Request_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST context.
    In the wdDoInit() method, I wrote :
        Request_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST req =
             new Request_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST();
         wdContext.nodeRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST().bind(req);
    No need to initialize a parameter because the BAPI doesn't required.
    I created a method for the execution:
      public void executeWS( )
        //@@begin executeWS()
        try {
             wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement().modelObject().execute();
             wdContext.nodeResponse().invalidate();
        } catch(Exception e) {
        //@@end
    I the logical port located in the model, I did not change anything. But something is strange. The target address is, lets say, : http://<server>:<port>/sap/bc/soap/rfc.
    If I copy and past this URL to my internet browser, I get: "The page cannot be displayed".
    Can someone help me ?
    Thank you in advance.

    Hi David,
    As you said, when you are giving URL, got from logical port of the model, in browser. You get page can not be displayed, right?
    Means, there is problem in link to your WSDL file location.
    And for setting username and password, don following.
    before executing your model set your username and password.
    wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement()._setUsername("<user name>");
    wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement()._setPassword("<password>");
    if you want to check that url then type following:
    http://<server>:<port>/sap/bc/soap/rfc?wsdl
    Let me know the status,
    Regards,
    Bhavik
    wdco
    Message was edited by: Bhavik Devisha

  • Error message for BAPI BAPI_POEC_CREATE

    Hi All,
    I am using this function module BAPI_POEC_CREATE to create purchase order in srm system.
    I have executed this bapi i am getting below error messages...
    I   BBP_PD               184 Purchase order 0000000068-  has been created
    E  BBP_UI_PO            045 Output: No details for medium Printer in supplier master record
    E  BS                   013 System status INCM is active (Purchase Order 68)
    I am not able to see the PO 68 which is created above in SRM system.Neighter it is shown in BBP_PD.
    also it is asking for output details for supplier. I have maintained in Maintain bussiness partner the output medium for the vendor in contact Tab.where else i need to maintain these values.
    also the error message mentioning INCM is active, i am not getting what it means
    Any body worked on this BAPI befor pls. help me.
    Abdul Raheem

    Hi,
    System Status INCM is active implies that your document is "Incomplete". There is an error and hence you cannot validate it, only park it.
    System status prevents you from ordering/submitting/validating the document until you correct the error.
    So could you please check the error message in RZ20?
    Regards,
    Nikhil

  • BAPI FM Parameters problem

    Hi,
    I have  created BAPI using the Zfunction Module. Now this is working fine.
    Now i have changed the parameteres in Z FM. When I executed the BAPI. It is giving error. So, i have re generated the BAPI. But new parameters are not coming in BAPI.
    My doubt is, after changes in FM, in BAPI What steps i have to do. is re generate enough? or any thing i have to do?
    Regards,
    Balu

    Hi,
    Check the source code of the BAPI if it matches with the changed parameters of the Z Function Module. If it was working fine  before, the problem must lie in the source code of the BAPI where the Z Function Module parameters are passed.
    Regards,
    Vik

  • Calling Multiple BAPI's - LUW problem

    Hi All,
    I am calling multiple BAPI's in a program. After Executing First BAPI - the database is updated after the commit work . but for the second BAPI the database is not commited.
    Any Suggestions.
    Thanks in Update.
    Rk.

    Hi,
    1) Are you getting any error messages after the second call?
    2) Are you calling the COMMIT WORK BAPI after each call, or just once after calling the BAPI twice?
    3) Is the second BAPI call dependent on the first BAPI call in terms of data?
    Provide more info on the BAPI you are calling and a code snippet of the program structure, the more information you provide, the more information you will get back from the forum.
    Regards,
    Chen

  • BAPI return message problem

    Hi All,
    I created BAPI for Sale order the order created successfully but the return message S -success  is not coming- but the error message the sale order is already exist. How to solve this. I used the returnmessage for BAPI - BAPIRETURN1.
    Thanks,
    Suresh Maniarasu
    Edited by: suresh maniarasu on May 23, 2009 12:20 PM

    Well S  is not coming because there is no Success. Its giving error that Order already exists in system. Seems like straightforward condition.

  • Bapi purchase oder problem

    While creating PO i am getting following three error, i am using bapi_create_po1 for me21n  , TRPO
    1. No instance of object type PurchaseOrder has been created. External reference:
    2. Purchase order still contains faulty items
    3. Unknown account assignment not defined for use here
    Please help
    Ankesh

    This is my Complete code below , waiting 4 ur reply
    *& Report  ZPURCHASE_ORDER_BAPI
    REPORT  ZPURCHASE_ORDER_BAPI.
    DATA PO_HEADER TYPE BAPIMEPOHEADER.
    DATA POHEADERX TYPE BAPIMEPOHEADERX.
    DATA PO_ITEM TYPE  BAPIMEPOITEM OCCURS 0 WITH HEADER LINE. " ITEM LEVEL
    DATA POITEMX TYPE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE. " ITEM LEVEL
    DATA PO_LIMITS TYPE BAPIESUHC OCCURS 0 WITH HEADER LINE.  " LIMIT DATA
    DATA PO_SERVICES TYPE BAPIESLLC OCCURS 0 WITH HEADER LINE. " TAX DATA
    DATA POSCHEDULE TYPE BAPIMEPOSCHEDULE OCCURS 0 WITH HEADER LINE . " DELIVERY SCDHULE DATA
    DATA POSCHEDULEX TYPE BAPIMEPOSCHEDULX OCCURS 0 WITH HEADER LINE . " DELIVERY SCDHULE DATA
    DATA SALESDOCUMENT TYPE BAPIMEPOHEADER-PO_NUMBER.
    DATA PO_ITEM_ACCOUNT_ASSIGNMENT     TYPE     BAPIEKKN OCCURS 0 WITH HEADER LINE.
    DATA POACCOUNT     LIKE     BAPIMEPOACCOUNT OCCURS 0 WITH HEADER LINE.
    DATA POACCOUNTX     LIKE     BAPIMEPOACCOUNTX OCCURS 0 WITH HEADER LINE.
    DATA V_MESSAGE TYPE STRING.
    DATA : RETURN LIKE BAPIRET2  OCCURS 0 WITH HEADER LINE.
    ********MESSAGE RELATED DATA
    DATA: GD_CURRENTROW TYPE I.
    DATA : PURCHASEORDER LIKE EKKO-EBELN.
    DATA: TOT_REC TYPE I,     "Total Records
         GD_UPDATE TYPE I,   "Main Table Increement Counter
         GD_LINES TYPE I,    "Success Table increement Counter
         W_TEXTOUT LIKE T100-TEXT. "VARIABLE TO GET ERRORLOG
    DATA : BEGIN OF IT_SUCCESS OCCURS 0,
            SALESDOCUMENT LIKE BAPIVBELN-VBELN,  "PROJECT
          END OF IT_SUCCESS.
    DATA V_TEXT TYPE CHAR33.
    DATA : BEGIN OF IT_ERROR OCCURS 0,
            SRNO(4),
            ERR_MSG(73) TYPE C,    "TO RETREIVE ERROR MESSAGES
         END OF IT_ERROR.
    DATA : SRNO(4).
    ****HEADER DATA.
    PO_HEADER-CREAT_DATE  = SY-DATUM.
    PO_HEADER-DOC_DATE    = SY-DATUM.
    PO_HEADER-DOC_TYPE    = 'TRPO'.
    *po_header-DOC_CAT =
    PO_HEADER-COMP_CODE   = '1000'.
    PO_HEADER-PURCH_ORG   = '1000'.
    PO_HEADER-PUR_GROUP   = '402'.
    PO_HEADER-VENDOR      = 'A000010'. "'JR00006'.
    PO_HEADER-CURRENCY    = 'INR'.
    PO_HEADER-VPER_START  = '20081001'.
    PO_HEADER-VPER_END    = '20081030'.
    PO_HEADER-LANGU       = 'E'.
    ****another header FOR INTERFACE
    POHEADERX-CREAT_DATE = SY-DATUM.
    POHEADERX-DOC_DATE   =  'X'.
    POHEADERX-DOC_TYPE   =  'X'.
    POHEADERX-COMP_CODE  = 'X'.
    POHEADERX-PURCH_ORG  =  'X'.
    POHEADERX-PUR_GROUP  =  'X'.
    POHEADERX-VENDOR     =  'X'.
    POHEADERX-CURRENCY   =  'X'.
    POHEADERX-VPER_START =  'X'.
    POHEADERX-VPER_END   = 'X'.
    PO_HEADER-LANGU      = 'X'.
    ****ITEM LEVEL DETAILS
    PO_ITEM-PO_ITEM     = '00010'.
    PO_ITEM-ACCTASSCAT  = 'D'.
    PO_ITEM-ITEM_CAT    = 'D'.
    PO_ITEM-SHORT_TEXT  = 'CEMENT'.     " SHORT TEXT
    PO_ITEM-MATL_GROUP  = '101001'.     " MAT GRP
    PO_ITEM-PLANT       = '1100'.     " PLANT
    PO_ITEM-STGE_LOC    =  'FG01'.   " STORAGE LOCATION
    PO_ITEM-TRACKINGNO  = '41'.  " DEPARTMENT CODE
    PO_ITEM-QUANTITY   = '1.00'.
    PO_ITEM-PO_UNIT    = 'AU'.
    PO_ITEM-PREQ_NAME  = 'Abc@xyz'.
    PO_ITEM-NET_PRICE  = '1000'.
    APPEND PO_ITEM.
    *** ITEM LEVEL DETAIL FOR INTERFACE
    POITEMX-PO_ITEM     = '00010'.
    POITEMX-ACCTASSCAT  = 'X'.
    PO_ITEM-ITEM_CAT    = 'X'.
    POITEMX-SHORT_TEXT  = 'X'.     " SHORT TEXT
    POITEMX-MATL_GROUP  = 'X'.     " MAT GRP
    POITEMX-PLANT       = 'X'.     " PLANT
    POITEMX-STGE_LOC    =  'X'.   " STORAGE LOCATION
    POITEMX-TRACKINGNO  = 'X'.  " DEPARTMENT CODE
    POITEMX-QUANTITY    = 'X'.
    POITEMX-PO_UNIT     = 'X'.
    POITEMX-PREQ_NAME   = 'X'.
    POITEMX-NET_PRICE   = 'X'.
    APPEND POITEMX.
    ******LIMIT DATA
    PO_LIMITS-LIMIT  =  '1000'.
    PO_LIMITS-EXP_VALUE = '1000'.
    APPEND PO_LIMITS.
    *****TAX DATA
    PO_SERVICES-TAX_CODE = 'JA'.
    APPEND PO_SERVICES.
    ****DELIVERY SCDDULE DATA.
    POSCHEDULE-PO_ITEM        = '00010'.
    POSCHEDULE-SCHED_LINE     = '0001'.
    POSCHEDULE-DEL_DATCAT_EXT =  'M'.
    POSCHEDULE-DELIVERY_DATE  = '102008'.
    POSCHEDULE-STAT_DATE      = '20081030'.
    APPEND POSCHEDULE.
    ****FOR INTERFACE DELIVERY DATA
    POSCHEDULEX-PO_ITEM        = '00010'.
    POSCHEDULEX-SCHED_LINE     = '0001'.
    POSCHEDULEX-DEL_DATCAT_EXT =  'X'.
    POSCHEDULEX-DELIVERY_DATE  = 'X'.
    POSCHEDULEX-STAT_DATE      = 'X'.
    APPEND POSCHEDULEX .
    *********PO ACCOUNT ASSIGNMENT.
    *POACCOUNT-PO_ITEM    = '00010'.
    *POACCOUNT-SERIAL_NO  = '01'.
    *POACCOUNT-CREAT_DATE = SY-DATUM.
    *POACCOUNT-GL_ACCOUNT = '0000400000'.
    *POACCOUNT-COSTCENTER = '0000001000' .
    *APPEND POACCOUNT .
    *POACCOUNTX-PO_ITEM    = '00010'.
    *POACCOUNTX-SERIAL_NO  = '01'.
    *POACCOUNTX-CREAT_DATE = 'X'.
    *POACCOUNTX-GL_ACCOUNT = 'X'.
    *POACCOUNTX-CO_AREA    = 'X'.
    *POACCOUNT-COSTCENTER  = 'X' .
    *APPEND POACCOUNTX.
    CALL FUNCTION 'BAPI_PO_CREATE1'
      EXPORTING
       POHEADER                     = PO_HEADER
       POHEADERX                    = POHEADERX
    *   POADDRVENDOR                 =
    *   TESTRUN                      =
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   POEXPIMPHEADER               =
    *   POEXPIMPHEADERX              =
    *   VERSIONS                     =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
    *   NO_PRICE_FROM_PO             =
    IMPORTING
       EXPPURCHASEORDER             = SALESDOCUMENT
    *   EXPHEADER                    =
    *   EXPPOEXPIMPHEADER            =
    TABLES
       RETURN                       =  RETURN
       POITEM                       = PO_ITEM
       POITEMX                      = POITEMX
    *   POADDRDELIVERY               =
       POSCHEDULE                   = POSCHEDULE
       POSCHEDULEX                  = POSCHEDULEX
       POACCOUNT                    =  POACCOUNT
    *   POACCOUNTPROFITSEGMENT       =
       POACCOUNTX                   =  POACCOUNTX
    *   POCONDHEADER                 =
    *   POCONDHEADERX                =
    *   POCOND                       =
    *   POCONDX                      =
       POLIMITS                     = PO_LIMITS
    *   POCONTRACTLIMITS             =
       POSERVICES                   = PO_SERVICES
    *   POSRVACCESSVALUES            =
    *   POSERVICESTEXT               =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   POEXPIMPITEM                 =
    *   POEXPIMPITEMX                =
    *   POTEXTHEADER                 =
    *   POTEXTITEM                   =
    *   ALLVERSIONS                  =
    *   POPARTNER                    =
    *   POCOMPONENTS                 =
    *   POCOMPONENTSX                =
    *   POSHIPPING                   =
    *   POSHIPPINGX                  =
    *   POSHIPPINGEXP                =
    *CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    * EXPORTING
    *   WAIT          =
    * IMPORTING
    *   RETURN        =
    IF SALESDOCUMENT <> SPACE.
      COMMIT WORK.
      ADD 1 TO GD_UPDATE.
      IT_SUCCESS-SALESDOCUMENT = SALESDOCUMENT.
      APPEND IT_SUCCESS.
      CLEAR :SALESDOCUMENT,PO_HEADER.
    *        REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
    ELSE.
      LOOP AT RETURN.
    *          IT_ERROR-SRNO = TAB-SRNO.
        IT_ERROR-ERR_MSG = RETURN-MESSAGE .
        APPEND IT_ERROR.
      ENDLOOP.
      CLEAR :SALESDOCUMENT,PO_HEADER.
    *        REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
    ENDIF.
    DESCRIBE TABLE IT_SUCCESS LINES GD_LINES.
    IF GD_LINES GT 0.
    *     Display result report column headings
      PERFORM DISPLAY_COLUMN_HEADINGS.
      PERFORM DISPLAY_SUCESS.
    ENDIF.
    * IF SUCESS FAILS Display Error Report
    DESCRIBE TABLE IT_ERROR LINES GD_LINES.
    IF GD_LINES GT 0.
      PERFORM ERRORHEADINGS.
      PERFORM ERRORREPORT.
    ENDIF.
    *&      Form  DISPLAY_COLUMN_HEADINGS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY_COLUMN_HEADINGS .
      WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
      SKIP.
      WRITE:2 'The following records inserted successfully:'(013).
      WRITE:/ SY-ULINE(15).
      FORMAT COLOR COL_HEADING.
      WRITE:/      SY-VLINE,
               (10) 'Sales order'(004), SY-VLINE.
      WRITE:/ SY-ULINE(15).
      "display_column_headings
    ENDFORM.                    " DISPLAY_COLUMN_HEADINGS
    *&      Form  DISPLAY_SUCESS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY_SUCESS .
      FORMAT COLOR COL_NORMAL.
      LOOP AT IT_SUCCESS.
        WRITE:/      SY-VLINE,
            (10)  IT_SUCCESS-SALESDOCUMENT, SY-VLINE.
        CLEAR IT_SUCCESS.
      ENDLOOP.
      WRITE:/ SY-ULINE(15).
      REFRESH: IT_SUCCESS.
      FORMAT COLOR COL_BACKGROUND.
    ENDFORM.                    " DISPLAY_SUCESS
    *&      Form  ERRORHEADINGS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ERRORHEADINGS .
      SKIP.
      WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
      SKIP.
      WRITE:2 'The following records failed during update:'(008).
      WRITE:/ SY-ULINE(104).
      FORMAT COLOR COL_HEADING.
      WRITE:/      SY-VLINE,
              (10) 'ERROR.'(009), SY-VLINE.
      WRITE:/ SY-ULINE(104).
      FORMAT COLOR COL_NORMAL.
    ENDFORM.                    " ERRORHEADINGS
    *&      Form  ERRORREPORT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ERRORREPORT .
      LOOP AT IT_ERROR.
        WRITE:/      SY-VLINE,
                (10) IT_ERROR-SRNO, SY-VLINE,
                 (40) IT_ERROR-ERR_MSG, SY-VLINE.
      ENDLOOP.
      WRITE:/ SY-ULINE(104).
      REFRESH: IT_ERROR.

  • Classic scenario CUF to R3

    I've been reading about Extended Classic Scenario (ECS) and how to get customer fields (CUF) to R3 using a BADI. Is something possible for the classic scenario also?
    I've defined CUF in INCL_EEW_PD_ITEM_CSF* and they show up, but I want to map the CUF to R3 fields.
    Maybe it's just a matter of defining the ZFields in the appropriate append-structure??
    Regards, Léon Hoeneveld

    Hi
    <u><b>Please go through the pointers/links for all detailed sample code and issues you are currently facing -></b></u>
    Re: Missing Fields
    Re: EBP PO Created by WF-BATCH
    Re: ECC Purchase Requisition Replication to SRM SC
    Re: Mapping fields in SRM with R/3
    Re: ACCOUNT ASSIGNMENT
    Re: Tax calculation
    Re: Add customer fields in Shopping cart and purchase order
    Re: Need info on how to set GR-IV indicator
    Re: PO created with status : Transfer Failed (E.Sys.)
    Re: Bapi BAPI_POEC_CREATE I_PO_LIMIT problem
    Re: Error in transmission with BBPSC01
    Re: Pass PO Customer Field to Backend System
    Re: Problem with BAPI_PO_CREATE1
    PO header CUF to ECC
    Re: Last delivery option in SRM
    <b>Hope this will definitely help.</b>
    Do let me know.
    Regards
    - Atul

  • Problem when creating a sales order with reference by BAPI

    I am facing one problem when creating Sales Order.
    <b>The scenario is like this while creating SO With reference to an Order type, a new SO will be automatically created with a diff order Type</b>.
    I am using "BAPI_SALESORDER_CREATEFROMDAT2".
    I am calling this BAPI in USEREXIT_REFRESH_DOCUMENT.
    Am I using the right exit to call this Bapi ?
    <b>Problems are like :
    1. Ref Sales Order creating without Sales Unit .
    2. "Object Status does not exist" error msg is coming for Header and Item level(when clicking the status tab and then object status pushbutton).</b> But if testing the bapi from SE37 in test sequence....no such problem persists.
    As for example in case of sales unit,in the debugging mode i have seen that BAPI uses a perform to fill the values in the VBAP structure.But after that when it come back to the main program VBAP remains blank.This ocuurs when the BAPI is called from the exit whereas  if tested from SE37, VBAP retains the value.
    Can u suggest in this ? This is very very urgent............
    Thx in Adv.........................

    Thanks........
    Your suggestion was a great help to me.I have used a custom FM and called it in <b>starting new task</b>.
    Since i am a university fresher working in SAP for nearly 1 year.....can you please explain me the difference between <b>in update task</b> and <b>starting new task</b>.Why the problem was occuring for which you have suggested to call a custom function module.
    what is V1 update and V2 update?Is it attached with asynchronous ans synchronous update.It would be a great help to me if you kindly clear my confusions....
    thanks in advance.

  • Error while creation of PUrchase order by using BAPI.

    Hi All,
       We are creating a purchase order thru BAPI ("BAPI_POEC_CREATE") and we are passing the following parameters ( I_PO_HEADER , I_PO_ITEMS , I_PO_ACCASS , I_PO_PARTNER and I_PO_ORGDATA)  to the bapi and after processing  we are getting the following error and Abend messages.
    Messages:
    1) Enter at least one item or one limit ( we have added line items in I_PO_ITEMS structure).
    2) Incorrect interface data for set 78 in method C.
    3) Interface data contains errors.
    Can anyone help me in fixing these errors inorder to proceed further.
    Regards
    Dharmaraju

    Hi there,
    Did you manage to sort this problem ?
    If not let me know
    I am using the same and know how to overcome
    Thanks
    Turlock
    T

  • BAPI for transaction FB01 with account posting key

    Hi,
    I have to use a BAPI for registering Invoices into the FI module through the FB01 transaction.
    I am trying to use the standard BAPI: BAPI_ACC_DOCUMENT_POST
    The problem is that this BAPI does not manage the account posting key (field BSCHL).
    Could anyone provide help?
    Thank you very much in advance.

    It is happening here in the BAPI
    CALL FUNCTION 'FI_GET_POSTING_KEY'
             EXPORTING
                  i_ktosl       = gs_accit-ktosl
             IMPORTING
                  e_bschs       = ld_bschs
                  e_bschh       = ld_bschh
                  e_umskz       = ld_umskz
             EXCEPTIONS
                  error_message = 1.
    As max pointed out, it is dependent on the transaction key(KTOSL).
    Srinivas

  • User id is not processed by BAPI

    Hi ,
    We are implementing SAP PM and developing interface with PI.
    Iam passing userid (technicians) to BAPI for  Dismantling/Installation of equipment as to track who has performed the action.
    The issue is PI is not taking the userid rather it is processing with  the PI system id .
    Please suggest  to resolve this issue.
    Regards
    Anil

    Hi Pete,
    Let me state my problem again...
    Xi interface sends a file which will contain data to create equipments. this will contain the user name field . The equipments created/changed by should be with this user ID.
    I create set of Equipments(Through BAPI) . My problem is i can create the Equipment with the user id given in the file. but when i use change transaction IE02 , i tried to populate sy-uname with the name given in the file just before call transaction IE02. it is not working.
    I tried using BAPI   BAPI_EQUI_CHANGE to change the changed by field but no luck.
    Any pointers on how to resolve this would be highly appreciated.
    Thanks and Regards
    Anil Kumar

  • How to debug a BAPI?

    Hi ABAPERs,
    i wanted to know that how you can debug a BAPI.
    My problem is i m working on one utility(report) in which BAPI is called to pull data from other system. I am exporting header level data and importing item data, reference data and selectionset data.
    But out of these three, BAPI is unable to retrieve iem level data. Now i wanted to debug this BAPI  but i can't and without debugging its not possible to know why only the item level data is not pulled
    Is there a way to debug a BAPI?

    Hello Uwe,
    There are no error messages returned by BAPI.
    I already tried testing the BAPI in remote system using tcode se37. But there i am able to pull the data correctly.
    I also tried remote debugging this BAPI by setting the breakpoint but the problem is since it is calling remote system it executes the whole BAPI without stopping at the break-point.
    This BAPI is giving me problem only if i m calling from one sytem to pull the data from remote system. This can't be the issue of RFC connection as I am able to retrieve other data successfully.
    Also this BAPI is working fine in development box and i have no clue why its showing strange behaviour in assurance system.
    For you information BAPI i am talking about is:
      read phrase details from destination system ********************
          CALL FUNCTION 'BAPI_BUS1091_GETDETAIL'
                            DESTINATION dest_rfc
           EXPORTING
      PHRASE_LANGUAGE                 = ' '
              scenario                        = espap_info_only_scenario
      KEY_DATE                        = SY-DATUM
      CHANGE_NUMBER                   =
         valfr                           = '01010001'
         valto                           = '31129999'
      FLG_KEY_DATE_SWITCH_ONLY        =
         flg_return_whole_interval       = true
       MULTLANGU_PARAMS                =
              flg_phrase_header               = true
              flg_phrase_text                 = true
      FLG_PHRASE_LONGTEXT             =
              flg_phrase_references           = true
              flg_phrase_selectionset         = true
              flg_selectionset                = true
      FLG_SELECTIONSET_TEXT           =
      FLG_LOCK_CATALOG                =
            TABLES
              return                          = l_return_tab
              phrase_header                   = l_phrase_head_ds_tab
              phrase_text                     = l_phr_text_ds_tab
      PHRASE_LONGTEXT                 =
              phrase_references               = l_phrase_ref_ds_tab
              phrase_selectionset             = l_phr_sect_ds_tab
              selectionset                    = l_selectionset_ds_tab
      SELECTIONSET_TEXT               =
    I am unable to retrieve only the "phrase_text parameter".
    Please let me know what else i need to check or am i missing anything? or is there any way to debug remote BAPI when called from one system?
    Regards,
    Yogesh

Maybe you are looking for