Issue with BAPI parameters  -  BAPI_SALESORDER_CHANGE

Hi,
   I am trying to use BAPI_SALESORDER_CHANGE to modify the contents of the sales order item quantity. but the below code was not working, can any one correct the below program.
   I have seen the same type of post few months back but no one provided the solution till now. I hope experts can correct my program. Surely i will reward.
regards
jaya
REPORT y_bapi1 .
TABLES: vbap.
DATA:
      bapichdr  LIKE bapisdh1,
      bapichdrx LIKE bapisdh1x,
      bapirtn   LIKE bapiret2     OCCURS 0 WITH HEADER LINE,
      bapiitm   LIKE bapisditm    OCCURS 0 WITH HEADER LINE,
      bapiitmx  LIKE bapisditmx   OCCURS 0 WITH HEADER LINE.
DATA: s_vbap LIKE vbap.
PARAMETERS: p_vbeln LIKE vbap-vbeln DEFAULT '40486',
            p_posnr LIKE vbap-posnr DEFAULT '20'.
start-of-selection.
START-OF-SELECTION.
PERFORM get_data_4m_vbap.
PERFORM fill_header_in.
PERFORM fill_header_inx.
PERFORM fill_item_in.
PERFORM fill_item_inx.
PERFORM call_bapi_so_change.
PERFORM call_bapi_commit.
*&      Form  get_data_4m_vbap
      text
FORM get_data_4m_vbap.
  SELECT SINGLE * FROM
           vbap
           INTO s_vbap
           WHERE vbeln = p_vbeln
             AND posnr = p_posnr.
ENDFORM.                    " get_data_4m_vbap
*&      Form  fill_header_in
      text
FORM fill_header_in.
*bapichdr
ENDFORM.                    " fill_header_in
*&      Form  fill_header_inx
      text
FORM fill_header_inx.
   bapichdrx-updateflag = 'U'.
ENDFORM.                    " fill_header_inx
*&      Form  fill_item_in
      text
FORM fill_item_in.
bapiitm-itm_number = p_posnr.
bapiitm-target_qty = s_vbap-kwmeng + 5.
APPEND bapiitm.
CLEAR bapiitm.
ENDFORM.                    " fill_item_in
*&      Form  fill_item_inx
      text
FORM fill_item_inx.
  bapiitmx-itm_number = p_posnr.
  bapiitmx-updateflag = 'U'. " I for insert & D for Delete
  bapiitmx-TARGET_QTY = 'X'.
    APPEND bapiitmx.
    CLEAR bapiitmx.
      bapiitmx-itm_number = p_posnr.
      bapiitmx-updateflag = 'I'. " I for insert & D for Delete
      bapiitmx-target_qty = 'X'.
    APPEND bapiitmx.
    CLEAR bapiitmx.
ENDFORM.                    " fill_item_inx
*&      Form  call_bapi_SO_change
      text
FORM call_bapi_so_change.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument               = p_vbeln
   order_header_in              = bapichdr
    order_header_inx            = bapichdrx
  SIMULATION                  =
  BEHAVE_WHEN_ERROR           = ' '
  INT_NUMBER_ASSIGNMENT       = ' '
  LOGIC_SWITCH                =
  NO_STATUS_BUF_INIT          = ' '
  TABLES
    return                      = bapirtn
    order_item_in               = bapiitm
    order_item_inx              = bapiitmx
  PARTNERS                    =
  PARTNERCHANGES              =
  PARTNERADDRESSES            =
  ORDER_CFGS_REF              =
  ORDER_CFGS_INST             =
  ORDER_CFGS_PART_OF          =
  ORDER_CFGS_VALUE            =
  ORDER_CFGS_BLOB             =
  ORDER_CFGS_VK               =
  ORDER_CFGS_REFINST          =
  SCHEDULE_LINES              =
  SCHEDULE_LINESX             =
  ORDER_TEXT                  =
  ORDER_KEYS                  =
  CONDITIONS_IN               =
  CONDITIONS_INX              =
  EXTENSIONIN                 =
  READ TABLE bapirtn WITH KEY id = 'V1' number = '311'.
  IF sy-subrc <> 0.
    PERFORM bapi_errorlist.
  ENDIF.
ENDFORM.                    " call_bapi_SO_change
*&      Form  call_bapi_commit
      text
FORM call_bapi_commit.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
   wait          =  'X'
IMPORTING
  RETURN        =
ENDFORM.                    " call_bapi_commit
*&      Form  bapi_errorlist
      text
