Calling BAPI_MATERIAL_AVAILABILITY in Z_FUNC_MODULE

Hi,
   I want to know how to call a BAPI in a user-defined function module....
Can u send me with code please.... Its urgent.
My Requirement is
<b>Import parameters - Plant, Material Num, Unit, Qty
Export parameters - Status </b>
I want to send the First 3 parameters of Import parameters to BAPI and get response Qty from it, compare both Quantities and tell the status...
If user requested for quantity which is more than available we have to send status no to user...
Please suggest how to proceed...
Regards,
Pushparaju.B.

Hi take this as an example..
As you want to compare quantity.you need to give delivary date also.
i used the fields to create FM. I dont know the exact field you required..try to give your fields in IMPORT and EXPORT.
Change the code accordingly..
After FM inside subrc check you can write your logic for returning status to user.
""Local interface:
*"  IMPORTING
*"     REFERENCE(PLANT) LIKE  MARC-WERKS
*"     REFERENCE(MATNR) LIKE  MARA-MATNR
*"     REFERENCE(UNIT) LIKE  MARA-MEINS
*"     REFERENCE(QUANT) LIKE  MBEW-LBKUM
*"     REFERENCE(DELIV_DATE) LIKE  MARA-ERSDA
*"  EXPORTING
*"     REFERENCE(STATUS) LIKE  MARC-PSTAT
DATA : NEW_QUANT LIKE MBEW-LBKUM .
DATA: LV_TABIX  LIKE SY-TABIX,
        LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
        LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
  LV_TABIX = SY-TABIX.
  CLEAR: LT_WMDVSX, LT_WMDVEX.
  REFRESH: LT_WMDVSX, LT_WMDVEX.
Fill communication table
  LT_WMDVSX-REQ_DATE = DELIV_DATE.
  LT_WMDVSX-REQ_QTY  = QUANT.
  APPEND LT_WMDVSX.
  CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
       EXPORTING
            PLANT      = PLANT
            MATERIAL   = MATNR
            UNIT       = UNIT
            CHECK_RULE = '03'
       TABLES
            WMDVSX     = LT_WMDVSX
            WMDVEX     = LT_WMDVEX
       EXCEPTIONS
            OTHERS     = 1.
  IF SY-SUBRC EQ 0.
    READ TABLE LT_WMDVEX WITH KEY
                         COM_DATE = DELIV_DATE.
    IF SY-SUBRC EQ 0.
    IF LT_WMDVEX-COM_QTY > quant.
    STATUS = 1.
    ELSE.
    STATUS = 0.
    ENDIF.
    ENDIF.
    ENDIF.
ENDFUNCTION.
This is only source code.
Try this.

