<?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 Re: VBA BAPI_MATERIAL_GET_ALL, get in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322831#M1991230</link>
    <description>&lt;P&gt;Hi Ivan,&lt;/P&gt;&lt;P&gt;SHELF_LIFE and MINREMLIFE are DEC (Decimal) types in SAP. If you are using VBA data type Object for the variables and getting the error. I would recommend using another data types -for example Decimal-.&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/data-types/" target="_blank"&gt;Data Type Summary (Visual Basic)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Tuncay&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2021 02:13:13 GMT</pubDate>
    <dc:creator>TuncayKaraca</dc:creator>
    <dc:date>2021-02-17T02:13:13Z</dc:date>
    <item>
      <title>VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322828#M1991227</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;
  &lt;P&gt;I need to run the procedure of the function module BAPI_MATERIAL_GET_ALL from VBA (Visual Basic Application).&lt;/P&gt;
  &lt;P&gt;My code works successfully, I get data.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;    Dim SapConnection As Object
    
    Dim objSAPReadTable As Object
    
    Set SapConnection = CreateObject("SAP.Functions.Unicode")


    SapConnection.Connection.ApplicationServer = "My server"
    SapConnection.Connection.System = "My System"
    SapConnection.Connection.Client = "My client"
    SapConnection.Connection.User = ""
    SapConnection.Connection.Password = ""
    SapConnection.Connection.Language = "EN"
    SapConnection.Connection.SystemNumber = "My SystemNumber"
    
    If SapConnection.Connection.Logon(0, False) &amp;lt;&amp;gt; True Then
        MsgBox "Error! Logon!"
    End If
    


    If SapConnection.Connection.IsConnected = 1 Then


        Set objSAPReadTable = SapConnection.Add("BAPI_MATERIAL_GET_ALL")
                
        Dim MT As Object
        Dim CompCode As Object
        Dim DataFromSap As Object


        Set MT = objSAPReadTable.Exports("MATERIAL")
        Set CompCode = objSAPReadTable.Exports("COMP_CODE")
        Set DataFromSap = objSAPReadTable.Imports("CLIENTDATA")


        MT.Value = "My material"
        CompCode.Value = "My company code"


        Result = objSAPReadTable.CALL
        
		' Get data 
		' DataFromSap("MATERIAL")
		' DataFromSap("MATL_TYPE")
		' DataFromSap("LAST_CHNGE")
        
        
    End If
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I get the string data and date type successfully.&lt;/P&gt;
  &lt;P&gt;The problem is that I cannot get the fields of the structure with data type "packed bcd", for example "SHELF_LIFE", "MINREMLIFE" and other.&lt;/P&gt;
  &lt;P&gt;Thank you all for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 09:04:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322828#M1991227</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-02-16T09:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322829#M1991228</link>
      <description>&lt;P&gt;Welcome and thanks for visiting SAP Community to get answers to your questions. Check out our tutorial to get started in SAP Community: &lt;A href="https://developers.sap.com/tutorials/community-start.html" target="test_blank"&gt;https://developers.sap.com/tutorials/community-start.html&lt;/A&gt;
By adding a picture to your profile you encourage readers to respond: &lt;A href="https://www.youtube.com/watch?v=46bt1juWUUM" target="test_blank"&gt;https://www.youtube.com/watch?v=46bt1juWUUM&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 09:19:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322829#M1991228</guid>
      <dc:creator>KatiNonhebel</dc:creator>
      <dc:date>2021-02-16T09:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322830#M1991229</link>
      <description>&lt;P&gt;"SHELF_LIFE" and "MINREMLIFE" of parameter "CLIENTDATA"&lt;/P&gt;&lt;P&gt;Why can't you get them? What error do you have? What is your code?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 13:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322830#M1991229</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-02-16T13:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322831#M1991230</link>
      <description>&lt;P&gt;Hi Ivan,&lt;/P&gt;&lt;P&gt;SHELF_LIFE and MINREMLIFE are DEC (Decimal) types in SAP. If you are using VBA data type Object for the variables and getting the error. I would recommend using another data types -for example Decimal-.&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/data-types/" target="_blank"&gt;Data Type Summary (Visual Basic)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Tuncay&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 02:13:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322831#M1991230</guid>
      <dc:creator>TuncayKaraca</dc:creator>
      <dc:date>2021-02-17T02:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322832#M1991231</link>
      <description>&lt;P&gt;Sandra Rossi! &lt;/P&gt;&lt;P&gt;I know that these parameters refer to CLIENTDATA! My code I provided in the question.&lt;/P&gt;&lt;P&gt;I get these parameters like this &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DataFromSap("SHELF_LIFE")

