Calling BAPI_COMPANYCODE_GETDETAIL from VBA (Excel)

Hi,
I've successfully called a number of BAPIs in VBA, however am getting a problem with BAPI_COMPANYCODE_GETDETAIL
It doesn't seem to pick up the structure of the tables - the 'Tables' objects just get set to 'nothing' rather than pulling back the structure, like it should. The call itself doesn't fail but obviously no data is returned.
Much appreciate any ideas!
Set oSAPFunctions = CreateObject("SAP.Functions")
Set oSAPBapiFn = oSAPFunctions.Add("BAPI_COMPANYCODE_GETDETAIL")
    Set oSAPECC = oSAPBapiFn.Exports("COMPANYCODEID")
    Set oSAPICCD = oSAPBapiFn.Tables("COMPANYCODE_DETAIL")
    'Set oSAPICCA = oSAPBapiFn.Tables("COMPANYCODE_ADDRESS")
    Set oSAPTRet = oSAPBapiFn.Tables("RETURN")
    oSAPECC.Value = "xxxx"    
    If oSAPBapiFn.Call = False Then
        iRet = False
    Else
'worked
   EndIf

Hi wg,
Thanks for your reply, however I'm not entirely sure what you mean: the TABLES parameters are returned FROM the function module?
However I attempted what I thought you meant and changed the code as below:
Set oSAPFunctions = CreateObject("SAP.Functions")
Set oSAPBapiFn = oSAPFunctions.Add("BAPI_COMPANYCODE_GETDETAIL")
Set oSAPECC = oSAPBapiFn.Exports("COMPANYCODEID")
Set oSAPICCD = oSAPBapiFn.Tables("COMPANYCODE_DETAIL")
'Set oSAPICCA = oSAPBapiFn.Tables("COMPANYCODE_ADDRESS")
Set oSAPTRet = oSAPBapiFn.Tables("RETURN")
oSAPICCD("COMP_CODE").Value = "" <---- new line
oSAPECC.Value = "xxxx"
If oSAPBapiFn.Call = False Then
iRet = False
Else
'worked
EndIf
However I got the error that oSAPICCD hadn't been set yet, probably because it doesn't seem to be pulling down the structure of COMPANYCODE_DETAIL from SAP (i.e. being set to 'Nothing').

