<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic BAPI VB, Column values mismatching in Table Parameter and Database value in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-vb-column-values-mismatching-in-table-parameter-and-database-value/m-p/3067547#M726977</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to call a BAPI ZBAPI_EMP_INS_TBL, in which I pass a Table parameter with 2 columns and 2 rows.&lt;/P&gt;&lt;P&gt;The column names are EMPID and DOJ which are of Char (8) and Dats data type.&lt;/P&gt;&lt;P&gt;In my BAPI, I loop through the table which has been passed as a parameter and insert data into the Z-table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that my program runs without error and insert data in the corresponding Z-table. But the column values are different in Z-table and the ones passed from VB.&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;For e.g. If I pass 12345678 as EMPID, In Database the value comes as 45678200.&lt;BR /&gt;Similarly for the DOJ field the value comes as &amp;#147;7 - -7112&amp;#148;.&lt;/P&gt;&lt;BR /&gt;Is there any check or methods to be called while passing a Table parameter?&lt;BR /&gt;Because if I call another BAPI to insert single record and the BAPI takes 2 parameters i.e. EMPID and DOJ, the program works fine.&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;&lt;P&gt;Are there any checks to be made while passing the Table parameter?&lt;BR /&gt;Once I call the code from VB, is it possible to debug the code from ABAP side?&lt;/P&gt;&lt;/B&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikas&lt;/P&gt;&lt;P&gt;Vikas.sreedharan@gmail.com&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
BAPI ZBAPI_EMP_INS_TBL
data:
  wa_emp type z_emp_dtls,
loop at tbl_emp into wa_emp. "tbl_emp is passed from VB code as a table
insert into z_emp_dtls values wa_emp.
clear wa_emp.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VB code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Public Sub InsTable()
Dim obSapFn As Object
Dim obEmp As Object, obTblEmp As Object
Set obSapFn = CreateObject("SAP.Functions")

obSapFn.Connection.ApplicationServer = CNT_STR_APPLN_SRVR
obSapFn.Connection.SystemNumber = CNT_STR_SYS_NUM
obSapFn.Connection.User = CNT_STR_USR
obSapFn.Connection.Password = CNT_STR_PWD
obSapFn.Connection.Language = CNT_STR_LOGON_LANG
obSapFn.Connection.Client = CNT_STR_CLIENT
obSapFn.LogLevel = CNT_INT_LOG_LEVEL
obSapFn.LogFileName = CNT_STR_LOG_FILE

If obSapFn.Connection.Logon(0, True) = False Then
    MsgBox "R/3 connection failed"
    Exit Sub
End If

Set obEmp = obSapFn.Add("ZBAPI_EMP_INS_TBL")
Set obTblEmp = obEmp.Tables("TBL_EMP") &amp;#145;Table Parameter to be passed
obTblEmp.FreeTable
&amp;#145;Add rows to the table which is to be passed
obTblEmp.Rows.Add
obTblEmp.Value(obTblEmp.RowCount, "EMPID") = CStr("K1009008")
obTblEmp.Value(obTblEmp.RowCount, "DOJ") = Now

obTblEmp.Rows.Add
obTblEmp.Value(obTblEmp.RowCount, "EMPID") = CStr("M2009008")
obTblEmp.Value(obTblEmp.RowCount, "DOJ") = Now + 1
&amp;#145; Below section is to check the data types .
Dim oColumn As Object
For Each oColumn In obTblEmp.Columns
    'MsgBox oColumn.Name &amp;amp; "," &amp;amp; oColumn.TypeName
Next oColumn
&amp;#145; End

&amp;#145;Verify the data before calling Fn.
Dim iCount As Integer, iLoop As Integer
iCount = obTblEmp.RowCount
For iLoop = 1 To iCount
    'MsgBox obTblEmp(iLoop, "EMPID") &amp;amp; " , " &amp;amp; obTblEmp(iLoop, "DOJ")
Next

If obEmp.Call = False Then
    MsgBox "Error in calling fn "
End If

Set obTblEmp = Nothing
Set obEmp = Nothing
obSapFn.Connection.LogOff
Set obSapFn = Nothing
End Sub
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Nov 2007 10:59:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-27T10:59:27Z</dc:date>
    <item>
      <title>BAPI VB, Column values mismatching in Table Parameter and Database value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-vb-column-values-mismatching-in-table-parameter-and-database-value/m-p/3067547#M726977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to call a BAPI ZBAPI_EMP_INS_TBL, in which I pass a Table parameter with 2 columns and 2 rows.&lt;/P&gt;&lt;P&gt;The column names are EMPID and DOJ which are of Char (8) and Dats data type.&lt;/P&gt;&lt;P&gt;In my BAPI, I loop through the table which has been passed as a parameter and insert data into the Z-table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that my program runs without error and insert data in the corresponding Z-table. But the column values are different in Z-table and the ones passed from VB.&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;For e.g. If I pass 12345678 as EMPID, In Database the value comes as 45678200.&lt;BR /&gt;Similarly for the DOJ field the value comes as &amp;#147;7 - -7112&amp;#148;.&lt;/P&gt;&lt;BR /&gt;Is there any check or methods to be called while passing a Table parameter?&lt;BR /&gt;Because if I call another BAPI to insert single record and the BAPI takes 2 parameters i.e. EMPID and DOJ, the program works fine.&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;&lt;P&gt;Are there any checks to be made while passing the Table parameter?&lt;BR /&gt;Once I call the code from VB, is it possible to debug the code from ABAP side?&lt;/P&gt;&lt;/B&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikas&lt;/P&gt;&lt;P&gt;Vikas.sreedharan@gmail.com&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