DataFromSap("MINREMLIFE")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As a result, I get empty strings.&lt;/P&gt;&lt;P&gt;But, if I get parameter  MATERIAL: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DataFromSap("MATERIAL")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As a result, I get normal material number!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 10:18:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322832#M1991231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-02-17T10:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322833#M1991232</link>
      <description>&lt;P&gt;Ivan,&lt;/P&gt;&lt;P&gt;CLIENTDATA is an Export parameter in BAPI_MATERIAL_GET_ALL - on your coding it's import parameter. CLIENTDATA is a structure which means 1 record of like a table row. It could return 1 row data with many fields including "SHELF_LIFE", "MINREMLIFE".&lt;/P&gt;&lt;P&gt;So this seems correct.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Set DataFromSap = objSAPReadTable.Imports("CLIENTDATA")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;DataFromSap variable seems an Object type as table. Then it seems fields of DataFromSap should be accessible. &lt;/P&gt;&lt;P&gt;References:&lt;/P&gt;&lt;P&gt;&lt;A href="https://youtu.be/-gPcns40Nh4" target="_blank"&gt;SAP Function BAPI Scripting - Calling RFC FM from Excel&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.saplsmw.com/Import_tables_directly_into_Access_from_SAP_using_RFCs" target="_blank"&gt;Import tables directly into Access from SAP using RFCs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 22:36:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322833#M1991232</guid>
      <dc:creator>TuncayKaraca</dc:creator>
      <dc:date>2021-02-17T22:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322834#M1991233</link>
      <description>&lt;P&gt;Tuncay! Thank you so much. But how to do it?&lt;/P&gt;&lt;P&gt;I've tried&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Dim ShelfLife As Variant
ShelfLife = CDec(DataFromSap("SHELF_LIFE"))
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;result = &amp;lt;Type mismatch&amp;gt;&lt;/P&gt;&lt;P&gt;I think this is due to the fact that first the CLIENTDATA is converted to VBA Object&lt;/P&gt;&lt;P&gt;But I don't know how to get it bypassing the structure, I tried&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Dim ShelfLife As Variant
ShelfLife = CDec(objSAPFuncReadTable.Imports("CLIENTDATA\\SHELF_LIFE"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This does not work. =((((((&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 09:08:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322834#M1991233</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-02-18T09:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: VBA BAPI_MATERIAL_GET_ALL, get</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322835#M1991234</link>
      <description>&lt;P&gt;Ivan, &lt;/P&gt;&lt;P&gt;I had commented here yesterday but somehow it seems disappeared! &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Anyway,&lt;/P&gt;&lt;P&gt; Set DataFromSap = objSAPReadTable.Imports("CLIENTDATA")  &lt;/P&gt;&lt;P&gt;seems correct. CLIENTDATA is export parameter in the BAPI as structure type. The structure has fields names including "SHELF_LIFE" and "MINREMLIFE" and structures are like tables with one row entry. So your variable DataFromSap should be object and table like. Then DataFromSap variable/table might need to be read for required field. &lt;/P&gt;&lt;P&gt;References:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.abapforum.com/forum/viewtopic.php?f=18&amp;amp;t=23202&amp;amp;sid=1091c9626ac6eaaf369ac3f8708b427a" target="_blank"&gt;VBA &amp;amp; RFC_READ_TABLE mit GUI750 SP8&lt;/A&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://saplsmw.com/Import_tables_directly_into_Access_from_SAP_using_RFCs" target="_blank"&gt;Import tables directly into Access from SAP using RFCs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 17:14:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-bapi-material-get-all-get/m-p/12322835#M1991234</guid>
      <dc:creator>TuncayKaraca</dc:creator>
      <dc:date>2021-02-18T17:14:14Z</dc:date>
    </item>
  </channel>
</rss>