Similar Messages

  • Xcelsius suddenly only allows chart to call data from first excel worksheet

    Hi
    I'm using Xcelsius 2008 Engage with SP1 FP3 installed.
    I have never had this problem before, but in the last week, Xcelsius won't allow a chart to call data from any worksheet in the excel file other than the first worksheet. If I reorder the worksheets in the excel file, i can access a different worksheet, but only the one that is saved as the first worksheet (left most tab).
    In dashboards i have already created, i can't change the data range of a chart that's already calling data from a worksheet unless i select the first worksheet.
    Could this be an automatic update from microsoft? Has anyone else experienced this and worked out how to overcome it? It is frustrating to keep moving the worksheet to the front and reimporting the data everytime i want to make a change that isn't in the first excel worksheet.
    Thanks,
    Scott.

    As far as I remember it's not possible. Thus, find attached VI and use it to convert line/column to excel cell format. It's working if you are not using more than 26 columns (i.e. column AA, AB, ... if this is the case you have to improve it a little)
    Hope this helps
    Attachments:
    To_Cell_Format.vi ‏18 KB

  • Calling BAPI from VBA - type mismatch error

    Hi,
    I am trying to retrieve data from SAP R/3 material documents to Access VBA. In the example below, the connections works fine, but when I assign the value to the parameters, fx:
    MatDocItems.exports("MATERIAL_RA") = "000000000001032197",
    I get an error in vba: Run-time error 13: Type mismatch.
    A similar code works fine with USER_GETLIST, and I am thinking that the problem is related to the multiline check box in BAPI_GOODSMVT_GETITEMS.
    Hope someone can help,
    Simon
    Sub MatDocItemsBAPI()
        Dim Destination_System As Integer
        Dim objBAPIControl As Object
        Dim sapConnection As Object
        Set objBAPIControl = CreateObject("SAP.Functions")
        Set sapConnection = objBAPIControl.Connection
        sapConnection.client = "xxx"
        sapConnection.User = "xxx"
        sapConnection.Language = "xxx"
        sapConnection.hostname = "xx.xx.xx.xx"
        sapConnection.Password = "xxxxx"
        sapConnection.SystemNumber = "xx"
        sapConnection.System = "xxx"
        sapConnection.Destination = "xx"
        If sapConnection.logon(1, True) <> True Then
            MsgBox "No connection to R/3!"
            Exit Sub
        End If
        Set MatDocItems = objBAPIControl.Add("BAPI_GOODSMVT_GETITEMS")
        MatDocItems.exports("MATERIAL_RA") = "000000000001032197"
        MatDocItems.exports("TR_EV_TYPE_RA") = "WL"
        MatDocItems.exports("USERNAME_RA") = "PABIT"
        returnFunc = MatDocItems.Call
        If returnFunc = True Then
            Dim objTable As Object
            Set objTable = MatDocItems.Tables("GOODSMVTHEADER")
            MsgBox ("Row count :" & objTable.ROWCOUNT)
        Else
            MsgBox "Error when accessing BAPI in R/3 ! "
            Exit Sub
        End If
        objBAPIControl.Connection.logoff
        Set sapConnection = Nothing
        Set functionCtrl = Nothing
        MsgBox "Program done!", 0, "Exit"
    End Sub

    wrong forum.

  • Call BAPI from VBA (access 2007)

    Dear Experts
    how can i call a BAPI from Visual Basic (in MS Access 2007)
    i want to call the BAPI  -> BAPI_SALESORDER_CREATEFROMDAT1
    please help

    Hi, how are you?
    Look, it's easy to do a rfc call to SAP.
    But, if you look in the Netweaver Developer Studio 7.1, the SAP CONNECTOR is deprecated. So, my recomendation is to convert your RFC's to Web Services, and consume them like that, you won't have any problem with SOAP.
    Regards,
    Sebastiá

  • Call BEX-Query from VBA with BEX-automatic login?

    Hi,
    I'm trying to call a query from VBA. I have two problems/questions:
    1. Automatic login?
    I want to do an automatic login. I found this peace of code here, but I get an error:
    Public Function  LogonToYourBW()
    ' create Logon & RFC-Handle
    logonToBW = False ‘ clear connect Flag the flag can be used to find out if connected or not
        'load SAP functionality by opening BEX file ( use your installation path)
            Workbooks.Open (“c:\sappc\bw\sapbex.xla”)
        With Run("sapbex.xla!sapbexGetConnection") ‘ call the connection
           ' Set the params for Auto logon
           .client = “YOUR CLIENT NO”
           .user = “YOUR BW USER”
           .Password = “YOUR BW PWD” ‘ I recommend to create a dummy reporting user for this task
           .Language = “YOUR LANGUAGE YOU LIKE TO USE FOR QUERY DISPLAY ( i.E.  “EN”)”
           .SystemNumber = “YOUR SYSTEM NO” ‘
           .ApplicationServer = “YOUR SERVER Name OR IP-ADDRESS”
           .UseSAPLOgonIni = FALSE 'important for automatic connection
           .logon 0, True ‘ This will provide a dialog to appear
            If .IsConnected <> 1 Then
                .logon 0, False
                If .IsConnected <> 1 Then Exit Function
            Else
                Set g_oFunction = CreateObject("SAP.Functions")
                Set g_oFunction.Connection = g_oConnection
            End If
        End With
        Run "sapbex.xla!sapbexinitConnection" ‘ this will enable the connection you just created
        logonToBW = True
    End Function
    The error is by this row:
    Set g_oFunction.Connection = g_oConnection
    Object is needed! How is the g_oConnection-object defined?
    2. How can I pass values for the parameters from VBA?
    If I open the query usually from SAP-BEX-Toolbar, after selecting the query, I get a parameter mask, where I must put in a value. How can I this automatize from VBA? Has anybody a short samplecode for that?
    Thank you for your help
    Stefan
    [email protected]

    Peter and others:
    What I really want to do … is write a stand-alone application that I can run from windows scheduler … that queries our BW for sales data for certain items (in a tabular form) … and pulls that data into a VB recordset, or a .NET dataset … so that I can insert the rows into another database (SQL Server, or Access) … I already know how to do all the data movement to/from datasets and databases … I just cannot figure out how to programmatically grab this sales data from BW … our company has “workbooks” already set up that aggregate WW sales information by region (IE, there is a separate workbook for each region of the world) … I can manually go into the Excel interface, tell it which items to pull the sales info for, and it dumps the data into the worksheet (organized by customer, and then by cat #) …
    So, what I’d like to do is write an app that will pull data every week or so from the BW (from each region’s sales invoice detail “workbook”), and insert it into another database that we use for reporting other, non-sales, data.
    Thoughts on this ?  Is there another, non-BEx method that is better ?
    thanks !!

  • Adobe Javascript from within Excel VBA

    I have some limited experience with Excel VBA and Adobe Javascript separately, but have never tried to put them together. I am rather baffled by the use of “DoJavaScript” from within Excel VBA. I have a number of Illustrator JavaScripts that do various tasks (mostly measure and set properties on illustrator drawing objects to determine some geometric metrics). I wanted to run these scripts from within Excel VBA (they run without problem when directly called into Illustrator). My hope was to pass a few real numbers from VBA into the JavaScript before one ran to set some run parameters and then get a few real numbers back out from the JavaScript back into VBA. I cannot seem to get even the simple DoJavaScript command given in the Adobe VBscript reference to run. Reading other posts that seem somewhat related it is not clear if I am doing something very simple wrong, or if my understanding of the use of the DoJavaScript command is misguided. Anyone able to shed some light on this?
    My last try was this simple test...almost directly from the Adobe reference:
    Private Sub SetScale_CommandButton1_Click()
    Set appRef = CreateObject("Illustrator.Application")
    Set myNumberOfDocuments = appRef.DoJavaScript("documents.length;")
    MsgBox myNumberOfDocuments
    End Sub
    I am really hoping to be able to run javascripts that are a few hundred lines long....but if I cannot even get something simple to go then I am about to give up on it.
    Thanks for any suggestions

    Carlos;
    I am most grateful! ... I was stumped on that for hours, thought I had tried about every combinatory possible, and was about to give up on getting the DoJavaScript  method to work. There are few examples of this on the web, so for anyone else who would like a bit more verbose  example I post below is a simple VBA sub-routine that uses a javascript function to return the number of selected objects in the current active illustrator document and displays that number in a message box in excel. Simple example, but it was the sort if thing I was looking for all over the web before Carlos’ help.
    Cheers,
    Brian
    Private Sub ObjectNum()
    Set appRef = CreateObject("Illustrator.Application")
          tmp$ = "function myfunction() {"
          tmp$ = tmp$ + "var idoc = app.activeDocument;"
          tmp$ = tmp$ + "var sel = idoc.selection;"
          tmp$ = tmp$ + "var numobj = sel.length;"
          tmp$ = tmp$ + "return numobj;};"
          tmp$ = tmp$ + "myfunction();"
    numobj = appRef.DoJavaScript(tmp$)
    MsgBox numobj
    End Sub

  • How can I call a variable from VBA in Diadem report?

    Hello,
    I have a script in Diadem, script that I can control from a VBA application ( from Excell), and I want to send from Excell some details to the report.
    I want in the report, the  Local Test Order field to by the LocalTO from the VBA (Excell), the DVM Test Order fiel to be the DVMTO from Excell, and ..... al the fields from the excell to be in the report.
    And in the Diadem script the filename of the export .pdf file to be the filename from the Excell.
    Attached I put the script from Diadem and the VBA application.
    Thank you for your time.
    Attachments:
    Diadem.zip ‏28 KB

    Hello Marse!
    Sorry that I was not clear enough and add the hwo-to via OLE
    For way 1. you have to add this lines to your Excel VBA code:
    loadscript = IDIACommand.TextVarSet("T1","Value of T1")
    For way 2. it is:
    loadscript = IDIACommand.CmdExecuteSync("GlobalDim('MyGlobalVar'")
    loadscript = IDIACommand.VariantVarSet("MyGlobalVar","Value of MyGlobalVar")
    Inserted before your line
    loadscript = IDIACommand.CmdExecuteSync("scriptstart('C:\BForce\LIBR\BForce2.VBS')")
    Hope it is clear now! Otherwise feel free to ask
    Matthias
    Message Edited by Twigeater on 10-10-2008 09:43 AM
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • Call transaction from excel

    Dear all,
    i want to call an own created function module from ms excel with one importing parameter. my own create function module call another sap-transaction with this i-parameter and skip first screen. I know how to call an remote-enabled module, but i dont know how to call an sap-function-modul to show a dynpro.
    Is there any chance to do this. i tried to do this with an shortcut (.sap), but i dont know how to export a parameter.
    maybe its possible with an sap-connection-object?
    Best regards
    Andreas

    Good suggestion, but
    I get "permission denied" for   SapGuiAuto.GetScriptingEngine
    I also tried the method below, but received this RFC error message:
    User PPPPPPP  has no RFC authorization for function group SYST.
    Sub LoginCheck()
    If login = False Then
        ' Setting the necessary variables for R/3 connection
        Set objBAPICortrol = CreateObject("SAP.Functions")
        Set objConnection = objBAPICortrol.Connection
        ' Establish a connection
    If objConnection.Logon(0, False) Then
        login = True
        MsgBox "Connection Established"
        CommandButton1.Caption = "Disconnect"
    End If
    Else
        CommandButton1.Caption = "Connect 2 SAP"
        login = False
        objConnection.Logoff
        Set objConnection = Nothing
        Set objBAPICortrol = Nothing
    End If
    End Sub
    I was told that these kinds of authority open up too big of a window that can't be monitored adequately...
    I'm considering an approach like what is below if I can't convince security to grant me permissions...
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys EnterKey, False
    Since blocked RFC security settings are preventing the solution from being installed, I am markgin this question as answered. 
    I will post different questions about 1. how to convince the security team that it will be safe to allow the use of RFC calls, and /or 2. how use some windows-level scripting code to run the SAP jobs.
    Thanks.
    Edited by: GlennWebster on Mar 1, 2010 4:34 PM

  • Calling a Siebel Business Service from an Excel Macro

    Hi Everyone !!
    I have a requirement where i have to call a siebel Business Service from an excel macro. Please help me with the code.
    Regards,
    Abhi

    Here's a starter for one:
    Private Function ConnectToSiebel(sConnectString As String, sUserName As String, sPassword As String, _
    oSiebel As SiebelDataControl) As Boolean
    On Error GoTo ErrorHandler
    ' Uses the specified parameters to connect to the Data Control
    Dim iErrCode As Integer
    Set oSiebel = CreateObject("SiebelDataControl.SiebelDataControl.1")
    oSiebel.Login sConnectString, sUserName, sPassword
    If (oSiebel.GetLastErrCode <> 0) Then GoTo ErrorHandler
    ConnectToSiebel = True
    Exit Function
    ErrorHandler:
    MsgBox oSiebel.GetLastErrCode
    ConnectToSiebel = False
    End Function
    The connect string passed takes the format:
    host="siebel://<SERVER_HOST>/<SERVER_NAME>/PSCcObjMgr_enu"
    You can then use the 'oSiebel' object as if it was the Application(). For example, Set oService = oSiebel.GetBusService("Blah")
    Regards,
    mroshaw

  • Calling RFC funtions from VBA

    Hi all,
    I would like to call RFC funtions from VBA, could you please advise on what library should I set reference to?
    A piece of sample code would also be highly appreciated.
    Thanks in advance.
    Tomas

    here is a small code sample using vbscript
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <title>RFC Example - THUSRINFO</title>
    <script language="VBScript">
    sub get_cust_data()
    dim fns
    set fns = createobject("SAP.Functions")
    fns.logfilename = "my_log.txt"
    fns.loglevel = 6
    dim conn
    set conn = fns.connection
    conn.ApplicationServer = "application server name or ip address"
    conn.System = "DEV"
    conn.user = document.myf.t1.value
    conn.password = document.myf.t2.value
    conn.Client = "025"
    conn.Language = "E"
    conn.tracelevel = 6
    if conn.logon(0, true) <> true then
    exit sub
    end if
    dim myfunct
    set myfunc = fns.add("THUSRINFO")
    result = myfunc.Call
    the_exception = myfunc.exception
    dim users
    if result = true then
    set users = myfunc.tables.item("USR_TABL")
    document.write "Table USR_TABL, " & users.rowcount & " rows"
    document.write "<table border=1>"
    document.write "<tr>"
    document.write "<td>BNAME</td>"
    document.write "<td>MANDT</td>"
    document.write "<td>TCODE</td>"
    document.write "<td>TERM</td>"
    document.write "<td>ZEIT</td>"
    document.write "<td>HOSTADR</td>"
    document.write "<td>RFC TYPE</td>"
    document.write "</tr>"
    for each user in users.Rows
    document.write "<tr>"
    document.write "<tr>"
    document.write "<td>"
    document.write trim(user("BNAME"))
    document.write "</td>"
    document.write "<td>"
    document.write trim(user("MANDT"))
    document.write "</td>"
    document.write "<td> "
    document.write trim(user("TCODE"))
    document.write "</td>"
    document.write "<td> "
    document.write trim(user("TERM"))
    document.write "</td>"
    document.write "<td>"
    document.write trim(user("ZEIT"))
    document.write "</td>"
    document.write "<td>"
    document.write trim(user("HOSTADR"))
    document.write "</td>"
    document.write "<td> "
    document.write trim(user("RFC_TYPE"))
    document.write "</td>"
    next
    document.write "</table>"
    set users = nothing
    end if
    fns.connection.logoff
    Set fns = nothing
    Set conn = nothing
    end sub
    </script>
    </head>
    <body>
    <form method="POST" name="myf">
      User Id <input type="text" name="T1" size="20"></p>
      <p>Password<input type="password" name="T2" size="20"></p>
      <p> </p>
      <p><input type="button" value="Submit" onclick="get_cust_data()" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>
    </body>
    </html>
    Regards
    Raja

  • Smartview 11.1.2 "Hyperion" tab disappeared from his Excel 2010.

    My user's Smartview 11.1.2 "Hyperion" tab disappeared from his Excel 2010. Trust Center shows that Add-In's are not disabled. We reinstalled and installed SV but nothing worked. What can we run to register SV to his Excel 2007? His Excel 2010 does have Smartview Add-in for HsTbar, Hsaddin.dll

    Please note that the 'solution' of copying files to the Addins folder is NOT recommended. You will probably cause more issues or store up problems for the future, such as when you upgrade the SmartView client. Believe me -- we get a lot of calls into Support caused by people doing this. It can cause:
    - loss of functionality owing to mixed file versions
    - the full path to HsTBar.xla to appear in front of SmartView functions
    - DLL hell when it comes to upgrading.
    Please check your system for duplicate copies of HsTBar.xla and HsAddin.dll and remove all but the ones in the correct SmartView installation folder. Also delete any duplicates of the other SmartView DLLs. Then re-register the DLLs in the SmartView\bin folder according to Jasmine's instructions. Note that you must be logged into your PC as a Power User or Administrator to do this. You should get a 'success' message for each DLL you register. Alternatively, uninstall SmartView, search for any remaining SmartView files (HsTBar.xla, HsAddin.dll) anywhere on the hard drive and delete them, then re-install.
    If you still get problems, log a support call.
    Edited by: user807652 on Feb 17, 2011 4:28 AM

  • How to export the data from an excel file to Oracle database by using macro

    Hi,
    I want to export data from an excel file into Oracle database.There is one method that by creating the macros through excel we are able to do this.
    can anybody please send me the code to create macros?
    Thanks in advance.
    Regards,
    Surendra.V

    There are several resources on the web, but you could start analyzing if this code fits your needs --> VBA Macro for Excel 2003 Export of Text File with Comma and Quote Delimiters.
    ~ Madrid

  • GUI_UPLOAD to read data from an Excel File

    Hi Folks,
    I'm using FM GUI_UPLOAD to read data from an Excel File. But all I see in the table returned is 1 row with garbage values (special chacaters). Excel Workbook has proper data in the sheet, but its not getting uploaded properly. Sy-subrc is 0.
    What could be the reason?
    Thanks

    use FM : ALSM_EXCEL_TO_INTERNAL_TABLE
    See the example program to get from XLS file to Internal table
    REPORT ZLWMI151_UPLOAD no standard page heading
                           line-size 100 line-count 60.
    *tables : zbatch_cross_ref.
    data : begin of t_text occurs 0,
           werks(4) type c,
           cmatnr(15) type c,
           srlno(12) type n,
           matnr(7) type n,
           charg(10) type n,
           end of t_text.
    data: begin of t_zbatch occurs 0,
          werks like zbatch_cross_ref-werks,
          cmatnr like zbatch_cross_ref-cmatnr,
          srlno like zbatch_cross_ref-srlno,
          matnr like zbatch_cross_ref-matnr,
          charg like zbatch_cross_ref-charg,
          end of t_zbatch.
    data : g_repid like sy-repid,
           g_line like sy-index,
           g_line1 like sy-index,
           $v_start_col         type i value '1',
           $v_start_row         type i value '2',
           $v_end_col           type i value '256',
           $v_end_row           type i value '65536',
           gd_currentrow type i.
    data: itab like alsmex_tabline occurs 0 with header line.
    data : t_final like zbatch_cross_ref occurs 0 with header line.
    selection-screen : begin of block blk with frame title text.
    parameters : p_file like rlgrap-filename obligatory.
    selection-screen : end of block blk.
    initialization.
      g_repid = sy-repid.
    at selection-screen on value-request for p_file.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME = g_repid
           IMPORTING
                FILE_NAME    = p_file.
    start-of-selection.
    Uploading the data into Internal Table
      perform upload_data.
      perform modify_table.
    top-of-page.
      CALL FUNCTION 'Z_HEADER'
      EXPORTING
        FLEX_TEXT1       =
        FLEX_TEXT2       =
        FLEX_TEXT3       =
    *&      Form  upload_data
          text
    FORM upload_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = p_file
                I_BEGIN_COL             = $v_start_col
                I_BEGIN_ROW             = $v_start_row
                I_END_COL               = $v_end_col
                I_END_ROW               = $v_end_row
           TABLES
                INTERN                  = itab
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        write:/10 'File '.
      ENDIF.
      if sy-subrc eq 0.
        read table itab index 1.
        gd_currentrow = itab-row.
        loop at itab.
          if itab-row ne gd_currentrow.
            append t_text.
            clear t_text.
            gd_currentrow = itab-row.
          endif.
          case itab-col.
            when '0001'.
              t_text-werks = itab-value.
            when '0002'.
              t_text-cmatnr = itab-value.
            when '0003'.
              t_text-srlno = itab-value.
            when '0004'.
              t_text-matnr = itab-value.
            when '0005'.
              t_text-charg = itab-value.
          endcase.
        endloop.
      endif.
      append t_text.
    ENDFORM.                    " upload_data
    *&      Form  modify_table
          Modify the table ZBATCH_CROSS_REF
    FORM modify_table.
      loop at t_text.
        t_final-werks = t_text-werks.
        t_final-cmatnr = t_text-cmatnr.
        t_final-srlno = t_text-srlno.
        t_final-matnr = t_text-matnr.
        t_final-charg = t_text-charg.
        t_final-erdat = sy-datum.
        t_final-erzet = sy-uzeit.
        t_final-ernam = sy-uname.
        t_final-rstat = 'U'.
        append t_final.
        clear t_final.
      endloop.
      delete t_final where werks = ''.
      describe table t_final lines g_line.
      sort t_final by werks cmatnr srlno.
    Deleting the Duplicate Records
      perform select_data.
      describe table t_final lines g_line1.
      modify zbatch_cross_ref from table t_final.
      if sy-subrc ne 0.
        write:/ 'Updation failed'.
      else.
        Skip 1.
        Write:/12 'Updation has been Completed Sucessfully'.
        skip 1.
        Write:/12 'Records in file ',42 g_line .
        write:/12 'Updated records in Table',42 g_line1.
      endif.
      delete from zbatch_cross_ref where werks = ''.
    ENDFORM.                    " modify_table
    *&      Form  select_data
          Deleting the duplicate records
    FORM select_data.
      select werks
             cmatnr
             srlno from zbatch_cross_ref
             into table t_zbatch for all entries in t_final
             where werks = t_final-werks
             and  cmatnr = t_final-cmatnr
             and srlno = t_final-srlno.
      sort t_zbatch by werks cmatnr srlno.
      loop at t_zbatch.
        read table t_final with key werks = t_zbatch-werks
                                    cmatnr = t_zbatch-cmatnr
                                    srlno = t_zbatch-srlno.
        if sy-subrc eq 0.
          delete table t_final .
        endif.
        clear: t_zbatch,
               t_final.
      endloop.
    ENDFORM.                    " select_data

  • Upload Journal Voutures of customer master from the Excel sheet using BAPI

    Hi experts,
    Can U have any sample program so that it can help me for my coding.

    Hi,
    You need write the abap program in the following manner,
    1. Read the data from the excel sheet and then enforce the checks if at all any in the new program.
    2. Fill all the parameters of the BAPI *BAPI_CASHJOURNALDOC_CREATE *.
    3. After the above BAPI call, you need to call another *BAPI_TRANSACTION_COMMIT *.
    4. Once Transaction commit bapi is successfully executed then only you will get the document number.
    Please follow all the above mentioned steps then you can create the Journal Voutures migrated from an excel sheet to SAP successfully.
    Thanks,
    Mahesh.

  • How to put the data from one excel sheet in another excel sheet

    hi ,
    I want put the data from one excel sheet in another excel sheet in seq. order Eg: I have one excel sheet in which i have 3 col. Name , Sno. , Email along with data .I want to put data from this sheet to another excel sheet in the following orders of col. Sno,Name, Email .
    While loading data in another sheet , i have to perform validation like char field should n't contain numeric values and vice versa .
    Let me know on this soon ..
    regards
    Prashant

    Well, you can issue separate queries with the ordering you need from each tab in the spreadhseet. You can open an ODBC connection from a VBA macro, select a sheet, run a query, select another sheet and run another query. As for the validation, you can do this in Oracle via stored procedures or again in VBA code.

Maybe you are looking for