BAPI ZBAPI_EMP_INS_TBL
data:
  wa_emp type z_emp_dtls,
loop at tbl_emp into wa_emp. "tbl_emp is passed from VB code as a table
insert into z_emp_dtls values wa_emp.
clear wa_emp.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VB code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Public Sub InsTable()
Dim obSapFn As Object
Dim obEmp As Object, obTblEmp As Object
Set obSapFn = CreateObject("SAP.Functions")

obSapFn.Connection.ApplicationServer = CNT_STR_APPLN_SRVR
obSapFn.Connection.SystemNumber = CNT_STR_SYS_NUM
obSapFn.Connection.User = CNT_STR_USR
obSapFn.Connection.Password = CNT_STR_PWD
obSapFn.Connection.Language = CNT_STR_LOGON_LANG
obSapFn.Connection.Client = CNT_STR_CLIENT
obSapFn.LogLevel = CNT_INT_LOG_LEVEL
obSapFn.LogFileName = CNT_STR_LOG_FILE

If obSapFn.Connection.Logon(0, True) = False Then
    MsgBox "R/3 connection failed"
    Exit Sub
End If

Set obEmp = obSapFn.Add("ZBAPI_EMP_INS_TBL")
Set obTblEmp = obEmp.Tables("TBL_EMP") &amp;#145;Table Parameter to be passed
obTblEmp.FreeTable
&amp;#145;Add rows to the table which is to be passed
obTblEmp.Rows.Add
obTblEmp.Value(obTblEmp.RowCount, "EMPID") = CStr("K1009008")
obTblEmp.Value(obTblEmp.RowCount, "DOJ") = Now

obTblEmp.Rows.Add
obTblEmp.Value(obTblEmp.RowCount, "EMPID") = CStr("M2009008")
obTblEmp.Value(obTblEmp.RowCount, "DOJ") = Now + 1
&amp;#145; Below section is to check the data types .
Dim oColumn As Object
For Each oColumn In obTblEmp.Columns
    'MsgBox oColumn.Name &amp;amp; "," &amp;amp; oColumn.TypeName
Next oColumn
&amp;#145; End

&amp;#145;Verify the data before calling Fn.
Dim iCount As Integer, iLoop As Integer
iCount = obTblEmp.RowCount
For iLoop = 1 To iCount
    'MsgBox obTblEmp(iLoop, "EMPID") &amp;amp; " , " &amp;amp; obTblEmp(iLoop, "DOJ")
Next

If obEmp.Call = False Then
    MsgBox "Error in calling fn "
End If

Set obTblEmp = Nothing
Set obEmp = Nothing
obSapFn.Connection.LogOff
Set obSapFn = Nothing
End Sub
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2007 10:59:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-vb-column-values-mismatching-in-table-parameter-and-database-value/m-p/3067547#M726977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-27T10:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI VB, Column values mismatching in Table Parameter and Database value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-vb-column-values-mismatching-in-table-parameter-and-database-value/m-p/3067548#M726978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The error was occuring because of primary keys which I had added to table.&lt;/P&gt;&lt;P&gt;Once I recreated the table. It was working fine.&lt;/P&gt;&lt;P&gt;THe first 3 chars of empid was getting transfered to the mandt column.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2007 05:40:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-vb-column-values-mismatching-in-table-parameter-and-database-value/m-p/3067548#M726978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-28T05:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI VB, Column values mismatching in Table Parameter and Database value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-vb-column-values-mismatching-in-table-parameter-and-database-value/m-p/3067549#M726979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just found out a way to debug ABAP code from VB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the connection properties add the following code&lt;/P&gt;&lt;P&gt;AbapDebug = True&lt;/P&gt;&lt;P&gt;Tracelevel = 9&lt;/P&gt;&lt;P&gt;RfcWithDialog = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will call the ABAP debugger, so this can be used for debugging SAP code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vikas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2007 10:30:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-vb-column-values-mismatching-in-table-parameter-and-database-value/m-p/3067549#M726979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-29T10:30:48Z</dc:date>
    </item>
  </channel>
</rss>