FORM bapi_errorlist.
DATA: bapierr TYPE c,
      string TYPE string,
      i TYPE i.
  bapierr = 'X'.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  LEAVE TO LIST-PROCESSING.
  SET PF-STATUS 'LIST'.
  FORMAT INTENSIFIED ON.
  WRITE: / 'BAPI ERROR OCCURED' COLOR COL_NEGATIVE INVERSE ON.
  SKIP 1.
  LOOP AT bapirtn.
    CONCATENATE bapirtn-type bapirtn-number '(' bapirtn-id ')'
      INTO string.
    WRITE: / string.
    i = strlen( bapirtn-message ).
    WRITE bapirtn-message(i).
  ENDLOOP.
  LEAVE TO SCREEN 0100.
ENDFORM.                    " bapi_errorlist

Hello Jaya,
The problem would be you are not using SCHEDULE_LINES  ,so try to use.
see the below program for referenec:
REPORT  ZTRIALBAPICHANGE    message-id z3d                   .
DATA:I_HEADER1 TYPE BAPISDH1.
DATA:I_HEADER1X TYPE BAPISDH1X.
DATA:I_PART1 LIKE BAPIPARNR  OCCURS 0 WITH HEADER LINE.
DATA:I_ITEMS1 LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
DATA:I_ITEMS1X LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
DATA:I_SCH1 LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE.
DATA:I_SCH1X LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE.
data:err like bapiret2 occurs 0 with header line.
DATA:RETSALES LIKE VBAK-VBELN.
DATA:R(4).
R = '609'.
I_HEADER1-SALES_ORG = '0001'.
I_HEADER1-DISTR_CHAN = '01'.
I_HEADER1-DIVISION = '01'.
MOVE:'U' TO I_HEADER1X-UPDATEFLAG.
MOVE:'X' TO I_HEADER1X-SALES_ORG.
MOVE:'X' TO I_HEADER1X-DISTR_CHAN.
MOVE:'X' TO I_HEADER1X-DIVISION.
**PARTNER
CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
  EXPORTING
    INPUT = 'SP'
    IMPORTING
     OUTPUT = I_PART1-PARTN_ROLE.
I_PART1-PARTN_NUMB = '0000000011'.
APPEND I_PART1.
**ITEM DETAILS
I_ITEMS1-MATERIAL = '000000000000000011'.
I_ITEMS1-ITM_NUMBER = '000011'.
APPEND I_ITEMS1.
MOVE:'U' TO I_ITEMS1X-UPDATEFLAG.
MOVE:'X' TO I_ITEMS1X-MATERIAL.
APPEND I_ITEMS1X.
**SCHEDULE LINE
I_SCH1-ITM_NUMBER = '000011'.
I_SCH1-REQ_QTY = '100'.
I_SCH1-SCHED_LINE = '0000'.
APPEND I_SCH1.
MOVE:'U' TO I_SCH1X-UPDATEFLAG.
MOVE:'X' TO I_SCH1X-ITM_NUMBER.
MOVE:'X' TO I_SCH1X-REQ_QTY.
MOVE:'X' TO I_SCH1X-SCHED_LINE.
APPEND I_SCH1.
UNPACK R TO RETSALES.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument               = RETSALES
    ORDER_HEADER_IN             = I_HEADER1
    order_header_inx            = I_HEADER1X
   SIMULATION                  = 'X'
  BEHAVE_WHEN_ERROR           = ' '
  INT_NUMBER_ASSIGNMENT       = ' '
  LOGIC_SWITCH                =
  tables
    return                      = ERR
   ORDER_ITEM_IN               = I_ITEMS1
  ORDER_ITEM_INX              = I_ITEMS1X
   PARTNERS                    = I_PART1
  PARTNERCHANGES              =
  PARTNERADDRESSES            =
  ORDER_CFGS_REF              =
  ORDER_CFGS_INST             =
  ORDER_CFGS_PART_OF          =
  ORDER_CFGS_VALUE            =
  ORDER_CFGS_BLOB             =
  ORDER_CFGS_VK               =
  ORDER_CFGS_REFINST          =
   SCHEDULE_LINES              = I_SCH1
   SCHEDULE_LINESX             = I_SCH1X
  ORDER_TEXT                  =
  ORDER_KEYS                  =
  CONDITIONS_IN               =
  CONDITIONS_INX              =
  EXTENSIONIN                 =
loop at err.
format color 4.
write:/ err-type,
err-id,
err-number,
err-message,
err-log_no,
err-log_msg_no,
err-message_v1,
err-message_v2,
err-message_v3,
err-message_v4,
err-parameter,
err-row,
err-field,
err-system.
*WRITE:/10 ERR-MESSAGE.
endloop.
IF ERR-TYPE <> 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
  WAIT          =
IMPORTING
  RETURN        =
  MESSAGE S101 WITH RETSALES.
ELSE.
  MESSAGE S100.
ENDIF.
Thanks
Seshu

