Solved

how do I fix the error: cannot creat object of type sap.logoncontrol.1?

Posted on 2008-10-13
5
1,013 Views
Last Modified: 2012-05-05
I have a application that is taking a batch of records and attempting to put them in sap. I have created the portal to SAP but continue to get an error saying cannot create error of type 'SAP.LogonControl.1' I have the SAP Logon app installed on my local machine. The code is attached.
Imports MySql.Data.MySqlClient

Imports System.Data

Imports Microsoft.VisualBasic
 

Partial Class SAPLoad

    Inherits System.Web.UI.Page

    'Header cells

    Dim HeaderFlag, DocDate, PostDate, DocType, PerNum, CurrDesc, InvNum, HeaderText As String

    'Detail cells

    Dim PostingKey, AccountNum, SpecialLedger, CustNum, VendNum, Amount, CostCenter As String

    Dim ProfitCenter, ValueDate, PayTerm, BaselineDate, AssignNum, ItemText, CreditControl, DiscountAmount, PayBlock As String

    Dim PayMethod, WHTaxAmount, SpecialGL, HouseBank, CalcTaxFlag, TaxCode, Jurisdiction, SuccessFlag, PostDocNum, Code1099, WithholdTaxCode, InternalOrdNum, PlanningLevel, TradingPartner As String

    Public Row As Integer

    Public _cell(1600, 39) As String

    Dim conn As MySqlConnection

    Dim cmd As MySqlCommand

    Dim da As MySqlDataAdapter

    Public ds, ds2, ds3, ds4, ds5, ds6 As DataSet

    Public strSql, strSql2, strSql3, strSql4, strSql5, strSql6 As String

    Public acctmonth, acctyear, batchno, transactiontype As String

    Public klBloc As Char

    Public klBinv As System.Int64

    Public AISRC, AISTAT As String

    'Public PostingDate As String

    Public i As Integer
 

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

        ' Client 120 Constants                                                     '

        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

        ' Test for developer

        Const SYSTEM = "DR3"

        Const CLIENT = "120"

        Const USER = "Batch_BAPI"

        Const PASSWORD = "Bap1Temp"

        Const LANGUAGE = "EN"

        Const APPLICATION_SERVER = "10.1.1.127"

        Const SYSTEM_NUMBER = "10"

        Const HOST_NAME = "sansapxDEV01"

        Const NO_DATA = "/"
 

        'Test for user

        'Const SYSTEM = "QR3"

        'Const CLIENT = "210"

        'Const USER = "Batch_BAPI"

        'Const PASSWORD = "Bap1Temp"

        'Const LANGUAGE = "EN"

        'Const APPLICATION_SERVER = "10.1.1.175"

        'Const SYSTEM_NUMBER = "00"

        'Const HOST_NAME = "sansapxQAS01"

        'Const NO_DATA = "/"
 

        Dim CompNum As Integer

        Dim LogonCtrl, LogonConn, FunctionCtrl, TableFactoryCtrl As Object
 

        LogonCtrl = Server.CreateObject("SAP.LogonControl.1")

        FunctionCtrl = Server.CreateObject("SAP.Functions")

        TableFactoryCtrl = Server.CreateObject("SAP.TableFactory.1")
 

        LogonConn = LogonCtrl.NewConnection()
 

        LogonConn.System = SYSTEM

        LogonConn.Client = CLIENT

        LogonConn.User = USER

        LogonConn.Password = PASSWORD

        LogonConn.Language = LANGUAGE

        LogonConn.ApplicationServer = APPLICATION_SERVER

        LogonConn.SystemNumber = SYSTEM_NUMBER

        LogonConn.HostName = HOST_NAME
 

        If LogonConn.Logon(0, True) Then

            Response.Write("R/3 Connection Success")

        Else

            Response.Write("R/3 Connection Failed")

            Response.End()

        End If
 

        Response.Write("<br>")
 

        FunctionCtrl.Connection = LogonConn
 

        Dim ZFMD_FB01_BAPI, T_I_DTL, T_E_MSG, E_TOT, E_FTOT, E_SUBRC, I_NODATA As Object
 

        ZFMD_FB01_BAPI = FunctionCtrl.Add("ZFMD_FB01_BAPI")
 

        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

        ' Assign Table, Import, and Export properties to collection                    '

        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

        T_I_DTL = ZFMD_FB01_BAPI.Tables("T_I_DTL")

        T_E_MSG = ZFMD_FB01_BAPI.Tables("T_E_MSG")
 

        I_NODATA = ZFMD_FB01_BAPI.Exports("I_NODATA")
 

        E_TOT = ZFMD_FB01_BAPI.Imports("E_TOT")

        E_FTOT = ZFMD_FB01_BAPI.Imports("E_FTOT")

        E_SUBRC = ZFMD_FB01_BAPI.Imports("E_SUBRC")
 

        I_NODATA.Value = "/"
 

        Dim objWeb, objTTFix As Object
 

        transactiontype = Request.QueryString("transactiontype")

        acctmonth = Request.QueryString("acctmonth")

        acctyear = Request.QueryString("acctyear")

        batchno = Request.QueryString("batchno")
 
 
 

        conn = New MySqlConnection(ConfigurationManager.AppSettings("MyConnectionString"))

        conn.Open()

        strSql = "Select * from invoiceheaderfile where AccountingDateYear='" & acctyear & "' and AccountingDateMonth='" & acctmonth & "' and SourceCode='1' and BatchNumber='" & batchno & "'"

        cmd = New MySqlCommand(strSql, conn)

        da = New MySqlDataAdapter(cmd)

        ds = New DataSet()

        da.Fill(ds)
 

        'PostingDate = Date.Now.Month & "/" & Date.Now.Day & "/" & Date.Now.Year

        Row = 0

        For i = 0 To ds.Tables(0).Rows.Count - 1

            AISRC = ds.Tables(0).Rows(i)("SourceCode")

            AISTAT = ds.Tables(0).Rows(i)("RcdStatus")

            If (AISRC = "1" And AISTAT <> "P") Then

                klBloc = ds.Tables(0).Rows(i)("location")

                klBinv = ds.Tables(0).Rows(i)("VoucherInvoiceNo") '?????? VoucherInvoiceNo or VendorInvoiceNo?????Mark
 

                ' Get Company Number

                strSql6 = "Select * from truckticketdetail where InvoiceNumber='" & ds.Tables(0).Rows(i)("VendorInvoiceNo") & "'"

                cmd = New MySqlCommand(strSql6, conn)

                da = New MySqlDataAdapter(cmd)

                ds6 = New DataSet()

                da.Fill(ds6)

                Try

                    CompNum = ds6.Tables(0).Rows(0)("CostCompany")

                Catch ex As Exception

                    CompNum = 0

                End Try
 

                If klBloc.ToString.Contains("") = False Then

                    strSql3 = "Select * from apdetaillines where AccountingYear=" & acctyear & " and AccountingMonth=" & acctmonth & " and SourceCode=1 and BatchNo=" & batchno & " and Location='" & klBloc & "' and InvoiceNo=" & klBinv

                Else

                    strSql3 = "Select * from apdetaillines where AccountingYear=" & acctyear & " and AccountingMonth=" & acctmonth & " and SourceCode=1 and BatchNo=" & batchno & " and InvoiceNo=" & klBinv

                End If

                cmd = New MySqlCommand(strSql3, conn)

                da = New MySqlDataAdapter(cmd)

                ds3 = New DataSet()

                da.Fill(ds3)
 

                HeaderFlag = "X"

                DocDate = Format(ds.Tables(0).Rows(i)("InvoiceDateMonth"), "00") & "/" & Format(ds.Tables(0).Rows(i)("InvoiceDateDay"), "00") & "/" & ds.Tables(0).Rows(i)("InvoiceDateYear")

                PostDate = Format(Date.Now.Month, "00") & "/" & Format(Date.Now.Day, "00") & "/" & Date.Now.Year

                DocType = "Z3"

                PerNum = "/"

                CurrDesc = "USD"

                InvNum = ds.Tables(0).Rows(i)("VendorInvoiceNo")

                HeaderText = "Truck Tickets"

                PostingKey = "/"

                AccountNum = "/"

                SpecialLedger = "/"

                transactiontype = "/"

                CustNum = "/"

                VendNum = "/"

                Amount = "0000000000000"

                CostCenter = "/"

                ProfitCenter = "/"

                ValueDate = "/"

                PayTerm = "0001"

                BaselineDate = "/"

                AssignNum = "/"

                ItemText = "/"

                CreditControl = "/"

                DiscountAmount = "0000000000000"

                PayBlock = "/"

                PayMethod = "/"

                WHTaxAmount = "0000000000000"

                SpecialGL = "/"

                HouseBank = "/"

                CalcTaxFlag = "/"

                TaxCode = "/"

                Jurisdiction = "/"

                WithholdTaxCode = "/"

                InternalOrdNum = "/"

                PlanningLevel = "/"

                TradingPartner = "/"

                SuccessFlag = "/"

                PostDocNum = "/"

                '/* Header Flag  *'/

                _cell(Row, 1) = HeaderFlag
 

                '/* Doc Date  *'/

                _cell(Row, 2) = DocDate
 

                '/* Post Date *'/

                _cell(Row, 3) = PostDate
 

                '/* Doc Type  *'/

                _cell(Row, 4) = DocType
 

                '/* CompNum *'/

                _cell(Row, 5) = CompNum
 

                '/* Period Num  *'/

                _cell(Row, 6) = PerNum
 

                '/* CurrDesc *'/

                _cell(Row, 7) = CurrDesc
 

                '/'/ InvNum                                

                _cell(Row, 8) = InvNum
 

                '/'/ Header Text                           

                _cell(Row, 9) = HeaderText
 

                '/'/ Posting Key                          

                _cell(Row, 10) = PostingKey
 

                '/'/ Account Number                       

                _cell(Row, 11) = AccountNum
 

                '/'/ Special Ledger                        

                _cell(Row, 12) = SpecialLedger
 

                '/'/ Transaction Type                     

                _cell(Row, 13) = transactiontype
 

                '/'/ Cust Num                              

                _cell(Row, 14) = CustNum
 

                '/'/ Vendor Num                           

                _cell(Row, 15) = VendNum
 

                '/'/ Amount                                

                _cell(Row, 16) = Amount
 

                '/'/ Cost Center                           

                _cell(Row, 17) = CostCenter
 

                '/'/ Profit Center                         

                _cell(Row, 18) = ProfitCenter
 

                '/'/ Value Date                            

                _cell(Row, 19) = ValueDate
 

                '/'/ Pay Terms                             

                _cell(Row, 20) = PayTerm
 

                '/'/ Baseline Date                         

                _cell(Row, 21) = BaselineDate
 

                '/'/ AssignNum                            

                _cell(Row, 22) = AssignNum
 

                '/'/ Item Text                              

                _cell(Row, 23) = ItemText
 

                '/'/ CreditControl                          

                _cell(Row, 24) = CreditControl
 

                '/'/ DiscountAmount                         

                _cell(Row, 25) = DiscountAmount
 

                '/'/ PayBlock                               

                _cell(Row, 26) = PayBlock
 

                '/'/ PayMethod                              

                _cell(Row, 27) = PayMethod
 

                '/'/ WHTaxAmount                            

                _cell(Row, 28) = WHTaxAmount
 

                '/'/ HouseBank                              

                _cell(Row, 29) = HouseBank
 

                '/'/ SpecialGL                            

                _cell(Row, 30) = SpecialGL
 

                '/'/ CalcTaxFlag                            

                _cell(Row, 31) = CalcTaxFlag
 

                '/'/ TaxCode                                

                _cell(Row, 32) = TaxCode
 

                '/'/ Jurisdiction                          

                _cell(Row, 33) = Jurisdiction
 

                '/'/ Withholding TaxCode                    

                _cell(Row, 34) = WithholdTaxCode
 

                '/'/ Internal Order Number                  

                _cell(Row, 35) = InternalOrdNum
 

                '/'/ Planning Level                         

                _cell(Row, 36) = PlanningLevel
 

                '/'/ Trading Partner                        

                _cell(Row, 37) = TradingPartner
 

                '/'/ SuccessFlag                            

                _cell(Row, 38) = SuccessFlag
 

                '/'/ PostDocNum                           

                _cell(Row, 39) = PostDocNum
 

                GetDetail()

                GetOffset()
 

                strSql2 = "Update invoiceheaderfile set RcdStatus='P' "

                cmd = New MySqlCommand(strSql2, conn)

                da = New MySqlDataAdapter(cmd)

                ds2 = New DataSet()

                da.Fill(ds2)

            End If

            Row = Row + 1

        Next
 

        Row = 0
 

        Response.Write("<table class=border1 width=4000 border>" & vbCr)
 

        Do Until Len(_cell(CInt(Row), 1)) = 0 And Len(_cell(CInt(Row), 10)) = 0

            T_I_DTL.AppendRow()

            T_I_DTL.Value(Row + 1, "HD_HEAD_X") = _cell(CInt(Row), 1)

            T_I_DTL.Value(Row + 1, "HD_DOCDAT") = _cell(CInt(Row), 2)

            T_I_DTL.Value(Row + 1, "HD_PSTDAT") = _cell(CInt(Row), 3)

            T_I_DTL.Value(Row + 1, "HD_DOCTYP") = _cell(CInt(Row), 4)

            T_I_DTL.Value(Row + 1, "HD_NACONO") = _cell(CInt(Row), 5)

            T_I_DTL.Value(Row + 1, "HD_PERIOD") = _cell(CInt(Row), 6)

            T_I_DTL.Value(Row + 1, "HD_CRRNCY") = _cell(CInt(Row), 7)

            T_I_DTL.Value(Row + 1, "HD_RFRNCE") = _cell(CInt(Row), 8)

            T_I_DTL.Value(Row + 1, "HD_HEADTX") = _cell(CInt(Row), 9)

            T_I_DTL.Value(Row + 1, "IT_PSTKEY") = _cell(CInt(Row), 10)

            T_I_DTL.Value(Row + 1, "IT_NAACCT") = _cell(CInt(Row), 11)

            T_I_DTL.Value(Row + 1, "IT_PSTLET") = _cell(CInt(Row), 12)

            T_I_DTL.Value(Row + 1, "IT_TRNSTY") = _cell(CInt(Row), 13)

            T_I_DTL.Value(Row + 1, "IT_CUSTNR") = _cell(CInt(Row), 14)

            T_I_DTL.Value(Row + 1, "IT_VENDNR") = _cell(CInt(Row), 15)

            T_I_DTL.Value(Row + 1, "IT_AMOUNT") = _cell(CInt(Row), 16)

            T_I_DTL.Value(Row + 1, "IT_COSTCT") = _cell(CInt(Row), 17)

            T_I_DTL.Value(Row + 1, "IT_PROFCT") = _cell(CInt(Row), 18)

            T_I_DTL.Value(Row + 1, "IT_VALDAT") = _cell(CInt(Row), 19)

            T_I_DTL.Value(Row + 1, "IT_PAYTRM") = _cell(CInt(Row), 20)

            T_I_DTL.Value(Row + 1, "IT_BASDAT") = _cell(CInt(Row), 21)

            T_I_DTL.Value(Row + 1, "IT_ASSGTX") = _cell(CInt(Row), 22)

            T_I_DTL.Value(Row + 1, "IT_FREETX") = _cell(CInt(Row), 23)

            T_I_DTL.Value(Row + 1, "IT_CRDCTL") = _cell(CInt(Row), 24)

            T_I_DTL.Value(Row + 1, "IT_DISCNT") = _cell(CInt(Row), 25)

            T_I_DTL.Value(Row + 1, "IT_PAYBLK") = _cell(CInt(Row), 26)

            T_I_DTL.Value(Row + 1, "IT_PAYMTH") = _cell(CInt(Row), 27)

            T_I_DTL.Value(Row + 1, "IT_TAXAMT") = _cell(CInt(Row), 28)

            T_I_DTL.Value(Row + 1, "IT_HSBANK") = _cell(CInt(Row), 29)

            T_I_DTL.Value(Row + 1, "IT_SPASSN") = _cell(CInt(Row), 30)

            T_I_DTL.Value(Row + 1, "IT_CALCTX") = _cell(CInt(Row), 31)

            T_I_DTL.Value(Row + 1, "IT_TAXCOD") = _cell(CInt(Row), 32)

            T_I_DTL.Value(Row + 1, "IT_JURCOD") = _cell(CInt(Row), 33)

            T_I_DTL.Value(Row + 1, "IT_WTAXCD") = _cell(CInt(Row), 34)

            T_I_DTL.Value(Row + 1, "IT_INTORD") = _cell(CInt(Row), 35)

            T_I_DTL.Value(Row + 1, "IT_PLNLEV") = _cell(CInt(Row), 36)

            T_I_DTL.Value(Row + 1, "IT_TRDPTR") = _cell(CInt(Row), 37)

            T_I_DTL.Value(Row + 1, "LG_SUCCFL") = _cell(CInt(Row), 38)

            T_I_DTL.Value(Row + 1, "LG_DOCUNR") = _cell(CInt(Row), 39)

            'If _cell(CInt(Row), 1) = "X" Then

            '    Response.Write("Record = ")

            'Else

            '    Response.Write("Line = ")

            'End If

            'Response.Write(_cell(CInt(Row), 1))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 2))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 3))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 4))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 5))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 6))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 7))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 8))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 9))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 10))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 1))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 11))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 12))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 13))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 14))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 15))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 16))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 17))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 18))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 19))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 20))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 21))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 22))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 23))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 24))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 25))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 26))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 27))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 28))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 29))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 30))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 31))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 32))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 33))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 34))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 35))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 36))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 37))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 38))

            'Response.Write(" ,")

            'Response.Write(_cell(CInt(Row), 39))

            'Response.Write("<BR>")
 

            'Row = CInt(Row) + 1

        Loop
 

        Response.Write("</table>" & vbCr)
 

        Response.Write("<br>" & vbCr)
 

        objTTFix = Nothing

        objWeb = Nothing
 

        ZFMD_FB01_BAPI.Call()
 

        Response.Write("<table class=border1>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=80>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=225>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=80>" & vbCr)

        Response.Write("<col width=80>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=50>" & vbCr)

        Response.Write("<col width=225>" & vbCr)
 

        Response.Write("<th title='SAP Message Type'>      MSGTY1</th>" & vbCr)

        Response.Write("<th title='Message Identification'>MSGID1</th>" & vbCr)

        Response.Write("<th title='Message Number'>        MSGNR1</th>" & vbCr)

        Response.Write("<th title='Message Variable 01'>   MSGV11</th>" & vbCr)

        Response.Write("<th title='Message Variable 02'>   MSGV21</th>" & vbCr)

        Response.Write("<th title='Message Variable 03'>   MSGV31</th>" & vbCr)

        Response.Write("<th title='Message Variable 04'>   MSGV41</th>" & vbCr)

        Response.Write("<th title='Text 255 Characters'>   MSGTX1</th>" & vbCr)

        Response.Write("<th title='SAP Message Type'>      MSGTY2</th>" & vbCr)

        Response.Write("<th title='Message Identification'>MSGID2</th>" & vbCr)

        Response.Write("<th title='Message Number'>        MSGNR2</th>" & vbCr)

        Response.Write("<th title='Message Variable 01'>   MSGV12</th>" & vbCr)

        Response.Write("<th title='Message Variable 02'>   MSGV22</th>" & vbCr)

        Response.Write("<th title='Message Variable 03'>   MSGV32</th>" & vbCr)

        Response.Write("<th title='Message Variable 04'>   MSGV42</th>" & vbCr)

        Response.Write("<th title='Text 255 Characters'>   MSGTX2</th>" & vbCr)
 

        Dim Counter
 

        For Counter = 1 To T_E_MSG.RowCount

            Response.Write("<tr>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGTY1") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGID1") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGNR1") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV11") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV21") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV31") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV41") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGTX1") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGTY2") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGID2") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGNR2") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV12") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV22") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV32") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGV42") & "</td>" & vbCr)

            Response.Write("<td>" & T_E_MSG.Cell(Counter, "MSGTX2") & "</td>" & vbCr)

            Response.Write("</tr>" & vbCr)

        Next
 

        Response.Write("</table>")
 

        LogonConn.Logoff()
 
 

    End Sub

    Private Sub GetOffset()

        Dim CompNum As Integer
 

        CompNum = ds6.Tables(0).Rows(0)("CostCompany")
 

        Dim GenNumber As Integer

        HeaderFlag = "/"

        DocDate = "/"

        PostDate = "/"

        DocType = "/"

        PerNum = "/"

        CurrDesc = "/"

        InvNum = "/"

        HeaderText = "/"

        PostingKey = "31"

        AccountNum = "/"

        GenNumber = ds.Tables(0).Rows(i)("OffsetAccountNo")

        SpecialLedger = "/"

        transactiontype = "/"

        CustNum = "/"

        strSql5 = "Select NewVendorNumber from mslnamev where CompanyNumber=" & ds.Tables(0).Rows(i)("CompanyNumber") & " and NANumber=" & ds.Tables(0).Rows(i)("VendorNumber")

        cmd = New MySqlCommand(strSql5, conn)

        da = New MySqlDataAdapter(cmd)

        ds5 = New DataSet()

        da.Fill(ds5)

        Try

            VendNum = ds5.Tables(0).Rows(0)("NewVendorNumber")

        Catch ex As Exception

            VendNum = 0

        End Try
 

        Amount = ds.Tables(0).Rows(i)("GrossInvoiceAmount")

        CostCenter = "/"

        ProfitCenter = "/"

        ValueDate = "/"

        PayTerm = "0001"

        AssignNum = "/"

        ItemText = ds.Tables(0).Rows(i)("InvoiceDescription")

        CreditControl = "/"

        DiscountAmount = "0000000000000"

        PayBlock = "/"

        PayMethod = "/"

        '   PayMethod       = "C" 

        WHTaxAmount = "0000000000000"

        SpecialGL = "/"

        HouseBank = "/"

        CalcTaxFlag = "/"

        TaxCode = "/"

        Jurisdiction = "/"

        WithholdTaxCode = "/"

        InternalOrdNum = "/"

        PlanningLevel = "/"

        TradingPartner = "/"

        SuccessFlag = "/"

        PostDocNum = "/"
 

        Row = Row + 1
 

        '/'/ Header Flag                            '/'/

        _cell(Row, 1) = HeaderFlag
 

        '/'/ Doc Date                               '/'/

        _cell(Row, 2) = DocDate
 

        '/'/ Post Date                              '/'/

        _cell(Row, 3) = PostDate
 

        '/'/ Doc Type                               '/'/

        _cell(Row, 4) = DocType
 

        '/'/ CompNum                                '/'/

        _cell(Row, 5) = CompNum
 

        '/'/ Period Num                             '/'/

        _cell(Row, 6) = PerNum
 

        '/'/ CurrDesc                               '/'/

        _cell(Row, 7) = CurrDesc
 

        '/'/ InvNum                                 '/'/

        _cell(Row, 8) = InvNum
 

        '/'/ Header Text                            '/'/

        _cell(Row, 9) = HeaderText
 

        '/'/ Posting Key                            '/'/

        _cell(Row, 10) = PostingKey
 

        '/'/ Account Number                         '/'/

        _cell(Row, 11) = AccountNum
 

        '/'/ Special Ledger                         '/'/

        _cell(Row, 12) = SpecialLedger
 

        '/'/ Transaction Type                       '/'/

        _cell(Row, 13) = transactiontype
 

        '/'/ Cust Num                               '/'/

        _cell(Row, 14) = CustNum
 

        '/'/ Vendor Num                             '/'/

        _cell(Row, 15) = VendNum
 

        '/'/ Amount                                 '/'/

        _cell(Row, 16) = Amount
 

        '/'/ Cost Center                            '/'/

        _cell(Row, 17) = CostCenter
 

        '/'/ Profit Center                          '/'/

        _cell(Row, 18) = ProfitCenter
 

        '/'/ Value Date                             '/'/

        _cell(Row, 19) = ValueDate
 

        '/'/ Pay Terms                              '/'/

        _cell(Row, 20) = PayTerm
 

        '/'/ Baseline Date                          '/'/

        _cell(Row, 21) = BaselineDate
 

        '/'/ AssignNum                              '/'/

        _cell(Row, 22) = AssignNum
 

        '/'/ Item Text                              '/'/

        _cell(Row, 23) = ItemText
 

        '/'/ CreditControl                          '/'/

        _cell(Row, 24) = CreditControl
 

        '/'/ DiscountAmount                         '/'/

        _cell(Row, 25) = DiscountAmount
 

        '/'/ PayBlock                               '/'/

        _cell(Row, 26) = PayBlock
 

        '/'/ PayMethod                              '/'/

        _cell(Row, 27) = PayMethod
 

        '/'/ WHTaxAmount                            '/'/

        _cell(Row, 28) = WHTaxAmount
 

        '/'/ HouseBank                              '/'/

        _cell(Row, 29) = HouseBank
 

        '/'/ SpecialGL                             '/'/

        _cell(Row, 30) = SpecialGL
 

        '/'/ CalcTaxFlag                            '/'/

        _cell(Row, 31) = CalcTaxFlag
 

        '/'/ TaxCode                                '/'/

        _cell(Row, 32) = TaxCode
 

        '/'/ Jurisdiction                           '/'/

        _cell(Row, 33) = Jurisdiction
 

        '/'/ Withholding TaxCode                    '/'/

        _cell(Row, 34) = WithholdTaxCode
 

        '/'/ Internal Order Number                  '/'/

        _cell(Row, 35) = InternalOrdNum
 

        '/'/ Planning Level                         '/'/

        _cell(Row, 36) = PlanningLevel
 

        '/'/ Trading Partner                        '/'/

        _cell(Row, 37) = TradingPartner
 

        '/'/ SuccessFlag                            '/'/

        _cell(Row, 38) = SuccessFlag
 

        '/'/ PostDocNum                             '/'/

        _cell(Row, 39) = PostDocNum
 

    End Sub

    Private Sub GetDetail()

        Dim count As Integer

        Dim CompNum As String

        Dim GenNumber, SubNumber As String

        HeaderFlag = "/"

        DocDate = "/"

        PostDate = "/"

        DocType = "/"

        CompNum = "/"

        PerNum = "/"

        CurrDesc = "/"

        InvNum = "/"

        HeaderText = "/"

        PostingKey = "40"

        GenNumber = ds3.Tables(0).Rows(0)("InvoiceLineAcctNoGen")

        SubNumber = ds3.Tables(0).Rows(0)("InvoiceLineAcctNoSub")

        AccountNum = GenNumber & SubNumber

        SpecialLedger = "/"

        transactiontype = "/"

        CustNum = "/"

        VendNum = "/"

        Amount = ds3.Tables(0).Rows(0)("LineGrossAmount")

        CostCenter = " "

        If (GenNumber >= "001" And GenNumber <= "299") Then

            strSql4 = "Select YCOSTC from glp0022w where XCONO=" & ds6.Tables(0).Rows(0)("CostCompany") & " AND XDIV=" & ds6.Tables(0).Rows(0)("CostDivision")

        End If

        If (GenNumber >= "300" And GenNumber <= "499") Then

            strSql4 = "Select YCOSTC from glp0022x where XCONO=" & ds6.Tables(0).Rows(0)("CostCompany") & " AND XDIV=" & ds6.Tables(0).Rows(0)("CostDivision")

        End If

        If (GenNumber >= "500" And GenNumber <= "999") Then

            strSql4 = "Select YCOSTC from glp0022y where XCONO=" & ds6.Tables(0).Rows(0)("CostCompany") & " AND XDIV=" & ds6.Tables(0).Rows(0)("CostDivision")

        End If

        If strSql4 <> "" Then

            cmd = New MySqlCommand(strSql4, conn)

            da = New MySqlDataAdapter(cmd)

            ds4 = New DataSet()

            da.Fill(ds4)

            count = ds4.Tables.Count

            If count = 1 Then

                CostCenter = ds4.Tables(0).Rows(0)("YCOSTC")

            Else

                strSql4 = ""

                ds4 = Nothing

                strSql4 = "Select YCOSTC from glp0022y where XCONO=" & ds6.Tables(0).Rows(0)("CostCompany") & " AND XDIV=" & ds6.Tables(0).Rows(i)("CostDivision") & " AND XDEPT=" & ds.Tables(0).Rows(i)("CostDepartment")

                cmd = New MySqlCommand(strSql4, conn)

                da = New MySqlDataAdapter(cmd)

                ds4 = New DataSet()

                da.Fill(ds4)

                CostCenter = ds4.Tables(0).Rows(0)("YCOSTC")

            End If

        End If

            ProfitCenter = "/"

            ValueDate = "/"

            PayTerm = "0001"

            BaselineDate = "/"

            AssignNum = "/"

        ItemText = ds3.Tables(0).Rows(0)("LineDesc")

            CreditControl = "/"

            DiscountAmount = "0000000000000"

            PayBlock = "/"

            PayMethod = "/"

            WHTaxAmount = "0000000000000"

            SpecialGL = "/"

            HouseBank = "/"

            CalcTaxFlag = "/"

            TaxCode = "/"

            Jurisdiction = "/"

            WithholdTaxCode = "/"

            InternalOrdNum = "/"

            PlanningLevel = "/"

            TradingPartner = "/"

            SuccessFlag = "/"

            PostDocNum = "/"
 

            Row = Row + 1
 

            '/******************************************'/

            '/'/ Header Flag                            '/'/

            '/******************************************'/

            _cell(Row, 1) = HeaderFlag
 

            '/******************************************'/

            '/'/ Doc Date                               '/'/

            '/******************************************'/

            _cell(Row, 2) = DocDate
 

            '/******************************************'/

            '/'/ Post Date                              '/'/

            '/******************************************'/

            _cell(Row, 3) = PostDate
 

            '/******************************************'/

            '/'/ Doc Type                               '/'/

            '/******************************************'/

            _cell(Row, 4) = DocType
 

            '/******************************************'/

            '/'/ CompNum                                '/'/

            '/******************************************'/

            _cell(Row, 5) = CompNum
 

            '/******************************************'/

            '/'/ Perjod Num                             '/'/

            '/******************************************'/

            _cell(Row, 6) = PerNum
 

            '/******************************************'/

            '/'/ CurrDesc                               '/'/

            '/******************************************'/

            _cell(Row, 7) = CurrDesc
 

            '/******************************************'/

            '/'/ jnvNum                                 '/'/

            '/******************************************'/

            _cell(Row, 8) = InvNum
 

            '/******************************************'/

            '/'/ Header Text                            '/'/

            '/******************************************'/

            _cell(Row, 9) = HeaderText
 

            '/******************************************'/

            '/'/ Postjng Key                            '/'/

            '/******************************************'/

            _cell(Row, 10) = PostingKey
 

            '/******************************************'/

            '/'/ Account Number                         '/'/

            '/******************************************'/

            _cell(Row, 11) = AccountNum
 

            '/******************************************'/

            '/'/ Specjal Ledger                         '/'/

            '/******************************************'/

            _cell(Row, 12) = SpecialLedger
 

            '/******************************************'/

            '/'/ Transactjon Type                               '/'/

            '/******************************************'/

            _cell(Row, 13) = transactiontype
 

            '/******************************************'/

            '/'/ Cust Num                               '/'/

            '/******************************************'/

            _cell(Row, 14) = CustNum
 

            '/******************************************'/

            '/'/ Vendor Num                             '/'/

            '/******************************************'/

            _cell(Row, 15) = VendNum
 

            '/******************************************'/

            '/'/ Amount                                 '/'/

            '/******************************************'/

            _cell(Row, 16) = Amount
 

            '/******************************************'/

            '/'/ Cost Center                            '/'/

            '/******************************************'/

            _cell(Row, 17) = CostCenter
 

            '/******************************************'/

            '/'/ Profjt Center                          '/'/

            '/******************************************'/

            _cell(Row, 18) = ProfitCenter
 

            '/******************************************'/

            '/'/ Value Date                             '/'/

            '/******************************************'/

            _cell(Row, 19) = ValueDate
 
 
 

            '/******************************************'/

            '/'/ Pay Terms                              '/'/

            '/******************************************'/

            _cell(Row, 20) = PayTerm
 

            '/******************************************'/

            '/'/ Baseljne Date                          '/'/

            '/******************************************'/

            _cell(Row, 21) = BaselineDate
 

            '/******************************************'/

            '/'/ AssjgnNum                              '/'/

            '/******************************************'/

            _cell(Row, 22) = AssignNum
 

            '/******************************************'/

            '/'/ jtem Text                              '/'/

            '/******************************************'/

            _cell(Row, 23) = ItemText
 

            '/******************************************'/

            '/'/ CredjtControl                          '/'/

            '/******************************************'/

            _cell(Row, 24) = CreditControl
 

            '/******************************************'/

            '/'/ DjscountAmount                         '/'/

            '/******************************************'/

            _cell(Row, 25) = DiscountAmount
 

            '/******************************************'/

            '/'/ PayBlock                               '/'/

            '/******************************************'/

            _cell(Row, 26) = PayBlock
 

            '/******************************************'/

            '/'/ PayMethod                              '/'/

            '/******************************************'/

            _cell(Row, 27) = PayMethod
 

            '/******************************************'/

            '/'/ WHTaxAmount                            '/'/

            '/******************************************'/

            _cell(Row, 28) = WHTaxAmount
 

            '/******************************************'/

            '/'/ HouseBank                              '/'/

            '/******************************************'/

            _cell(Row, 29) = HouseBank
 

            '/******************************************'/

            '/'/ SpecjalGL                             '/'/

            '/******************************************'/

            _cell(Row, 30) = SpecialGL
 

            '/******************************************'/

            '/'/ CalcTaxFlag                            '/'/

            '/******************************************'/

            _cell(Row, 31) = CalcTaxFlag
 

            '/******************************************'/

            '/'/ TaxCode                                '/'/

            '/******************************************'/

            _cell(Row, 32) = TaxCode
 

            '/******************************************'/

            '/'/ Jurjsdjctjon                           '/'/

            '/******************************************'/

            _cell(Row, 33) = Jurisdiction
 

            '/******************************************'/

            '/'/ Wjthholdjng TaxCode                    '/'/

            '/******************************************'/

            _cell(Row, 34) = WithholdTaxCode
 

            '/******************************************'/

            '/'/ jnternal Order Number                  '/'/

            '/******************************************'/

            _cell(Row, 35) = InternalOrdNum

        '/******************************************'/

        '/'/ Planning Level                         '/'/

        '/******************************************'/

        _cell(Row, 36) = PlanningLevel
 

            '/******************************************'/

            '/'/ Tradjng Partner                        '/'/

            '/******************************************'/

            _cell(Row, 37) = TradingPartner
 

            '/******************************************'/

            '/'/ SuccessFlag                            '/'/

            '/******************************************'/

            _cell(Row, 38) = SuccessFlag
 

            '/******************************************'/

            '/'/ PostDocNum                             '/'/

            '/******************************************'/

            _cell(Row, 39) = PostDocNum

    End Sub

    

End Class

Open in new window

0
Comment
Question by:bschave2
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:TechTiger007
Comment Utility
1. Have you installed the BAPI for SAP in your machine?
2. Is the control registered? If not register it using regsvr32 <file name>
0
 

Author Comment

by:bschave2
Comment Utility
how do I see if the control is registered?
0
 
LVL 13

Accepted Solution

by:
TechTiger007 earned 500 total points
Comment Utility
You can open Ole Object browser, it will display all the registered OLE components in your machine. Check if this control is displayed in the list.

Another way is click on add reference in visual studio and select COM tab, and check if the control is displayed there.

If you know the path of the control you can directly run regsvr32 <path> from command prompt and it will over write/create the entries in registry and make this component available for programming
0
 

Author Closing Comment

by:bschave2
Comment Utility
nothing helped. It was IIS. Thanks for the help though.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now