Similar Messages

  • Call Bapi_Material_Availability Error : Index was outside the bounds ...

    I am coding .net 2003 (VB)  and  .NET connector 2.0  Call Bapi_Material_Availability . It Error  Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    This my code:
       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim Batch As String
            Dim Check_Rule As String
            Dim Customer As String
            Dim Dec_For_Rounding As Short
            Dim Dec_For_Rounding_X As String
            Dim Doc_Number As String
            Dim Itm_Number As String
            Dim Material As String
            Dim Material_Evg As Test6.BAPIMGVMATNR
            Dim Plant As String
            Dim Read_Atp_Lock As String
            Dim Read_Atp_Lock_X As String
            Dim Stge_Loc As String
            Dim Stock_Ind As String
            Dim Unit As String
            Dim Wbs_Elem As String
            Dim Av_Qty_Plt As Decimal
            Dim Dialogflag As String
            Dim Endleadtme As String
            Dim Return0 As Test6.BAPIRETURN
            Dim Wmdvex As Test6.BAPIWMDVETable
            Dim Wmdvsx As Test6.BAPIWMDVSTable
            Material = "100-400"
            Plant = "1000"
            Unit = "ST"
            Try
                SapProxy11.Bapi_Material_Availability(Batch, _
                Check_Rule, _
                Customer, _
                Dec_For_Rounding, _
                Dec_For_Rounding_X, _
                Doc_Number, _
                Itm_Number, _
                Material, _
                Material_Evg, _
                Plant, _
                Read_Atp_Lock, _
                Read_Atp_Lock_X, _
                Stge_Loc, _
                Stock_Ind, _
                Unit, _
                Wbs_Elem, _
                Av_Qty_Plt, _
                Dialogflag, _
                Endleadtme, _
                Return0, _
                Wmdvex, _
                Wmdvsx)
                Me.TextBox1.Text = Av_Qty_Plt.ToString()
            Catch ex As SAP.Connector.RfcAbapException
                MsgBox(ex.Message.ToString)
            End Try
        End Sub
    ========
    <i>Source Error:
    Line 157:     ByRef Wmdvsx As BAPIWMDVSTable)
    Line 158:        Dim results As Object()
    Line 159:        results = SAPInvoke("Bapi_Material_Availability", new Object() { _
    Line 160:                            Batch,Check_Rule,Customer,Dec_For_Rounding,Dec_For_Rounding_X,Doc_Number,Itm_Number,Material,Material_Evg,Plant,Read_Atp_Lock,Read_Atp_Lock_X,Stge_Loc,Stock_Ind,Unit,Wbs_Elem,Wmdvex,Wmdvsx })
    Line 161:        Av_Qty_Plt = CType(results(0), Decimal)
    Source File: E:\SAP\BAPI\Test6\SAPProxy1.vb    Line: 159
    Stack Trace:
    [IndexOutOfRangeException: Index was outside the bounds of the array.]
       SAP.Connector.Rfc.RfcClient.RfcInvoke(SAPClient proxy, String method, Object[] methodParamsIn) +1229
       SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn) +70
       Test6.SAPProxy1.Bapi_Material_Availability(String Batch, String Check_Rule, String Customer, Int16 Dec_For_Rounding, String Dec_For_Rounding_X, String Doc_Number, String Itm_Number, String Material, BAPIMGVMATNR Material_Evg, String Plant, String Read_Atp_Lock, String Read_Atp_Lock_X, String Stge_Loc, String Stock_Ind, String Unit, String Wbs_Elem, Decimal& Av_Qty_Plt, String& Dialogflag, String& Endleadtme, BAPIRETURN& Return0, BAPIWMDVETable& Wmdvex, BAPIWMDVSTable& Wmdvsx) in E:\SAP\BAPI\Test6\SAPProxy1.vb:159
       Test6.WebForm1.Button1_Click(Object sender, EventArgs e) in E:\SAP\BAPI\Test6\Default.aspx.vb:64
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain() +1292
    </i>
    Pls. help me.
    Thank you.

    Hi Kreangsak,
    It seems that you need to initialize you tables, parameters for rfc function
    Dim Wmdvex As Test6.BAPIWMDVETable
    Dim Wmdvsx As Test6.BAPIWMDVSTable
    Wmdvex = new Test6.BAPIWMDVETable()
    Wmdvsx = new Test6.BAPIWMDVSTable()
    If there is other table, you need to initialize them with new operator. Null tables does not accepted.
    If you problem goes set the call stack's "show non-user code" property and send the stack.
    Best Regards,
    Huseyin Akturk
    SW Engineer & SAP ABAP Consultant
    www.huseyinakturk.net

  • CALLING BAPI in ABAP program

    Hi,
    I want to call BAPI_MATERIAL_AVAILABILITY in ABAP program. Please give me some sample code how i can do this??? Please help

    hi,
    REPORT  YATP.
    DATA: LV_TABIX  LIKE SY-TABIX,
            LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
            LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
    data ET_PROCUREMENT_ITEM LIKE BBPPOGN.
      LV_TABIX = SY-TABIX.
      CLEAR: LT_WMDVSX, LT_WMDVEX.
      REFRESH: LT_WMDVSX, LT_WMDVEX.
    Fill communication table
      LT_WMDVSX-REQ_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
      LT_WMDVSX-REQ_QTY  = ET_PROCUREMENT_ITEM-QUANTITY.
      APPEND LT_WMDVSX.
    Availability check with check rule '03'
      CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
           EXPORTING
                PLANT      = 'ALB1'
                MATERIAL   = '100000223'
                UNIT       = 'EA'
                CHECK_RULE = '03'
           TABLES
                WMDVSX     = LT_WMDVSX
                WMDVEX     = LT_WMDVEX
           EXCEPTIONS
                OTHERS     = 1.
      IF SY-SUBRC EQ 0.
        READ TABLE LT_WMDVEX WITH KEY
                             COM_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
        IF SY-SUBRC EQ 0.
          ET_PROCUREMENT_ITEM-AVAIL_QTY = LT_WMDVEX-COM_QTY.
        ENDIF.
      ENDIF.
      write :/ et_procurement_item-avail_qty.
      Loop at lt_wmdvex.
      write : / lt_wmdvex-COM_QTY,
              lt_wmdvex-BDCNT,
               lt_wmdvex-REQ_QTY.
    endloop.
    This is my program  but no value written  for WMDVEX.

  • How to use BAPI_MATERIAL_AVAILABILITY Function Module....

    Hi Experts,
    I want to know actual free available quantity (ATP Qty.) for mass materials,
    How to use BAPI_MATERIAL_AVAILABILITY function module ?
    I have select all material from MARA and inserted in itab.
    LOOP AT ITAB.
    CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
      EXPORTING
        PLANT                    =
        MATERIAL                 =
        UNIT                     =
      CHECK_RULE               =
      STGE_LOC                 =
      BATCH                    =
      CUSTOMER                 =
      DOC_NUMBER               =
      ITM_NUMBER               =
      WBS_ELEM                 =
      STOCK_IND                =
      DEC_FOR_ROUNDING         =
      DEC_FOR_ROUNDING_X       =
      READ_ATP_LOCK            =
      READ_ATP_LOCK_X          =
    IMPORTING
      ENDLEADTME               =
      AV_QTY_PLT               =
      DIALOGFLAG               =
      RETURN                   =
      TABLES
        WMDVSX                   =
        WMDVEX                   =
    I dont know how to use it.
    pl. guide us.
    Yusuf

    Hi,
           data:  iwmdvsx type table of bapiwmdvs with header line,
           iwmdvex type table of bapiwmdve with header line.
    parameters: p_matnr type mara-matnr,
                p_werks type marc-werks,
                p_meins type mara-meins.
    call function 'BAPI_MATERIAL_AVAILABILITY'
      exporting
        plant            = p_werks
        material         = p_matnr
        unit             = p_meins
      CHECK_RULE       =
      STGE_LOC         =
      BATCH            =
      CUSTOMER         =
      DOC_NUMBER       =
      ITM_NUMBER       =
      WBS_ELEM         =
      STOCK_IND        =
    IMPORTING
      ENDLEADTME       =
      AV_QTY_PLT       =
      DIALOGFLAG       =
      RETURN           =
      tables
        wmdvsx           = iwmdvsx
        wmdvex           = iwmdvex.
    check sy-subrc = 0.
    Text
    ATP information
    Functionality
    Using this function module, you can determine the receipt quantity still available for a particular material in a certain plant according to ATP logic (MRPII).
    The availability check is carried out on transferring the material number, the plant and the input table (WMDVSX). The scope of the check, that is, which stocks, receipts and issues are to be included in the check is defined by the combination of checking group (material master) and cheking rule. In the function module, the system uses the checking rule defined in Sales & Distribution (A). You can overrule this checking rule by using an interface or a user-exit (exit_saplw61v_001). A similar procedure is also valid for the plant parameters. The customer number in the user-exit means that the plant selection can be controlled via the customer. If no plant parameters are given via the interface, the system uses the parameter 'WRK' saved in the user's fixed values.
    The results of the availability check are recorded in the output table (WMDVEX). This table contains dates and available receipt quantities (ATP quantities). The results of the check depends on the following entries:
    If no date and no quantity is transferred, the system displays the ATP situation from today's date into the future as the result.
    If only a date and no quantity is transferred, the system displays the ATP situation from the corresponding date as the result.
    If both a date and a quantity are transferred, the system calculates the availability situation for the quantity specified.
    In the last two cases, the parameter 'DIALOGFLAG' is supplied. This can result in the following:
    ' ' (blank)   <=> quantity completely available
    'X'           <=> only partial quantity available or not available at
                      all
    'N'           <=> Material not included in the availability check
                      (Material not relevant to the availability check)
    The system also displays the end of the replenishment lead time (ENDLEADTME).
    regards

  • Dump in 'BAPI_MATERIAL_AVAILABILITY' for mass materials....

    Hi Experts,
    pl. help us for following abap. I have fetched nearly 40,000 materials in itab and when i am executing it is taking long time 10-20 minutes or it is giving dump.
       DATA: iwmdvsx TYPE TABLE OF bapiwmdvs WITH HEADER LINE,
        iwmdvex TYPE TABLE OF bapiwmdve WITH HEADER LINE.
        DATA: r TYPE bapireturn, " Check it once.
        FQty TYPE MENGV13.
        jtab[] = itab[].
        LOOP AT itab.
          CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
          EXPORTING
          plant = 'HIP' "p_werks
          material = itab-matnr "p_matnr
          unit = 'EA' "p_meins
          stge_loc = 'BSR'
          IMPORTING
          return  = r
          TABLES
          wmdvsx = iwmdvsx
          wmdvex = iwmdvex.
          IF r-type is initial OR r-type = 'S'.
            LOOP AT  iwmdvex.
              FQty = FQty + iwmdvex-com_qty.
            ENDLOOP.
            jtab-free_qty = FQty.
            MODIFY jtab TRANSPORTING free_qty WHERE matnr = itab-matnr.
            FQty = 0.
          ENDIF.
          REFRESH iwmdvex.
          CLEAR: itab.
          REFRESH iwmdvsx.
        ENDLOOP.

    This is the way i do it. See if it helps:
          LOOP AT I_WERKS.
            refresh: return.
            CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
              EXPORTING
                plant      = I_WERKS-LOW
                material   = I_MARA-MATNR
                unit       = 'EA'
              IMPORTING
                av_qty_plt = bapi_onhand
                return     = return
              TABLES
                wmdvsx     = atp1
                wmdvex     = atp2.
            IF return IS INITIAL.
              READ TABLE atp2 WITH TABLE KEY bdcnt = 0
                                               req_date = sy-datum
                                               com_date = sy-datum.
              IF atp2-com_qty <> '9999999999.000'.
                ONHAND = ONHAND + atp2-com_qty.
              ELSE.
                ONHAND = ONHAND + bapi_onhand.
              ENDIF.
            ENDIF.

  • Problem calling function

    Hi,
    i have creted a function module which read stock quantity using BAPI_MATERIAL_AVAILABILITY.
    Import - MFRPN
    Export - QNTY
    If i execute function module from SAP the result it's OK but when i call function from PHP it does not output nothing.
    $sap = new saprfc(array(
                                       "logindata"=>array(
                                            "ASHOST"=>"192.168.3.1"          // application server
                                            ,"SYSNR"=>"00"                    // system number
                                            ,"CLIENT"=>"200"               // client
                                            ,"USER"=>"rfc"               // user
                                            ,"PASSWD"=>"123456789"          // password
                                       ,"show_errors"=>true               // let class printout errors
                                       ,"debug"=>false)) ;                     // detailed debugging information
              // Call-Function
              // Call-Function
              $result=$sap->callFunction("Z_READ_QNTY",
                                                             array(
                                                                     array("IMPORT","MFRPN",$_POST['cod']),
                                                                     array("EXPORT","QNTY",$quantity),
              // Call successfull?
              if ($sap->getStatus() == SAPRFC_OK)
                   echo $quantity;
              else
                   // No, print long Version of last Error
                   $sap->printStatus();
                   // or print your own error-message with the strings received from
                   //           $sap->getStatusText() or $sap->getStatusTextLong()
    Please someone help me.
    Thank you.

    hi Dan,
    i will send you an working code sample. The  Fuba ZGET_MAKTX is easy  MATNR as import parameter and MAKTX as export parameter.
    you will receive the material short description.
    hope this will help you a little bit.
    in your code i thing you forgot to fill the $quantity    like this    $quantity = saprfc_export($fce,"QNTY");   before         echo $quantity;
    regards
    Tony
    <?php
         //Login to SAP R/3
         $login = array ("ASHOST"=>"vsap3", "SYSNR"=>"2", "CLIENT"=>"200","USER"=>"vsrfc", "PASSWD"=>"********", "CODEPAGE"=>"1100");
         $rfc = saprfc_open($login);
         if (!$rfc) {
              echo "RFC connection failed";
              exit;
         $fce = saprfc_function_discover($rfc,"ZGET_MAKTX");
         if (!$fce) {
              echo "Discovering interface of function module failed";
              exit;
         saprfc_import($fce,"MATNR","200200");
         $rc = saprfc_call_and_receive ($fce);
             if ($rfc_rc != SAPRFC_OK) { if ($rfc == SAPRFC_EXCEPTION ) echo ("Exception raised: ".saprfc_exception($fce)); else echo (saprfc_error($fce)); exit; }
             $maktx = saprfc_export($fce,"MAKTX");
             echo $maktx;
             saprfc_function_free($fce);
             saprfc_close($rfc);
    ?>
    Edited by: Tony Wienhold on Oct 7, 2008 11:19 AM
    Edited by: Tony Wienhold on Oct 7, 2008 11:22 AM

  • Calling Bapi through BADI gives data statement error

    Dear Experts,
    I am trying to call BAPI through BADI ME_PROCESS_REQ_CUST --> process_item.
    I get an error stating that "The addition OCCURS no longer supported in OO objects"
    If, I remove OCCURS statement I get an error stating that "Tables with headers are no longer supported in OO context" for the following data statement.
    Appreciate, if you could provide possible solution to overcome the problem.
    Regards
    Kumar
    BAPI code is as follows.
    DATA: LV_TABIX LIKE SY-TABIX,
    LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
    LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
    LV_TABIX = SY-TABIX.
    CLEAR: LT_WMDVSX, LT_WMDVEX.
    REFRESH: LT_WMDVSX, LT_WMDVEX.
    Fill communication table
    LT_WMDVSX-REQ_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
    LT_WMDVSX-REQ_QTY = ET_PROCUREMENT_ITEM-QUANTITY.
    APPEND LT_WMDVSX.
    Availability check with check rule '03'
    CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
    EXPORTING
    PLANT = ET_PROCUREMENT_ITEM-PLANT
    MATERIAL = ET_PROCUREMENT_ITEM-MATERIAL
    UNIT = ET_PROCUREMENT_ITEM-UNIT
    CHECK_RULE = '03'
    TABLES
    WMDVSX = LT_WMDVSX
    WMDVEX = LT_WMDVEX
    EXCEPTIONS
    OTHERS = 1.
    IF SY-SUBRC EQ 0.
    READ TABLE LT_WMDVEX WITH KEY
    COM_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
    IF SY-SUBRC EQ 0.
    ET_PROCUREMENT_ITEM-AVAIL_QTY = LT_WMDVEX-COM_QTY.
    ENDIF.
    ENDIF.

    Hi,
    Occurs is no more supported by SAP ( is an obsolete statement )
    <b>Instead of following code</b>
    DATA: LV_TABIX LIKE SY-TABIX,
    LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
    LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
    you can use
    data: LT_WMDVSX type standard table of BAPIWMDVS,
            LT_WMDVEX type standrad table of  BAPIWMDVE,
            LS_WMDVSX like line of LT_WMDVSX ,      "( work area )
            LS_WMDVEX like line of LT_WMDVEX.       "(work area)
    use workarea to get the data and then append the records from workarea to Internal tables
    Reward points if usefull
    Regards,
    Mohan

  • CO09 and BAPI_MATERIAL_AVAILABILITY for ATP Check

    Hi all,
    On R/3 4.6c...
    I am trying to find if there is a BAPI or funciton module out there which I can use to get the material availability (ATP quantity) as per the results of CO09.
    I looked at BAPI_MATERIAL_AVAILABILITY but the BAPI only accepts the checking rule. This does not have a switch to check with requirements. On CO09, there is a check box which allows us to check with requirements or not (With reqmts quants).
    For my ATP check, I would like the system to assume that the total requirements quantity is taken into account during the availability check, rather than the quantities that have already been committed.
    This is required for a system to system call hence the need for a BAPI or funciton module.
    Thanks for any help!
    Fred

    Hi,
    You can get the ATP quantity by using function module 'AVAILABILITY_CHECK'.
       ls_atpcsx-matnr  = lt_ekpo-matnr.
       ls_atpcsx-werks  = 'D001'.
       ls_atpcsx-prreg  = '01'.
       ls_atpcsx-lgort  = 'CS'.
       ls_atpcsx-idxatp = '1'.
       ls_atpcsx-chkflg = 'X'.
       ls_atpcsx-bdter  = sy-datum.
       APPEND ls_atpcsx to lt_atpcsx.
       clear ls_atpcsx.
       CALL FUNCTION 'AVAILABILITY_CHECK'
         TABLES
           p_atpcsx            = lt_atpcsx
         EXCEPTIONS
           ERROR               = 1
           OTHERS              = 2.
       IF sy-subrc = 0.
         READ TABLE lt_atpcsx INTO ls_atpcsx INDEX 1.
         it_result_cspo-atpqty = ls_atpcsx-atpm1.
         REFRESH lt_atpcsx.
         clear ls_atpcsx.
       ENDIF.

  • Regarding "BAPI_MATERIAL_AVAILABILITY" (important)

    Hi,
    In my program, I use BAPI_MATERIAL_AVAILABILITY to get the <u><b>on-hand quantity in CSE.</b></u>
    The following is my code:
        CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
          EXPORTING
            plant      = I_ZDAILY_MVMT-WERKS
            material   = I_ZDAILY_MVMT-MATNR
            unit       = 'CSE'
          IMPORTING
            av_qty_plt = bapi_onhand
            return     = return
          TABLES
            wmdvsx     = atp1
            wmdvex     = atp2.
        IF return IS INITIAL.
          READ TABLE atp2 WITH TABLE KEY bdcnt = 0
                                           req_date = sy-datum
                                           com_date = sy-datum.
         IF atp2-com_qty <> '9999999999.000'.
           I_ZDAILY_MVMT-ONHAND_VAL =  atp2-com_qty.
         ELSE.
            I_ZDAILY_MVMT-ONHAND_VAL =  bapi_onhand.
         ENDIF.
        ENDIF.
    The problem is that if the commented section above is uncommented, i get extremely large and unreliable data (for example 163,333,333,333,333 - which doesn't make sense.)
    On the other hand, when the commented sections are left commented, i get data that seems real.
    Which is the right way and what am i doing wrong? How do i check if the data that i am getting is correct?
    Thanks,
    John
    Responses will be rewarded and highly appreciated

    Hi,
    What are the characteristics of  I_ZDAILY_MVMT-ONHAND_VAL?  Are you referencing bapi_on_hand with the section commented as being a correct value and I_ZDAILY_MVMT-ONHAND_VAL with the section not commented being an incorrect value?
    Warren

  • ABAP function call through vba

    Hi
    I am a vba/ .net developer. An ABAP programmer created an ABAP function and I´d like to call it through VBA code.
    To access it in SAP GUI, the user access the transaction /N/TENR/MM0035
    However, when I access it in a VBA code I get an error
    Set oCtrl = CreateObject("sap.Functions")
    Set oLogon = CreateObject("sap.logoncontrol.1")
    Set oCtrl.Connection = oLogon.newconnection
    oCtrl.Connection.Logon
    Set obj = oCtrl.Add("/n/TENR/MM0035")
    I get an erro at last line code: Error 1001: SAP Remote Function Call
    It seems it cound not find the function. When I change the function name to BAPI_MATERIAL_AVAILABILITY, for instance, it works.
    Can anybody help
    Thanks

    Hi pklj_2000,
    you can try the following:
    Set oCtrl = CreateObject("sap.Functions")
    Set oLogon = CreateObject("sap.logoncontrol.1")
    Set oCtrl.Connection = oLogon.newconnection
    oCtrl.Connection.Logon
    'Set obj = oCtrl.Add("/n/TENR/MM0035")
    session.findById("wnd[0]/tbar[0]/okcd").text = "/n/TENR/MM0035"
    session.findById("wnd[0]").sendVKey 0
    Regards,
    ScriptMan

  • Why i can not get the quantity via BAPI_MATERIAL_AVAILABILITY ?

    Hi Experts ,
    I had wrote an abap/4 program to invoke BAPI_MATERIAL_AVAILABILITY this BAPI .
    But i found the result that the aty-quantity in every storage location is the same .. ...
    Is it something wrong with my Code or Something missing in SD customizing setting ?
    in my company we have three storage location : 7000 & 7001 & 7002
    my code :
    Call BAPI Material Availability
          CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
               EXPORTING
                    plant      = 'CN10'
                    material   = it_mater-matnr
                    unit       = 'PC'
                    check_rule = 'BO'
                    STGE_LOC   = '7000'
               IMPORTING
                    return     = ls_return
                    AV_QTY_PLT = w_recqty
               TABLES
                    wmdvsx     = lt_req
                    wmdvex     = lt_com.
    <b>write : lt_com-qty .</b>
    clear lt_com .
    Call BAPI Material Availability
          CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
               EXPORTING
                    plant      = 'CN10'
                    material   = it_mater-matnr
                    unit       = 'PC'
                    check_rule = 'BO'
                    STGE_LOC   = '7001'
               IMPORTING
                    return     = ls_return
                    AV_QTY_PLT = w_recqty
               TABLES
                    wmdvsx     = lt_req
                    wmdvex     = lt_com.
    <b>write : lt_com-qty .</b>
    Thanks a lot !
    Best Regards,
    Carlos

    I can only comment on #2. Because the player doesn't use 'drivers' and relies on Microsofts MTP (Media Transfer Protocol) it doesn't 'officially' work on Macs. However, on previous Creative MTP players independant end users have always come through and written software to work around this issue. I don't own a Mac, and haven't tested it out myself, but I hear it works.

  • Error while calling a method on Bean (EJB 3.0)

    I am getting an error while calling a method on EJB. I am using EJB3.0 and my bean is getting properly deployed(i am sure b'cos i can see the successfullly deployed message). Can any body help me
    Error is -->
    Error while destroying resource :An I/O error has occured while flushing the output - Exception: java.io.IOException: An established connection was aborted by the software in your host machine
    Stack Trace:
    java.io.IOException: An established connection was aborted by the software in your host machine
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
    at sun.nio.ch.IOUtil.write(IOUtil.java:75)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
    at com.sun.enterprise.server.ss.provider.ASOutputStream.write(ASOutputStream.java:138)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
    at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.rollback(AbstractJdbc1Connection.java:1031)
    at org.postgresql.jdbc2.optional.PooledConnectionImpl$ConnectionHandler.invoke(PooledConnectionImpl.java:223)
    at $Proxy34.close(Unknown Source)
    at com.sun.gjc.spi.ManagedConnection.destroy(ManagedConnection.java:274)
    at com.sun.enterprise.resource.LocalTxConnectorAllocator.destroyResource(LocalTxConnectorAllocator.java:103)
    at com.sun.enterprise.resource.AbstractResourcePool.destroyResource(AbstractResourcePool.java:603)
    at com.sun.enterprise.resource.AbstractResourcePool.resourceErrorOccurred(AbstractResourcePool.java:713)
    at com.sun.enterprise.resource.PoolManagerImpl.putbackResourceToPool(PoolManagerImpl.java:424)
    at com.sun.enterprise.resource.PoolManagerImpl.resourceClosed(PoolManagerImpl.java:393)
    at com.sun.enterprise.resource.LocalTxConnectionEventListener.connectionClosed(LocalTxConnectionEventListener.java:69)
    at com.sun.gjc.spi.ManagedConnection.connectionClosed(ManagedConnection.java:618)
    at com.sun.gjc.spi.ConnectionHolder.close(ConnectionHolder.java:163)
    at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:379)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.closeConnection(DatasourceAccessor.java:367)
    at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeConnection(DatabaseAccessor.java:402)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.afterJTSTransaction(DatasourceAccessor.java:100)
    at oracle.toplink.essentials.threetier.ClientSession.afterTransaction(ClientSession.java:104)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.afterTransaction(UnitOfWorkImpl.java:1816)
    at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.afterCompletion(AbstractSynchronizationListener.java:161)
    at oracle.toplink.essentials.transaction.JTASynchronizationListener.afterCompletion(JTASynchronizationListener.java:87)
    at com.sun.ejb.containers.ContainerSynchronization.afterCompletion(ContainerSynchronization.java:174)
    at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:467)
    at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
    at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
    at $Proxy84.addDepartment(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
    End of Stack Trace
    |#]
    RAR5035:Unexpected exception while destroying resource. To get exception stack, please change log level to FINE.
    EJB5018: An exception was thrown during an ejb invocation on [DepartmentSessionBean]
    javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException
    javax.transaction.SystemException
    at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:452)
    at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
    at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
    at $Proxy84.addDepartment(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    Means theres an error in XML/ABAP conversion probably due a syntax error...
    Regards
    Juan

  • Caller ID Not working

    I think i am going nuts, cos my new BTVerve 450 is a great phone, but it will not display Caller ID. I am with Virgin for my phone line etc, with a wireless router for my laptop. Can anyone help? I really dont want to return the phones, i am really pleased with the unit, but i really need caller ID, especially as i am paying extra for it! Any suggestions would be welcome, Bernie

    Try just plugging the phone in without anything else connected (BB Router, Filters, Sky box) and see if that works, if it does plug each item back in on at a time, trying an incoming call each time.
    You may find problems with either a duff filter or even the router can sometimes mask the display
    (If I have helped you in any way to say "Thank You" please click on the star next to the message. Thank You)
    If I have solved your Issue please click the "Mark as accepted solution" button.

  • Iphone 5S call voice Low quality.

    Iphone 5S  low quality call voice.  When I make a phone call , people in the other side said my voice is very small and disconnected. The voice is good when I am using the earphone at the same calls

    Hello tigertiger123abd,
    The following article can help sort your iPhone's built-in microphone.
    iPhone: Microphone issues
    http://support.apple.com/kb/TS5183
    Cheers,
    Allen

  • IPhone Voice Memos Interrupted By Incoming Calls

    I notice that every time I use my Voice Memos software on the 3G(s), if an call comes in, the Voice Memo stops recording and I won't know it till I look at the phone later. Is there ANY way to stop that for that not to happen and you can have perhaps the calls go directly into voice mail so that the Voice Memo feature doesn't get interrupted? It's useless to me otherwise.
    Thanks for anyone's input!

    The voice recorder application - just like every other iPhone application, native or 3rd party - will shut down when you receive a phone call. The iPhone operates under the assumption that the device is first and foremost a telephone.
    As far as work arounds go, you can always put the phone in airplane mode when you need to use the voice recorder app uninterrupted. This will send all incoming calls directly to voicemail.
    Message was edited by: Ansuz82

Maybe you are looking for

  • System unable to read table in Adhoc Query

    Hi Experts, I am trying to extract a report based on Infotype 0022 through Adhoc query. Even after maintaining data for IT0022 for a few employees the system is unable to read the educational details of those employees. I am unable to trace the defec

  • Getting Error using ZMG from Boot DVD 10.2.2

    So I created a ZCM boot 10.2.2 and put by base image on the root of /mnt/cdrom/xxxxx.zmg . The image was right under one 1gig. I edited the Main Script to look like the following img pd1 img pd2 img pc1 NTFS img -rl /mnt/cdrom/xxx.zmg So that worked

  • My 4s crashed while downloading ios8

    My 4s crashed while downloading ios8. Keeps asking to connect to itunes. Since it only charges when it's off, i'm not able to do so. tried rebooting using sleep/wake buttons but did not connect. Any suggestions on how to restore it

  • Error 1051414

    Hi, I'm trying to migrate an Essbase application from a server with version 9.3.1 (not exterrnalize but with NTLM ldap and no SSL)to a new server on version 11.1.1 (externalize with MSAD and with SSL) and get this error. 1051414 Failed to set role fo

  • How to import AVCHD clips from HD camcorder?

    How I can import AVCHD clips from Sony HDR-TG1 with best possible quality to iMovie '09? Camera records clips as 1080i format but when I import them to iMovie '09 quality are cr*p. I have a same problem with iMovie '08. This has something to do with