Similar Messages

  • Post Goods Issue with BAPI with reference to BOM

    Hi All,
    I want to post Goods Issue with BAPI / FM with reference to BOM.
    The requirement is like to replicate what we can do with MB1A with reference to BOM with BAPI / FM.
    Please give ur suggestions.
    Thanks in advance.
    Chintan.

    https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_forums_rm&query=kanban&adv=false&sortby=cm_rnd_rankvalue&sortmode=true&searchmode=similar&similardocsuri=/forumsrm/1_category/42_category/50_forum/34196_thread/322837_message

  • Issue with BAPI: BAPI_ADDRESSCONTPART_CHANGE

    Hi,
    I'm trying to utilize BAPI BAPI_ADDRESSCONTPART_CHANGE to change first and last name of Contact Person associated with Customer. See below my ABAP code. Strange thing is that the BAPI call doesn't do any change. I do not see change to first and last name of Contact Person neither in XD03 or VAP3 t-codes.
    DATA: lt_return      LIKE bapiret2 OCCURS 10  WITH HEADER LINE,
               lt_bapiad3vl   TYPE TABLE OF bapiad3vl  WITH HEADER LINE,
               lt_bapiad3vl_x TYPE TABLE OF bapiad3vlx WITH HEADER LINE,
              address_number LIKE adrc-addrnumber,
              person_number  LIKE adrp-persnumber.
    PARAMETERS: p_first TYPE name1_gp DEFAULT 'firstname1',
                             p_last  TYPE name1_gp DEFAULT 'lastname1'.
    lt_bapiad3vl-firstname = p_first.
    lt_bapiad3vl-lastname  = p_last.
    APPEND lt_bapiad3vl.
    MOVE: 'X' TO lt_bapiad3vl_x-firstname,
           'X' TO lt_bapiad3vl_x-lastname,
           'U' TO lt_bapiad3vl_x-updateflag.
    APPEND lt_bapiad3vl_x.
    CALL FUNCTION 'BAPI_ADDRESSCONTPART_CHANGE'
       EXPORTING
         obj_type_p  = 'BUS1006001' "Person object BOR object type
         obj_id_p    = '0000152955'    "Person object BOR object key = KNVK-PARNR person no
         obj_type_c  = 'KNA1'           "Company address owner BOR object type
         obj_id_c    = '0000099009'   "BOR company address owner object key = KNA1-KUNNR customer no
         context     = '0005'
       IMPORTING
         address_number = address_number
         person_number  = person_number
       TABLES
         bapiad3vl   = lt_bapiad3vl
         bapiad3vl_x = lt_bapiad3vl_x
         return      = lt_return.
    I tried to use a call of BAPI_TRANSACTION_COMMIT after my BAPI call however result is the same: no change to the data. Sy-subrc is always equal to zero. Return table lt_return has no rows. So there is no indication of what can be wrong.
    I guess that there is maybe issue within export parameters:
    obj_id_p
    obj_id_c
    However I'm using them as provided in the comments of my ABAP code. Any hints of what can be wrong? Thanks in advance.
    m./

    Would you please test input data with BAPI_ADDRESSCONTPART_GETDETAIL.
    Got any result?

  • Performance issues with Bapi BAPI_MATERIAL_AVAILABILITY...

    Hello,
    I have a Z program to check ATP which is working with Bapi BAPI_MATERIAL_AVAILABILITY....
    As I am in the retail system we have performance issues with this bapi due the huge amount of articles in the system we need to calculate the ATP.
    any  way to  improve  the  performance?
    Thanks and best regards
    L

    The BAPI appears to execute for only one plant/material, etc., at a time, so I would have to concentrate on making data retrieval and post-bapi processing as efficient as possible.  In your trace output, how much of your overall time is consumed by the BAPI?  How much by the other code?  You might find improvements there...

  • Minor issue with open parameters upon initial PDF load

    Hello, everyone.
    I am experiencing an odd issue with using open parameters to view a PDF in a browser window.
    We are using ColdFusion Server 9.0.1 (soon to upgrade to 10) and the Solr Collection Server that is bundled with it.  The server is updating the collections on a daily basis via Scheduled Tasks.
    When a user (okay.. it's me.. still in testing mode) uses the form to search the collection of PDFs for a specific keyword (let's use "petroleum"), the collections indicate that there are about 31 PDF files that contain the word "petroleum".  Most of them (when opened via "http://domain.com/pdf_file_a.pdf#search="petroleum"&zoom=100") will highlight the word "petroleum" in the document, every time.
    However, there are some PDFs that when opened will indicate that there are ZERO instances of "petroleum" in the document.  But if you refresh the browser, it suddenly finds three instances that it didn't see the first time.
    Is this a bug?  Has anyone else experienced this issue?  Is there a fix or work-around for it?
    Thank you,
    ^_^

    Anyone?

  • Issue with passing parameters through Java-JSP in a report with cross tab

    Can anyone tell me, if there's a bug in Java SDK in passing the parameters to a report (rpt file) that has a cross tab in it ?
    I hava report that works perfectly fine
       with ODBC through IDE and also through browser (JSP page)
    (ii)    with JDBC in CR 2011 IDE
    the rpt file has a cross tab and accpts two parameters.
    When I run the JDBC report through JSP the parameters are never considered. The same report works fine when I remove the cross tab and make it a simple report.
    I have posted this to CR SDK forum and have not received any reply. This have become a blocker and because of this our delivery has been postponed. We are left with two choices,
       Re-Write the rpt files not to have cross-tabs - This would take significant effort
    OR
    (ii)  Abandon the crystal solution and try out any other java based solutions available.
    I have given the code here in this forum posting..
    CR 2011 - JDBC Report Issue in passing parameters
    TIA
    DRG
    TIA
    DRG

    Mr.James,
    Thank you for the reply.
    As I stated earlier, we have been using the latest service pack (12) when I generated the log file that is uploaded earlier.
    To confirm this further, I downloaded the complete eclipse bundle from sdn site and reran the rpt files. No change in the behaviour and the bug is reproducible.
    You are right about the parameters, we are using  {?@Direction} is: n(1.0)
    {?@BDate} is: dt(d(1973-01-01),t(00:00:00.453000000)) as parameters in JSP and we get 146 records when we directly execute the stored procedure. The date and the direction parameter values stored in design time are different. '1965-01-01' and Direction 1.
    When we run the JSP page, The parameter that is passed through the JSP page, is displayed correctly on the right top of the report view. But the data that is displayed in cross tab is not corresponding to the date and direction parameter. It corresponds to 1965-01-01 and direction 1 which are saved at design time.
    You can test this by modifying the parameter values in the JSP page that I sent earlier. You will see the displayed data will remain same irrespective of the parameter.
    Further to note, Before each trial run, I modify the parameters in JSP page, build them and redeploy so that caching does not affect the end result.
    This behaviour, we observe on all the reports that have cross-tabs. These reports work perfectly fine when rendered through ODBC-ActiveX viewer and the bug is observable only when ran through Java runtime library. We get this bug on view, export and print functionalities as well.
    Additionally we tested the same in
        With CR version 2008 instead of CR 2011.
    (ii)   Different browsers ranging from IE 7 through 9 and FF 7.
    The complete environment and various softwares that we used for this testing are,
    OS      : XP Latest updates as on Oct 2011.
    App Server: GlassFish Version 3 with Java version 1.6 and build 21
    Database server ; SQL Server 2005. SP 3 - Dev Ed.
    JTds JDBC type 4 driver version - 1.2.5  from source forge.
    Eclipse : Helios along with crystal libraries directly downloaded from SDN site.
    I am uploading the log file that is generated when rendering the rpt for view in IE 8
    Regards
    DRG

  • Issue with passing parameters from JSP to Backing bean

    hi ,
    I have an issue in passing parameters from my JSP to backing bean. I want to fetch the parameter from my URL in backing bean .This is how i am coding it right now. But the parameter companyID returns me null.
    URL http://localhost:8080/admin/compadmin.jsp?companyID=B1234.
    In my backing bean
    FacesContext context = FacesContext.getCurrentInstance();
    String companyID = (String)context.getExternalContext().getRequestParameterMap().get("CompanyID");
         public void setCompanyID(String companyID)
              this.companyID=companyID;
         public String getCompanyID()
              return this.companyID;
    faces-config.xml :
       <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.admin.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>companyadminbean</property-name>
                   <property-class>com.admin.model.AdminBean</property-class>
                   <value>#{companyadminbean}</value>
                         </managed-property>
                        <managed-property>
                                 <property-name>companyID</property-name>
                              <value>#{param.companyID}</value>
                             </managed-property>Please let me know if iam missing something.Appreciate your help in advance
    Thanks

    Thanks very much for your input. I made changes to my bean accordingly. Actually the method getAdminType() is a not a getter of a property. It's just a method which iam calling in AdminController bean constructor to verify whether the person is System Admin or Client admin. So now the issue is inspite of making changes still the link "Copy Users" shows up for Client admin too which is incorrect.
    My Administrator bean:
    public class Administrator {
      boolean GSA=false;
      boolean SA=false;
      public Administrator(){}
    public boolean isGSA()
        return GSA;
      public boolean isSA()
        return SA;
      public void setGSA(boolean value)
        this.GSA=value;
      public void setSA(boolean value)
        this.SA=value;
    }My backing bean:
    public class AdminController {
    private AdminBean adminbean = new AdminBean();
    public AdminController(){
    int userID=1234;
    this.getAdminType(userID);           
    public void getAdminType(int userID)
             Administrator admin = new Administrator();
             if (userID<0) return;
             try{
                 if(Rc.isGlobalSystemAdmin(userID)){
                      admin.setGSA(true);
                              }else if(Rc.isClientSystemAdmin(userID)){
                      admin.setSA(true); // i could see these values setup correctly in the admin bean when i print them
                 adminbean.setAdmin(admin);
                  } catch (Exception e){ }
    Admin Bean:
    public class AdminBean {
    private Administrator admin; 
    public Administrator getAdmin()
                        return this.admin;
              public void setAdmin(Administrator admin)
                        this.admin = admin;
    faces-config.xml
    <managed-bean>
              <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>adminbean</property-name>
                   <property-class>com.model.AdminBean</property-class>
                   <value>#{adminbean}</value>
             </managed-property>
         </managed-bean>
         <managed-bean>
              <managed-bean-name>adminbean</managed-bean-name>
              <managed-bean-class>com.model.AdminBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <managed-property>
                   <property-name>admin</property-name>
                   <property-class>com.model.Administrator</property-class>
                   <value>#{admin}</value>
                             </managed-property>
         </managed-bean>     My JSP:<h:outputLink id="ol1" value="/companyadmin/copyusers.jsp">
               <h:outputText id="ot1" value="Copy Users" rendered="#{adminbean.admin.isGSA}" /><f:verbatim><br/></f:verbatim>
               </h:outputLink>    so now the issue is thelink copy users is displayed even #{adminbean.admin.isGSA} is FALSE. please advise.
    Thanks
    Edited by: twisai on Oct 15, 2009 7:06 AM

  • Issue with BAPI CONTRACT CREATE while uploading pricing conditions

    Hi Experts
                        I am using BAPI CONTRACT CREATE to create Purchase Contract ME31K
    I am facing the issue while passing pricing conditions  Could you please help me regarding this
    Could you please help me along with this what are the values has to pass
    Thanks
    Vijay Kumar Reddy

    Hi Experts
                        I am using BAPI CONTRACT CREATE to create Purchase Contract ME31K
    I am facing the issue while passing pricing conditions  Could you please help me regarding this
          gs_oucondition-item_no = w_data-evrtp.  
          gs_oucondition-serial_id = '1'.     
          gs_oucondition-cond_count = '01'.     
          gs_oucondition-cond_type = w_data-cond1.     
          MOVE w_data-amnt1 TO gs_oucondition-cond_value.     
          gs_oucondition-currency  = w_data-curr1.     
          gs_oucondition-numerator   = '1'.     
          gs_oucondition-denominator = '1'.     
          gs_oucondition-change_id   = 'I'.     
          APPEND gs_oucondition TO gt_oucondition.     
          CLEAR gs_oucondition.
          gs_ouconditionx-item_no = w_data-evrtp.     
          gs_ouconditionx-serial_id = '1'.
          gs_ouconditionx-cond_count = '01'.     
          gs_ouconditionx-item_nox = c_x.     
          gs_ouconditionx-serial_idx = c_x.     
          gs_ouconditionx-cond_countx = c_x.     
          gs_ouconditionx-cond_type = c_x.     
          gs_ouconditionx-cond_value = c_x.     
          gs_ouconditionx-currency  = c_x.     
          gs_ouconditionx-numerator   = c_x.     
          gs_ouconditionx-denominator = c_x.     
          APPEND gs_ouconditionx TO gt_ouconditionx.     
          CLEAR gs_ouconditionx.
    Could you please help me along with this what are the values has to pass.
    these are the parameters passing to the condition structure while executing bapi i am getting error like enter quantity conversion.
    but with the same data i am able to create contract using SE37 by directly executing the Function module.
    and if i have net price in my excel sheet also i am able to create contract using my program.
    the only problem with pricing conditions alternatively there will be no net price..
    Please really it will be a challenging question....
    Thanks
    Vijay Kumar Reddy

  • Issue with BAPI & Commit

    Dear All,
    I have been working with an assignment and facing a strange issue.
    I have used the 'BAPI_SALESORDER_CHANGE' to modify sales order and then I call 'BAPI_TRANSACTION_COMMIT' with wait = X. So, this bapi modifies the sales order schedule lines and also in turn updates the info structure linked to it (In our case, say it is S800)
    Immediately after this I have a select statement on S800 to fetch the records.
    On debug, if I break at select statement, I get correct records from S800  but If i break one step after select it gives me different records.
    I think there is some delay in updation of infostructure, hence, If i use wait statement before select for 1 sec, it works fine, but cause performance issues.
    for over 15000 order items, it will wait for around 8 hours, hence, i would like to know is there any way I can avoid wait and also read the infostructure for correct records.
    << Moderator message - Everyone's problem is important. Please do not ask for help quickly. >>
    Edited by: Rob Burbank on Feb 24, 2011 9:45 PM

    Hi Chandanrs,
    with COMMIT WORK (or BAPI_TRANSACTION_COMMIT) with WAIT addition, processing is continued after all high-priority ("VB1") update function modules are executed in the order of their registration and in a shared database LUW.
    That means that the info structures are probably updated in low-priority ("VB2") update.
    I never faced this situation but I think that the info structure should still be locked. Try to find the corresponding lock object, in a (test) run, locks may be visible shortly in SM12 lock overview.
    If possible, after commit work, try to call the enqueue function with the same arguments as it is done within the BAPI processing. You should get a foreign lock error until the end of the second level update process.
    while lv_locked is initial.
      call function 'ENQUEUE...
      IF sy-subrc = 0.
        lv_locked = 'X'.
      endif.
    endwhile.
      call function 'DEQUEUE...
      clear lv_locked.
    This lets your program wait until the info structure update is complete. Sorry I do not really know which lock object is used here. Anyway, I still do not know why you have to read the S900 directly after update.
    You may also process all orders to the to set the order quantity to delivered qty, COMMIT every 1000 or so orders, put the original quantity to internal table. Then do the same for restoring.
    BAPI processes run a great deal faster if you do not COMMIT after every single document. But you can't take too many because than you risk a lock table overflow.
    Hope it is some help anyway.
    Regards,
    Clemens

  • Issue with Input Parameters & Variables

    Hello Gurus,
    I have a situation where, when the user enter “Parent Company”   say for ex: ABC, then the over all
    Result should filter by ‘ABC’, and then there is key figure column where I need to consider not equal to ABC and then sum the key figure.
    In HANA, here both variables and Input patemters are mutually exclusive. Is there any way that I can pass the value of the variable to the input parameters without writing the code in Analytical or calculation views.
    If it’s BW-bex, it was very straight forward, I can create the variable for parent company ‘ABC’, put it as global filter, so that whenever the user selects ‘ABC” it should display on ABC data in the out put.
    I can also use the same variable and crate calculated column in BEx and attach the variable to the key figure and say the sum the key figure but exclude the Parent company “ABC’.
    I have tried the projection view and try to put filter on it, but it did not work. My requirement is
    Whenever the user selects ABC, it should display only ABC data, only 10 records out of 100 records and for one key figure column; I need to aggregate but excluding the Parent company “ABC”.
    Can I pass the Variable value to input parameters without writing the code?
    Regards
    Ramakrishnan Ramanathaiah 

    How about the following:
    Assuming you have 2 characteristics (Plant and Parent company) and 1 KF (Net Sales).
    Now let's create a projection with Filter using Input parameter on Parent company (with user input value as ABC), which might give the output as:
    Plant
    comp
    Net Sales
    P1
    ABC
    10
    P2
    ABC
    5
    Now, let's create a second projection with the Calc KF "Net Sales calculated" with the formula as:
    if comp = $input_value$, then 0 else Net_Sales.. this way you can simulate the EXCLUDE functionality.
    Plant
    comp
    Net sales
    P1
    ABC
    0
    P1
    BCD
    15
    P2
    ABC
    0
    Now union both the projections with two diff KFs, Net Sales and Net Sales Calculated.
    Plant
    Net Sales
    Net Sales Calc
    P1
    10
    15
    P2
    5
    0
    Subsequent model depends on your reporting drilldown requirement. If you drilldown Parent company also in the rows, then you will see the split in the values.
    Please try this and let us know if it works or what other issues come up.. we can try resolving the issues..
    Ravi

  • Issue with BAPI 'BAPI_PROJECT_MAINTAIN'

    Hi All,
    I am changing some dates of wbs elements in CJ20N.
    I am using the BAPI 'BAPI_PROJECT_MAINTAIN'
    when I use the BAPi
    it gives an error:
    The method table is not consistent with the data tables
    I am using the code
    data posid like prhi-posnr.
    CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT'
      EXPORTING
        input         = i_prps-posid
    IMPORTING
       OUTPUT        = posid          .
    select * from prhi INTO table i_wbs WHERE
      posnr = posid.
      move : 'E42527' to i_prjdef-project_definition.
      clear : i_prjupd.
      move : 'X' to i_prjupd-project_definition.
      clear : i_prjmtd.
      move : 'WBS-ELEMENT' to i_prjmtd-objecttype,
             'UPDATE' to i_prjmtd-method,
             '000001' to i_prjmtd-refnumber,
             'E425270111801' to i_prjmtd-objectkey.
      append i_prjmtd.
      clear : i_prjmtd.
    CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
      EXPORTING
        i_project_definition               = i_prjdef
        i_project_definition_upd           = i_prjupd
    IMPORTING
       RETURN                             =  i_return
      tables
        i_method_project                   = i_prjmtd
       I_WBS_HIERARCHIE_TABLE             = i_wbs
    I am not sure why the eror happens.I suppose the issue is with the  i_prjmtd table update method.Please let me know if anything need to be changed for me to update date values.
    Thank You in advance.
    Regards,
    KS

    Solved it by self.

  • Issue with BAPI BAPI_ACC_DOCUMENT_REV_POST

    Hi,
    I am using the BAPI BAPI_ACC_DOCUMENT_REV_POST to reverse FI documens but the function module generates a short dump when I commit the transaction.
    I first use the function module BAPI_ACC_DOCUMENT_REV_CHECK to simulate the reversal operation and it does not return any error. I then use BAPI_ACC_DOCUMENT_REV_POST which returns the number of the reversed document. But when I commit, a short dump is generated.
    The type of the exception is INS_ERROR_IT and it occurs in the include LFLQPOF01(Form UPDATE_ITEM ). After debugging the program, I noticed that the standard is trying to insert a row in FLQITEMBS  table which exists already.
    What is surprising is that reversing the same document directly through FB08 is done correctly.
    I started looking to SAP notes, but no succes to finding a suitable solution.
    Does any one have a similar issue? Any tips?
    Thank you all in advance.

    Hello,
    You can run the standard ACC_BAPI_TEST_DOCUMENT program and check if the same issue is coming. It will be then easier for you to find out what exactly happening.
    Thanks & Regards,
    Abhijit

  • Issue with formal parameters

    Hi,
    The Sample Procedure is been displayed Below:--
    i_userId is an input (number) parameter to the Stored Procedure (SP)..
    This same parameter is used for filtering Data (can be found almost bottom , i had marked as "ISSUE FOUND" there.).
    i'm been using the SP without TO_NUMBER (i_userId) in my database 11g which works fine.
    When the same Script is been imported to another 11g Database.. the query fetches NOTHING..... And it Works only when i had given TO_NUMBER (i_userId)........
    Why is its So?........
    Is this issue occur due to any installation problem, or Database creation problem.............
    CREATE OR REPLACE PROCEDURE ADM_MENUSUBLEVEL_GET (i_userId IN NUMBER,
    i_parent IN NUMBER,
    o_menuCur OUT SYS_REFCURSOR,
    o_Return OUT NUMBER) IS
    array_tab array_tbl := array_tbl();
    BEGIN
    The Query below Fetches the lower most child node and returns its parent based on
    hierachy
    WITH MAINDATA AS
    (SELECT LAG(purity, (LVL - 1), 0) OVER (ORDER BY rn) Val, unique_id, menu_id, parent_id, remarks, is_active, lvl
    FROM (SELECT ROWNUM rn, DECODE (lvl, 1, menu_id, NULL) purity, unique_id,
    menu_id, parent_id, remarks, is_active, lvl
    FROM (SELECT 'A' unique_id, menu_id, parent_id, remarks, is_active, lEVEL lvl
    FROM adm_menuconfig t
    START WITH menu_id IN (SELECT adm.menu_id
    FROM adm_users adu,
    adm_user_auth_role adur,
    adm_rolemenumapping adr,
    adm_menuconfig adm
    WHERE adu.user_id = adur.user_id
    AND adur.role_id = adr.role_id
    AND adm.menu_id = adr.menu_id
    AND (NVL (adr.menu_add, 0) > 1 OR
    NVL (adr.menu_modify, 0) > 1 OR
    NVL (adr.menu_cancel, 0) > 1 OR
    NVL (adr.menu_view, 0) > 1 OR
    NVL (adr.menu_print, 0) > 1 OR
    NVL (adr.menu_re_print, 0) > 1 OR
    NVL (adr.menu_delete, 0) > 1 OR
    NVL (adr.menu_process, 0) > 1 OR
    NVL (adr.menu_approve, 0) > 1 OR
    NVL (adr.menu_pre_dated_entry, 0) > 1 OR
    NVL (adr.menu_import, 0) > 1 OR
    NVL (menu_export, 0) > 1 OR
    NVL (adr.menu_validation, 0) > 1)
    AND adur.is_active = 1
    AND adu.user_id = to_number(i_userId)) ------------------ ISSUE FOUND
    CONNECT BY menu_id = PRIOR parent_id)))
    SELECT parentid BULK COLLECT INTO array_tab/*Parent_Tab*/ -- Plsql Type
    FROM (SELECT parentid, (SELECT lvl
    FROM MAINDATA md
    WHERE md.parent_id = parentid
    AND ROWNUM = 1) lvl
    FROM (SELECT DISTINCT parent_id parentid
    FROM adm_menuconfig t
    START WITH menu_id IN
    (SELECT menu_id
    FROM MAINDATA
    WHERE lvl = 1)
    CONNECT BY menu_id = PRIOR parent_id)
    WHERE parentid IS NOT NULL)
    ORDER BY lvl;
    EXCEPTION
    WHEN OTHERS THEN
    o_Return := 1;
    END ADM_MENUSUBLEVEL_GET;
    Regards
    Nims

    user12265791 wrote:
    i'm been using the SP without TO_NUMBER (i_userId) in my database 11g which works fine.
    When the same Script is been imported to another 11g Database.. the query fetches NOTHING..... And it Works only when i had given TO_NUMBER (i_userId)........
    Why is its So?........
    Is this issue occur due to any installation problem, or Database creation problem.............Check the datatypes involved on the machine where it is not working. Its possible an implicit datatype conversion is taking place and is producing different results (leading spaces, for instance, in a string) than the TO_NUMBER

  • Issue with passing parameters to an applet?

    Hi,
    I have an apex page which is a popup page. I am passing parameters to the applet and then reading them in from my java code.
    Here is my applet code
    <SCRIPT>
      function getStatus(retStatus) {
        $s("P3_MESSAGE", ''||retStatus||'')
    </SCRIPT>
    <APPLET ARCHIVE="/i/bin/offline_load.zip" CODE="offline_load.class"  STATUSMSG WIDTH=0 HEIGHT=0>
    <PARAM name="username" value="&APP_USER.">
    <PARAM name="dbuser" value="&P3_DBUSER.">
    <PARAM name="dbpassword" value="&P3_DBPASSWORD.">
    <PARAM name="dbserver" value="&P0_DBSERVER.">
    <PARAM name="dbport" value="&P3_DBPORT.">
    <PARAM name="dbsid" value="&P3_DBSID.">
    </APPLET>P3_DBUSER, P3_DBPASSWORD, etc are all defined on page zero as hidden and protected items
    My applet code
    public void init() {
        CallableStatement load_stmt = null;
        String userName = this.getParameter("username");
        String dbUser = this.getParameter("dbuser");
        String dbPass = this.getParameter("dbpassword");
        String dbServer = this.getParameter("dbserver");
        String dbPort = this.getParameter("dbport");
        String dbSid = this.getParameter("dbsid");
        try {
          System.out.println("init(): loading OracleDriver for applet created at " + created.toString());
          Class.forName("oracle.jdbc.driver.OracleDriver");
          System.out.println("init(): getting connection");
          conn = DriverManager.getConnection("jdbc:oracle:thin:@" + dbServer + ":" + dbPort + ":" + dbSid, dbUser, dbPass);
        } // end tryThe odd thing is I have gotten this working twice then unexpectedly it just stops working when I make a change to the java applet code.
    And the changes have absolutely nothing to do with the above code it can be anything the first time was error handling I added
    to another section and the second I modified a stored procedure call.
    Anyone have any idea why this might be occurring as this is driving me completely insane :(
    Thanks in advance

    Hi,
    In your init() code, you have a "try" block - do you have a "finally" block to close the connection? Something like:
    finally {
      try {
        conn.close();
      catch (Exception ignore) {
    }Could it be that you have reached the limit of the number of available open connections?
    Your code looks ok as far as I can see (based on examples at: http://www.orafaq.com/wiki/JDBC )
    Also, in your new bits of code, have you added try/catch/finally blocks? Does the code compile fully (ie, no warnings)? Have you added new imports that may conflict with existing code such that you have to fully qualify existing objects/classes (eg, you may now have two DriverManager classes or CallableStatement objects)?
    Andy

  • Issue with BAPI BAPI_GOODSMVT_CREATE

    Hello,
    I am using BAPI_GOODSMVT_CREATE to post goods mvt against PO. When the PO is fully delivered and if i run my program again, it again posts against the same PO
    How can i avoid this ? Won't the BAPI check this automatically ?
    Thanks

    Hi Anup,
    When the PO is fully delivered, and if i use MIGO for the PO it issues a message "Document 4100000105   does not contain any selectable items".
    But when i post using the BAPI it posts again (even when the PO is fully delivered), which should not happen...Ideally it should give a error !!
    Thanks

Maybe you are looking for

  • I cannot use data back up when I use iphone4s in iphone5 ,please help me?

    I cannot use data back up when I use iphone4s in iphone5 ,please help me?now a day I use iphone5 and ipad4 I love apple

  • Return sales excise posting

    Dear Excperts, For return sales we are posting the excise JV through J1IH  in additional excise tab with reference to excise invoice.but  when we are seeing the same in J2I9 abstract view the values showing under crdit utilized during the month .but

  • BAPI to change Purchase requisition

    Hi I want to change pruchase requsition EBAN- AFNAM ( requested by feild in PR line item ) . Is there any BAP to do so . I beleive we annot do so by using BAPI_REQUISITION_CHANGE ?

  • Search on classfication using Trex-index

    Hi all, In the IMG for DMS, there is a setting to configure an index for searching on classification data. Where is it possible to search on that index? Only through portal or is there a way to search in GUI? I dont think it is used in CV04N, but ple

  • UDF Limitations

    Hi All,           I am using SAP 2005B PL34. While trying to add UDF's on marketing document, the system is not allowing me to create more udf's. Can anyone please tell me is there any limitation as of to how many udf's can i add in a single database