Excel

BAPI_ACC_DOCUMENT_POST Beispiel

Ease of Use

Intermediate

Version tested with

2012 VBA 7.1 

Submitted by:

DReichl

Description:

Kann mir jemand ein funktionierendes Beispiel für den Aufruf des BAPIs ich bekomme die Strukturen für den Import nicht geladen Can anyone help me to get the Right source vor using the BAPI in Excel 

Discussion:

Hallo zusammen, ich bekomme die Strukturen nicht in den Zugriff, so dass ich die Import-Tabellen füllen kann. Bin für jede Hilfe dankbar. Schön wäre ein Code, der schon im Einsatz ist. Danke für Eure Hilfe Hello everybody, I can't access the structures that I can fill the import tables. I'm grateful for any help. Nice would be a code that is already in use. Thank you for your help 

Code:

instructions for use

			

Sub PostDocument() Dim oFUBA As Object Dim oFUBA2 As Object Dim ofunctionCtrl As Object Dim oDOCUMENTHEADER As Object ' ist eine Struktur BAPIACHE09 Dim oCustomerCPD As Object ' ist eine Struktur BAPIACHE09 Dim oContractHeader As Object ' ist eine Struktur BAPIACCAHD Dim oCurrencyAmount As Object Dim oExtension1 As Object Dim oReturn As Object Dim oAccountGl As Object Dim oOBJ_TYPE As Object Dim oObj_Key As Object Dim oObj_Sys As Object Dim oACCOUNTRECEIVABLE As Object Dim oACCOUNTPAYABLE As Object Dim oACCOUNTTAX As Object Dim oACCOUNTWT As Object Dim oCONTRACTITEM As Object Dim oCRITERIA As Object Dim oExtension2 As Object Dim oPAYMENTCARD As Object Dim oREALESTATE As Object Dim oVALUEFIELD As Object ' Unnötige Deklarationen Dim i, x As Integer Dim strDataRow As String Dim DataRow As Variant Dim Col As Boolean Dim tblData As Object Dim tblData2 As Object Dim tblData3 As Object Dim oROWFields As Object Dim Zähler As Long Col = False Set ofunctionCtrl = CreateObject("SAP.Functions") Set oFUBA = ofunctionCtrl.Add("BAPI_ACC_DOCUMENT_POST") ' Header funktioniert nicht Imports ist leer es geht weder das Eine noch das Andere Set oDOCUMENTHEADER = oFUBA.Imports(1) '("BAPIACHE09") Set oDOCUMENTHEADER = oFUBA.Imports("BAPIACHE09") ' exporst ist leer Set oDOCUMENTHEADER = oFUBA.exports(1) Set oDOCUMENTHEADER = oFUBA.tables("DocumentHeader") ' die Tabellen werden gefunden Set oAccountGl = oFUBA.tables(1) 'Accountgl Set oACCOUNTPAYABLE = oFUBA.tables(2) 'AccountPayable Set oACCOUNTRECEIVABLE = oFUBA.tables(3) '"ACCOUNTRECEIVABLE" Set oACCOUNTTAX = oFUBA.tables(4) '"ACCOUNTTAX" Set oACCOUNTWT = oFUBA.tables(5) '"ACCOUNTWT" Set oCONTRACTITEM = oFUBA.tables(6) '"CONTRACTITEM" Set oCRITERIA = oFUBA.tables(7) '"CRITERIA" Set oCurrencyAmount = oFUBA.tables(8) '"CURRENCYAMOUNT" Set oExtension1 = oFUBA.tables(9) '"EXTENSION1" Set oExtension2 = oFUBA.tables(10) '"EXTENSION2" Set oPAYMENTCARD = oFUBA.tables(11) '"PAYMENTCARD" Set oREALESTATE = oFUBA.tables(12) '"REALESTATE" Set oReturn = oFUBA.tables(13) '"RETURN" Set oVALUEFIELD = oFUBA.tables(14) '"VALUEFIELD" 'Set oDOCUMENTHEADER = oFUBA.exports(1) 'Set oDOCUMENTHEADER = oFUBA.Imports(1) 'Set oDOCUMENTHEADER = oFUBA.Parent(1) ' die werden erkannt, die Felder und die Inhalte werden ausgegeben. oAccountGl.Rows.Add Debug.Print oAccountGl.ColumnCount Debug.Print oAccountGl.ColumnName(1) Debug.Print oAccountGl(1, 1) End Sub

How to use:

  1. I want to make an Excel Sheet with the Posting Values and fill the Bapi to post it.
 

Test the code:

 

Sample File:

No Attachment 

Approved by Jacob Hilderbrand


This entry has been viewed 5 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express