cancel
Showing results for 
Search instead for 
Did you mean: 

posting to R3 Fi docs from excel spreadsheet using RFC Libraries

0 Kudos

Hello, I have a spreadsheet that worked fine posting in SAP GUI 7.3 and 7.4. but when I upgraded to 7.5 it stopped working due to the new RFC libraries. I could not connect at all. but with some help from the community I resolved this issue with code below:

Set R3 = CreateObject("SAP.Functions")
If R3.Connection.LOGON(0, False) <> True Then
MsgBox ("Cannot logon!")
Exit Sub
Else
Set Connection = R3.Connection
MsgBox "Connection complete"
End If

But Now at the end of processing my spreadsheet data I go to post the data in SAP and i get "RFC NOT FOUND" from code below:
result = ObjFunctions.Call
If result <> True Then
MsgBox (ObjFunctions.Exception)
R3.Connection.Logoff
Set Connection = Nothing
Exit Sub
End If

Am I not using the proper Call to the functions in rfc libraries with "result = ObjFunctions.Call" ? please help !!!

stefan_schnell
Active Contributor
0 Kudos

Hello Timothy,

welcome in the SAP Community.

The RFC_NOT_FOUND means that the function or structure definition is not found. Which function module do you use? Does your function module uses a structure? Please give us more details, so we can better help you.

Cheers
Stefan

Accepted Solutions (0)

Answers (6)

Answers (6)

0 Kudos

Thanks Stefan - I did not see that - code is attached in two pieces. I also was just notified that there is a patch no 7 for sap gui 7.50. I am going to download that and try it as well

0 Kudos
second section of code - to be attached to previous upload

' Changes 7/27/05
'        If i_cols = BPVKONTDataCol Then
'            If Cells(i_rows, i_cols).value = "" Then
'                BPVKONT = ""
'            Else
'                BPVKONT = Cells(i_rows, i_cols).value
'            End If
'        End If
' end of changes 7/27/05
        If i_cols = BPFSCDDataCol Then
                        
            If BPVKONT = False Then
                Call BDC(j, "", "", "", "FKKOP-VKONT", "")
                j = j + 1
                BDCTABLE.Rows.Add
            End If
                        
            Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLVLVZ                                2000DOP_APPL")
            j = j + 1
            BDCTABLE.Rows.Add
            GoTo end_i_cols
        End If
        
        If i_cols = BPGDataCol Then
            Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLZSCREEN                             0100DOP_CUST")
            j = j + 1
            BDCTABLE.Rows.Add
            GoTo end_i_cols
        End If
        
        If i_cols = GLCol Then
            Call BDC(j, "SAPLFKPP", "0302", "X", "", "")
            j = j + 1
            BDCTABLE.Rows.Add
                        
            If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then
                Call BDC(j, "", "", "", "BDC_OKCODE", "=COPA")
                j = j + 1
                BDCTABLE.Rows.Add
                GoTo end_i_cols
            End If
            
            If NoBP = True Or i_rows > BPItemDataERow Then
                If i_rows = ItemDataERow Then
                    Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA")
                    j = j + 1
                    BDCTABLE.Rows.Add
                Else
                    Call BDC(j, "", "", "", "BDC_OKCODE", "=IOPK")
                    j = j + 1
                    BDCTABLE.Rows.Add
                End If
            Else
                If i_rows = ItemDataERow Then
                    Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA")
                    j = j + 1
                    BDCTABLE.Rows.Add
                Else
                    Call BDC(j, "", "", "", "BDC_OKCODE", "=IOP")
                    j = j + 1
                    BDCTABLE.Rows.Add
                End If
            End If




            GoTo end_i_cols
        End If
        
        If i_cols = GLFSCDDataCol Then
            Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLVLVZ                                1000DOPK_APPL")
            j = j + 1
            BDCTABLE.Rows.Add
            GoTo end_i_cols
        End If
        
        If i_cols = GLGDataCol Then
            Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLZSCREEN                             0200DOPK_CUST")
            j = j + 1
            BDCTABLE.Rows.Add
            GoTo end_i_cols
        End If




        If i_cols = COPADataCol Then
            If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then
                Call BDC(j, "SAPLKEAK", "0300", "X", "", "")
                j = j + 1
                BDCTABLE.Rows.Add
            
                Call BDC(j, "", "", "", "BDC_OKCODE", "=P+")
                j = j + 1
                BDCTABLE.Rows.Add
            End If




            GoTo end_i_cols
        End If




        If i_cols = COPAP2Col Then
            If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then
                Call BDC(j, "SAPLKEAK", "0300", "X", "", "")
                j = j + 1
                BDCTABLE.Rows.Add
            
                Call BDC(j, "", "", "", "BDC_OKCODE", "=P+")
                j = j + 1
                BDCTABLE.Rows.Add
            End If




            GoTo end_i_cols
        End If




        If i_cols = COPAP3Col Then
            If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then
                Call BDC(j, "SAPLKEAK", "0300", "X", "", "")
                j = j + 1
                BDCTABLE.Rows.Add
            
                Call BDC(j, "", "", "", "BDC_OKCODE", "=WEIT")
                j = j + 1
                BDCTABLE.Rows.Add
            End If




            GoTo end_i_cols
        End If




        If i_cols > COPADataCol Then
            If Trim(Cells(i_rows, GLCol).Value) = ".LC" And _
               Trim(Cells(i_rows, i_cols).Value) <> "" Then
                Call BDC(j, "", "", "", Trim(Cells(HeaderDataRow, i_cols).Value), _
                                    Trim(Cells(i_rows, i_cols).Value))
                j = j + 1
                BDCTABLE.Rows.Add
            End If
            
            If i_cols = Endcol And Trim(Cells(i_rows, GLCol).Value) = ".LC" Then
                Call BDC(j, "SAPLFKPP", "0302", "X", "", "")
                j = j + 1
                BDCTABLE.Rows.Add
                
                If NoBP = True Or i_rows >= BPItemDataERow Then
                    If i_rows = ItemDataERow Then
                        Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA")
                        j = j + 1
                        BDCTABLE.Rows.Add
                    Else
                        Call BDC(j, "", "", "", "BDC_OKCODE", "=IOPK")
                        j = j + 1
                        BDCTABLE.Rows.Add
                    End If
                Else
                    If i_rows = ItemDataERow Then
                        Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA")
                        j = j + 1
                        BDCTABLE.Rows.Add
                    Else
                        Call BDC(j, "", "", "", "BDC_OKCODE", "=IOP")
                        j = j + 1
                        BDCTABLE.Rows.Add
                    End If
                End If
            
                Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLVLVZ                                1000DOPK_APPL")
                j = j + 1
                BDCTABLE.Rows.Add




                Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLZSCREEN                             0200DOPK_CUST")
                j = j + 1
                BDCTABLE.Rows.Add




            End If
            GoTo end_i_cols
        End If




' Start of new logic for OPTXT fields 05/24/06
        L_OPTXT = Trim(Cells(HeaderDataRow, i_cols).Value) Like "ZSCREENTXT*"
        If L_OPTXT = True Then
            Call BDC(j, "", "", "", Trim(Cells(HeaderDataRow, i_cols).Value), _
                                    Trim(Cells(i_rows, i_cols).Value))
            j = j + 1
            BDCTABLE.Rows.Add
            GoTo end_i_cols
        End If
        
        
' End of new logic for OPTXT fields 05/24/06
        
        If Trim(Cells(i_rows, i_cols).Value) <> "" Then
            Call BDC(j, "", "", "", Trim(Cells(HeaderDataRow, i_cols).Value), _
                                    Trim(Cells(i_rows, i_cols).Value))
            j = j + 1
            BDCTABLE.Rows.Add
        End If
    
end_i_cols:
    Next i_cols
    
    If i_rows >= BPItemDataERow Then StartCol = GLCol
    If i_rows >= GLItemDataERow Then Endcol = BPECol


Next


 Call BDC(j, "SAPLFKK_WORKFLOW", "0100", "X", "", "")
 j = j + 1
 BDCTABLE.Rows.Add
    
 Call BDC(j, "", "", "", "BDC_OKCODE", "=CONT")
 j = j + 1
 BDCTABLE.Rows.Add
 Call BDC(j, "", "", "", "FKK_DOCAPPR-END_MAIL", "X")
 j = j + 1
 BDCTABLE.Rows.Add
 Call BDC(j, "", "", "", "WA_COMMENT(01)", WFText)
Range("A1").Select
' Ok, now post in SAP -------------------------------
       ' result = ObjFunctions.Call
        
        
        result = objfunctions.Call
        If result <> True Then
            MsgBox (objfunctions.Exception)
            R3.Connection.Logoff
            Set Connection = Nothing
            Exit Sub
        End If
' Print messages here
Data_Sheet.Select
Range("A1").Select
               
X = 1
For n = 1 To j
    
    If BDCTABLE.cell(n, "TCODE") <> Empty Then
        'If BDCTABLE.cell(n, "RTCODE") <> "0" Then
            If Trim(BDCTABLE.cell(n, "MSGID")) = "CH" And _
               Trim(BDCTABLE.cell(n, "MSGNO")) = "004" Then
               
               Ret_Message = ""
            End If
            
            If Trim(BDCTABLE.cell(n, "MSGID")) = "00" And _
                Trim(BDCTABLE.cell(n, "MSGNO")) = "344" Then
               
                Ret_Msg_Txt = Trim(BDCTABLE.cell(n, "MSGTX"))
               
                Select Case Ret_Msg_Txt
                    
                    Case "No batch input data for screen SAPLSPO1 0100"
                        Ret_Message = "SAP Msg # " & Trim(BDCTABLE.cell(n, "MSGID")) & _
                                    Trim(BDCTABLE.cell(n, "MSGNO")) & _
                                    " Text (" & Trim(BDCTABLE.cell(n, "MSGTX")) & ")" & _
                                    "i.e. Reconciliation Key you are using is not created yet."
            
                    Case "No batch input data for screen SAPMSSY0 0120"
                        Ret_Message = "SAP Msg # " & Trim(BDCTABLE.cell(n, "MSGID")) & _
                                    Trim(BDCTABLE.cell(n, "MSGNO")) & _
                                    " Text (" & Trim(BDCTABLE.cell(n, "MSGTX")) & ")" & _
                                    "i.e. Check and GL item data - BP and IO, KONTL fields or see " & _
                                    "if the item is COPA relevant and has .LC on GL side 1st Col."
                    
                    Case Else
                        Ret_Message = "SAP Msg # " & Trim(BDCTABLE.cell(n, "MSGID")) & _
                                    Trim(BDCTABLE.cell(n, "MSGNO")) & _
                                    " Text (" & Trim(BDCTABLE.cell(n, "MSGTX")) & ")"
                
                End Select
            Else
                Ret_Message = "SAP Msg # " & Trim(BDCTABLE.cell(n, "MSGID")) & _
                                    Trim(BDCTABLE.cell(n, "MSGNO")) & _
                                    " Text (" & Trim(BDCTABLE.cell(n, "MSGTX")) & ")"
                
            End If
        'End If
    Else
       If Trim(BDCTABLE.cell(n, "MSGID")) <> Empty And _
          Trim(BDCTABLE.cell(n, "MSGNO")) <> Empty Then
         
          Ret_Msg_Txt = Trim(BDCTABLE.cell(n, "MSGTX"))
       End If
    End If
Next
        
Print_Err:
     X = X + 1
     Cells(X, 1).Value = Ret_Message
     With Cells(X, 1)
          .Font.ColorIndex = 1
          .Font.Bold = True
          .Interior.ColorIndex = 15
     End With
  
   BDCTABLE.FreeTable
   j = 0


'  Now Log-off from SAP R/3
   R3.Connection.Logoff
   Set Connection = Nothing


Exit Sub
Err_Hand:


NoVKONT:
BPVKONT = False
GoTo Res_after_VKONT




DBPSide:




MsgBox ("Make sure the BP header row has field name and first field begins with .D")
Exit Sub


DGLSide:




MsgBox ("Make sure the GL header row has field name and first field begins with .D")
Exit Sub




RFC_Auth_Error:
   BDCTABLE.FreeTable
   j = 0




'  Now Log-off from SAP R/3
   R3.Connection.Logoff
   Set Connection = Nothing




    MsgBox ("User is not Authorized for RFC calls.")
    Exit Sub


logoff_from_sap:


   BDCTABLE.FreeTable
   j = 0




'  Now Log-off from SAP R/3
   R3.Connection.Logoff
   Set Connection = Nothing




    MsgBox ("Unexpected error after logging on. Session is Terminated.")
    Exit Sub




BPSide_Err:
    Response = MsgBox("Press YES if there are no BP items" & _
         " and NO to cancel processing", 4, "BP Items?")
    If Response = vbYes Then ' User chose Yes button.
        NoBP = True
        GoTo GLSide
    Else
        Exit Sub
    End If




GLSide_Err:
    If NoBP = True Then
        MsgBox ("Please enter line items before posting a document")
    Else
         Response = MsgBox("Press YES if there are no GL items" & _
                    " and NO to cancel processing", 4, "BP Items?")
        If Response = vbYes Then ' User chose Yes button.
            NoGL = True
            GoTo Logon_to_SAP
        Else
            Exit Sub
        End If
    End If


End Sub




Sub BDC(k, prgm, dyn, dbn, field, fvalue)


    BDCTABLE.cell(k, "PROGRAM") = prgm
    BDCTABLE.cell(k, "DYNPRO") = dyn
    BDCTABLE.cell(k, "DYNBEGIN") = dbn
    BDCTABLE.cell(k, "FNAM") = field
    BDCTABLE.cell(k, "FVAL") = fvalue




End Sub
0 Kudos
Public Data_Wkbk As Object
Public Data_Sheet As Object
Public WFText As String
Public WFString As String
Public QuitMac As Boolean
Public doc_date As Date
Public post_date As Date
Public curr_key As String
Public No_Debug As Boolean
Public No_WF As Boolean
Public Process_mode As String
Public OPTxt_Overlay As String
Public Rec_key As String
Public Ref_Doc As String
Dim objFunction As Object
Dim R3 As Object
Dim R3Functions As Object
Dim BDCTABLE As Object
Sub CD_DOC_BDC()
' Find Rows and Columns for BP and GL side data
' ---------------------------------------------
'WFString = Trim(Cells(2, 10).value)
QuitMac = False
No_Debug = False
No_WF = False


'If WFString <> "Workflow ON" And WFString <> "Workflow OFF" Then
'    MsgBox ("Choose Workflow ON or OFF in cell J2")
'    Exit Sub
'End If
ActiveWorkbook.BuiltinDocumentProperties.Item(3).Value = "Jayesh Narwaney"
' this code is used for setting WF trigger
'If UCase(Trim(ActiveWorkbook.BuiltinDocumentProperties.Item(2).Value)) = "BST_DEBUG" _
'    Then
'    No_Debug = False
'    No_WF = True
'End If
'If UCase(Trim(ActiveWorkbook.BuiltinDocumentProperties.Item(2).Value)) = "NOWF" _
'    Then No_WF = True
' Start if Insert 05/18/2006 -------------
'
doc_date = Cells(4, 2).Value
post_date = Cells(4, 5).Value
OPTxt_Overlay = Cells(4, 13).Value
Ref_Doc = Cells(4, 8).Value

If Len(OPTxt_Overlay) > 0 And Len(OPTxt_Overlay) <> 2 Then
    MsgBox ("Enter 2 Char OPTEXT overlay value. Example - 09")
    Exit Sub
End If
    
If Len(Ref_Doc) > 0 And Len(Ref_Doc) > 16 Then
    MsgBox ("Enter max. 16 Char Ref Document.")
    Exit Sub
End If
'
' End of Insert 05/18/2006 ------------------


'If WFString = "Workflow ON" Then
    UserForm1.Show
'End If

If QuitMac = True Then Exit Sub


On Error GoTo Err_Hand


Set Data_Wkbk = ActiveWorkbook
Set Data_Sheet = ActiveSheet
    
BPCol = 1
NoBP = False
NoGL = False
BPVKONT = False


Range("A1").Select
Columns(BPCol).Select
    
On Error GoTo DBPSide
   
' Find .D for BP Side. On Error, goto .D BP Error


Selection.Find(What:=".D", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


HeaderDataRow = ActiveCell.Row


Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select
Rows(HeaderDataRow).Select


On Error GoTo NoVKONT
Selection.Find(What:="FKKOP-VKONT", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate
BPVKONT = True
BPVKONTDataCol = ActiveCell.Column


Res_after_VKONT:


Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select
Rows(HeaderDataRow).Select


Selection.Find(What:=".BFD", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


BPFSCDDataCol = ActiveCell.Column




Range(Cells(HeaderDataRow, BPFSCDDataCol), Cells(HeaderDataRow, BPFSCDDataCol)).Select
Rows(HeaderDataRow).Select


Selection.Find(What:=".BGD", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


BPGDataCol = ActiveCell.Column


Range(Cells(HeaderDataRow, BPGDataCol), Cells(HeaderDataRow, BPGDataCol)).Select
Rows(HeaderDataRow).Select


On Error GoTo DGLSide
   
' Find .D for GL Side. On Error, goto .D BP Error


Selection.Find(What:=".D", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
              :=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
               False).Activate


GLCol = ActiveCell.Column


Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select
Rows(HeaderDataRow).Select


Selection.Find(What:=".GFD", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


GLFSCDDataCol = ActiveCell.Column




Range(Cells(HeaderDataRow, BPFSCDDataCol), Cells(HeaderDataRow, BPFSCDDataCol)).Select
Rows(HeaderDataRow).Select


Selection.Find(What:=".GGD", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


GLGDataCol = ActiveCell.Column


Range(Cells(HeaderDataRow, BPGDataCol), Cells(HeaderDataRow, BPGDataCol)).Select
Rows(HeaderDataRow).Select


Selection.Find(What:=".COPAD", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


COPADataCol = ActiveCell.Column


Range(Cells(HeaderDataRow, BPGDataCol), Cells(HeaderDataRow, BPGDataCol)).Select
Rows(HeaderDataRow).Select


Selection.Find(What:=".COPA2", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


COPAP2Col = ActiveCell.Column


Selection.Find(What:=".COPA3", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


COPAP3Col = ActiveCell.Column


' Now find row where the data begins
Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select
Columns(BPCol).Select
'Range(Cells(HeaderDataRow, BPCol), Cells(65536, BPCol)).Select
' Needs Error Handling here ..... ****


On Error GoTo BPSide_Err


Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=False).Activate


TempBPRow = ActiveCell.Row


Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=False).Activate




BPItemDataBRow = ActiveCell.Row


If BPItemDataBRow = TempBPRow Then
    BPItemDataBRow = 0
    NoBP = True
    GoTo GLSide
End If


Range(Cells(BPItemDataBRow, BPCol), Cells(BPItemDataBRow, BPCol)).Select
Selection.End(xlDown).Select


If ActiveCell.Value = "" Then
    BPItemDataERow = BPItemDataBRow
Else
    BPItemDataERow = ActiveCell.Row
End If
Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select
Selection.End(xlToRight).Select
BPECol = ActiveCell.Column

GLSide:
Columns(GLCol).Select
' Needs Error Handling here ..... ****
On Error GoTo GLSide_Err
Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=False).Activate
        
TempGLRow = ActiveCell.Row
Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=False).Activate
GLItemDataBRow = ActiveCell.Row
If GLItemDataBRow = TempGLRow Then
    GLItemDataBRow = 0
    NoGL = True
    GoTo Logon_to_SAP
End If


Range(Cells(GLItemDataBRow, GLCol), Cells(GLItemDataBRow, GLCol)).Select
Selection.End(xlDown).Select


If ActiveCell.Value = "" Then
    GLItemDataERow = GLItemDataBRow
    
    If NoBP = True Then
        MsgBox ("Cannot Post. Only 1 line item.")
        Exit Sub
    End If
    
Else
    GLItemDataERow = ActiveCell.Row
End If


Range(Cells(HeaderDataRow, GLCol), Cells(HeaderDataRow, GLCol)).Select
Selection.End(xlToRight).Select


GLECol = ActiveCell.Column
'--------------------------------------------------------------------------------------------------------------------
Logon_to_SAP:


    If GLItemDataBRow > 0 And BPItemDataBRow > 0 Then
        If GLItemDataBRow <> BPItemDataBRow Then
            MsgBox ("Make Sure GL items begin in the same row as BP items")
            Exit Sub
        End If
    End If
    
    If GLItemDataBRow > 0 Then
        ItemDataBRow = GLItemDataBRow
    Else
        ItemDataBRow = BPItemDataBRow
    End If
    
    If GLItemDataERow < BPItemDataERow Then
        ItemDataERow = BPItemDataERow
    Else
        ItemDataERow = GLItemDataERow
    End If
        
        
        
    If NoBP = False Then
        StartCol = BPCol
    Else
        StartCol = GLCol
    End If
    
    If NoGL = False Then
        Endcol = GLECol
    Else
        Endcol = BPECol
    End If
        
        
    Range(Cells(ItemDataBRow, BPCol), Cells(ItemDataBRow, BPCol)).Select
    
' All Okay, now logon to SAP


    Set R3 = CreateObject("SAP.Functions")
    R3.LogFileName = "wdtflog.txt"
    R3.LogLevel = 3
    
'   Set connection information and connect
    Set Connection = R3.Connection
    
    xLogonType = False
    On Error GoTo 0
    'On Error GoTo RFC_Auth_Error
 
' Private Sub CommandButton1_Click()If login = False Then
' connectionSet objBAPICortrol = CreateObject(“SAP.Functions”)Set objConnection = objBAPICortrol.Connection
' Establish a connectionIf objConnection.Logon(0, False) Then    login = True    MsgBox “Connection Established”    CommandButton1.Caption = “Disconnect”End IfElseCommandButton1.Caption = “Connect 2 SAP”login = FalseobjConnection.LogoffSet objConnection = NothingSet objBAPICortrol = NothingEnd IfEnd Sub
    'Set functions = CreateObject("SAP.Functions")
   ' If functions.Connection.LOGON(0, False) <> True Then
    If R3.Connection.LOGON(0, False) <> True Then
          MsgBox ("Cannot logon!")
       Exit Sub
    Else
        'Set Connection = R3.Connection
'        Set Connection = functions.Connection
   '     Set conn = functions.Connection
        MsgBox "Connection complete"
    End If
  
  '  If conn Is Nothing Then
   '     Set functions = CreateObject("SAP.Functions")
    '    If functions.Connection.LOGON(0, False) <> True Then
     '       MsgBox "Unable to connect"
      '      Logoff
       '     Exit Sub
      '  Else
       '     Set conn = functions.Connection
        '    MsgBox "Connection complete"
       ' End If
  '  Else
   '     MsgBox "Already connected"
   ' End If
' End Sub




'Public Sub Logoff()
'    Set myFunc = Nothing
'    Set functions = Nothing
'    Set LOGON = Nothing
'    Set conn = Nothing
'
'    MsgBox "Logoff complete"
'End Sub
    
    
    
'   Set RFC values


    On Error Resume Next
    Set objfunctions = R3.Add("ZRFC_CALL_TRANSACTIONS")
    If Err.Number = 61704 Then GoTo RFC_Auth_Error
    
    Set BDCTABLE = objfunctions.Tables("TRANSDATA")
    
       
        
'   Initialize values
    BDCTABLE.FreeTable
    j = 0
    
    On Error GoTo logoff_from_sap
  
'   Build Header
    j = j + 1
    BDCTABLE.Rows.Add
        
        BDCTABLE.cell(j, "TCODE") = "FPE1"
        BDCTABLE.cell(j, "UPDMODE") = "S"
        BDCTABLE.cell(j, "DSPMODE") = Process_mode
        BDCTABLE.cell(j, "PROGRAM") = "SAPLFKPP"
        BDCTABLE.cell(j, "DYNPRO") = "0100"
        BDCTABLE.cell(j, "DYNBEGIN") = "X"
        
    j = j + 1
    BDCTABLE.Rows.Add


        BDCTABLE.cell(j, "FNAM") = "BDC_OKCODE"
    If NoBP = False Then
        BDCTABLE.cell(j, "FVAL") = "=IOP"
    Else
        BDCTABLE.cell(j, "FVAL") = "=IOPK"
    End If
    
    j = j + 1
    BDCTABLE.Rows.Add
    
    Call BDC(j, "", "", "", "FKKKO-BLDAT", doc_date)
    j = j + 1
    BDCTABLE.Rows.Add


    Call BDC(j, "", "", "", "FKKKO-BUDAT", post_date)
    j = j + 1
    BDCTABLE.Rows.Add


    Call BDC(j, "", "", "", "FKKKO-WAERS", curr_key)
    j = j + 1
    BDCTABLE.Rows.Add


    Call BDC(j, "", "", "", "RFPE1-ERVAR", OPTxt_Overlay)
    j = j + 1
    BDCTABLE.Rows.Add
    
    If Rec_key <> "" Then
        Call BDC(j, "", "", "", "FKKKO-FIKEY", Rec_key)
            j = j + 1
            BDCTABLE.Rows.Add
    End If
    
    Call BDC(j, "", "", "", "FKKKO-XBLNR", Ref_Doc)
    j = j + 1
    BDCTABLE.Rows.Add
    
    
'    Call Fill_BDCTABLE(j, k)


For i_rows = ItemDataBRow To ItemDataERow


    
    For i_cols = StartCol To Endcol
        
        Range(Cells(i_rows, i_cols), Cells(i_rows, i_cols)).Select
        
        If i_cols = BPCol Then
            Call BDC(j, "SAPLFKPP", "0202", "X", "", "")
            j = j + 1
            BDCTABLE.Rows.Add
            
            If NoGL = True Or i_rows > GLItemDataERow Then
                If i_rows = ItemDataERow Then
                    Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA")
                    j = j + 1
                    BDCTABLE.Rows.Add
                Else
                    Call BDC(j, "", "", "", "BDC_OKCODE", "=IOP")
                    j = j + 1
                    BDCTABLE.Rows.Add
                End If
            Else
                Call BDC(j, "", "", "", "BDC_OKCODE", "=IOPK")
                j = j + 1
                BDCTABLE.Rows.Add
            End If
        
            GoTo end_i_cols
        End If
'end of first section of code ------------------------------------
second section attached after this ............

0 Kudos

Public Data_Wkbk As Object Public Data_Sheet As Object Public WFText As String Public WFString As String Public QuitMac As Boolean Public doc_date As Date Public post_date As Date Public curr_key As String Public No_Debug As Boolean Public No_WF As Boolean Public Process_mode As String Public OPTxt_Overlay As String Public Rec_key As String Public Ref_Doc As String Dim objFunction As Object Dim R3 As Object Dim R3Functions As Object Dim BDCTABLE As Object Sub CD_DOC_BDC() ' Find Rows and Columns for BP and GL side data ' --------------------------------------------- 'WFString = Trim(Cells(2, 10).value) QuitMac = False No_Debug = False No_WF = False 'If WFString <> "Workflow ON" And WFString <> "Workflow OFF" Then ' MsgBox ("Choose Workflow ON or OFF in cell J2") ' Exit Sub 'End If ActiveWorkbook.BuiltinDocumentProperties.Item(3).Value = "Jayesh Narwaney" ' this code is used for setting WF trigger 'If UCase(Trim(ActiveWorkbook.BuiltinDocumentProperties.Item(2).Value)) = "BST_DEBUG" _ ' Then ' No_Debug = False ' No_WF = True 'End If 'If UCase(Trim(ActiveWorkbook.BuiltinDocumentProperties.Item(2).Value)) = "NOWF" _ ' Then No_WF = True ' Start if Insert 05/18/2006 ------------- ' doc_date = Cells(4, 2).Value post_date = Cells(4, 5).Value OPTxt_Overlay = Cells(4, 13).Value Ref_Doc = Cells(4, 8).Value If Len(OPTxt_Overlay) > 0 And Len(OPTxt_Overlay) <> 2 Then MsgBox ("Enter 2 Char OPTEXT overlay value. Example - 09") Exit Sub End If If Len(Ref_Doc) > 0 And Len(Ref_Doc) > 16 Then MsgBox ("Enter max. 16 Char Ref Document.") Exit Sub End If ' ' End of Insert 05/18/2006 ------------------ 'If WFString = "Workflow ON" Then UserForm1.Show 'End If If QuitMac = True Then Exit Sub On Error GoTo Err_Hand Set Data_Wkbk = ActiveWorkbook Set Data_Sheet = ActiveSheet BPCol = 1 NoBP = False NoGL = False BPVKONT = False Range("A1").Select Columns(BPCol).Select On Error GoTo DBPSide ' Find .D for BP Side. On Error, goto .D BP Error Selection.Find(What:=".D", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False).Activate HeaderDataRow = ActiveCell.Row Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select Rows(HeaderDataRow).Select On Error GoTo NoVKONT Selection.Find(What:="FKKOP-VKONT", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate BPVKONT = True BPVKONTDataCol = ActiveCell.Column Res_after_VKONT: Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select Rows(HeaderDataRow).Select Selection.Find(What:=".BFD", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate BPFSCDDataCol = ActiveCell.Column Range(Cells(HeaderDataRow, BPFSCDDataCol), Cells(HeaderDataRow, BPFSCDDataCol)).Select Rows(HeaderDataRow).Select Selection.Find(What:=".BGD", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate BPGDataCol = ActiveCell.Column Range(Cells(HeaderDataRow, BPGDataCol), Cells(HeaderDataRow, BPGDataCol)).Select Rows(HeaderDataRow).Select On Error GoTo DGLSide ' Find .D for GL Side. On Error, goto .D BP Error Selection.Find(What:=".D", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _ False).Activate GLCol = ActiveCell.Column Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select Rows(HeaderDataRow).Select Selection.Find(What:=".GFD", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate GLFSCDDataCol = ActiveCell.Column Range(Cells(HeaderDataRow, BPFSCDDataCol), Cells(HeaderDataRow, BPFSCDDataCol)).Select Rows(HeaderDataRow).Select Selection.Find(What:=".GGD", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate GLGDataCol = ActiveCell.Column Range(Cells(HeaderDataRow, BPGDataCol), Cells(HeaderDataRow, BPGDataCol)).Select Rows(HeaderDataRow).Select Selection.Find(What:=".COPAD", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate COPADataCol = ActiveCell.Column Range(Cells(HeaderDataRow, BPGDataCol), Cells(HeaderDataRow, BPGDataCol)).Select Rows(HeaderDataRow).Select Selection.Find(What:=".COPA2", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate COPAP2Col = ActiveCell.Column Selection.Find(What:=".COPA3", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False).Activate COPAP3Col = ActiveCell.Column ' Now find row where the data begins Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select Columns(BPCol).Select 'Range(Cells(HeaderDataRow, BPCol), Cells(65536, BPCol)).Select ' Needs Error Handling here ..... **** On Error GoTo BPSide_Err Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False).Activate TempBPRow = ActiveCell.Row Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False).Activate BPItemDataBRow = ActiveCell.Row If BPItemDataBRow = TempBPRow Then BPItemDataBRow = 0 NoBP = True GoTo GLSide End If Range(Cells(BPItemDataBRow, BPCol), Cells(BPItemDataBRow, BPCol)).Select Selection.End(xlDown).Select If ActiveCell.Value = "" Then BPItemDataERow = BPItemDataBRow Else BPItemDataERow = ActiveCell.Row End If Range(Cells(HeaderDataRow, BPCol), Cells(HeaderDataRow, BPCol)).Select Selection.End(xlToRight).Select BPECol = ActiveCell.Column GLSide: Columns(GLCol).Select ' Needs Error Handling here ..... **** On Error GoTo GLSide_Err Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False).Activate TempGLRow = ActiveCell.Row Selection.Find(What:=".L", After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False).Activate GLItemDataBRow = ActiveCell.Row If GLItemDataBRow = TempGLRow Then GLItemDataBRow = 0 NoGL = True GoTo Logon_to_SAP End If Range(Cells(GLItemDataBRow, GLCol), Cells(GLItemDataBRow, GLCol)).Select Selection.End(xlDown).Select If ActiveCell.Value = "" Then GLItemDataERow = GLItemDataBRow If NoBP = True Then MsgBox ("Cannot Post. Only 1 line item.") Exit Sub End If Else GLItemDataERow = ActiveCell.Row End If Range(Cells(HeaderDataRow, GLCol), Cells(HeaderDataRow, GLCol)).Select Selection.End(xlToRight).Select GLECol = ActiveCell.Column '-------------------------------------------------------------------------------------------------------------------- Logon_to_SAP: If GLItemDataBRow > 0 And BPItemDataBRow > 0 Then If GLItemDataBRow <> BPItemDataBRow Then MsgBox ("Make Sure GL items begin in the same row as BP items") Exit Sub End If End If If GLItemDataBRow > 0 Then ItemDataBRow = GLItemDataBRow Else ItemDataBRow = BPItemDataBRow End If If GLItemDataERow < BPItemDataERow Then ItemDataERow = BPItemDataERow Else ItemDataERow = GLItemDataERow End If If NoBP = False Then StartCol = BPCol Else StartCol = GLCol End If If NoGL = False Then Endcol = GLECol Else Endcol = BPECol End If Range(Cells(ItemDataBRow, BPCol), Cells(ItemDataBRow, BPCol)).Select ' All Okay, now logon to SAP Set R3 = CreateObject("SAP.Functions") R3.LogFileName = "wdtflog.txt" R3.LogLevel = 3 ' Set connection information and connect Set Connection = R3.Connection xLogonType = False On Error GoTo 0 'On Error GoTo RFC_Auth_Error ' new code from sap portal............... ' Private Sub CommandButton1_Click()If login = False Then ' connectionSet objBAPICortrol = CreateObject(“SAP.Functions”)Set objConnection = objBAPICortrol.Connection ' Establish a connectionIf objConnection.Logon(0, False) Then login = True MsgBox “Connection Established” CommandButton1.Caption = “Disconnect”End IfElseCommandButton1.Caption = “Connect 2 SAP”login = FalseobjConnection.LogoffSet objConnection = NothingSet objBAPICortrol = NothingEnd IfEnd Sub 'Set functions = CreateObject("SAP.Functions") ' If functions.Connection.LOGON(0, False) <> True Then If R3.Connection.LOGON(0, False) <> True Then MsgBox ("Cannot logon!") Exit Sub Else 'Set Connection = R3.Connection ' Set Connection = functions.Connection ' Set conn = functions.Connection MsgBox "Connection complete" End If ' If conn Is Nothing Then ' Set functions = CreateObject("SAP.Functions") ' If functions.Connection.LOGON(0, False) <> True Then ' MsgBox "Unable to connect" ' Logoff ' Exit Sub ' Else ' Set conn = functions.Connection ' MsgBox "Connection complete" ' End If ' Else ' MsgBox "Already connected" ' End If ' End Sub 'Public Sub Logoff() ' Set myFunc = Nothing ' Set functions = Nothing ' Set LOGON = Nothing ' Set conn = Nothing ' ' MsgBox "Logoff complete" 'End Sub ' Set RFC values On Error Resume Next Set objfunctions = R3.Add("ZRFC_CALL_TRANSACTIONS") If Err.Number = 61704 Then GoTo RFC_Auth_Error Set BDCTABLE = objfunctions.Tables("TRANSDATA") ' Initialize values BDCTABLE.FreeTable j = 0 On Error GoTo logoff_from_sap '--------------------------------------------------------------- ' Build Header j = j + 1 BDCTABLE.Rows.Add BDCTABLE.cell(j, "TCODE") = "FPE1" BDCTABLE.cell(j, "UPDMODE") = "S" BDCTABLE.cell(j, "DSPMODE") = Process_mode BDCTABLE.cell(j, "PROGRAM") = "SAPLFKPP" BDCTABLE.cell(j, "DYNPRO") = "0100" BDCTABLE.cell(j, "DYNBEGIN") = "X" j = j + 1 BDCTABLE.Rows.Add BDCTABLE.cell(j, "FNAM") = "BDC_OKCODE" If NoBP = False Then BDCTABLE.cell(j, "FVAL") = "=IOP" Else BDCTABLE.cell(j, "FVAL") = "=IOPK" End If j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "FKKKO-BLDAT", doc_date) j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "FKKKO-BUDAT", post_date) j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "FKKKO-WAERS", curr_key) j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "RFPE1-ERVAR", OPTxt_Overlay) j = j + 1 BDCTABLE.Rows.Add If Rec_key <> "" Then Call BDC(j, "", "", "", "FKKKO-FIKEY", Rec_key) j = j + 1 BDCTABLE.Rows.Add End If Call BDC(j, "", "", "", "FKKKO-XBLNR", Ref_Doc) j = j + 1 BDCTABLE.Rows.Add ' Call Fill_BDCTABLE(j, k) For i_rows = ItemDataBRow To ItemDataERow For i_cols = StartCol To Endcol Range(Cells(i_rows, i_cols), Cells(i_rows, i_cols)).Select If i_cols = BPCol Then Call BDC(j, "SAPLFKPP", "0202", "X", "", "") j = j + 1 BDCTABLE.Rows.Add If NoGL = True Or i_rows > GLItemDataERow Then If i_rows = ItemDataERow Then Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA") j = j + 1 BDCTABLE.Rows.Add Else Call BDC(j, "", "", "", "BDC_OKCODE", "=IOP") j = j + 1 BDCTABLE.Rows.Add End If Else Call BDC(j, "", "", "", "BDC_OKCODE", "=IOPK") j = j + 1 BDCTABLE.Rows.Add End If GoTo end_i_cols End If ' Changes 7/27/05 ' If i_cols = BPVKONTDataCol Then ' If Cells(i_rows, i_cols).value = "" Then ' BPVKONT = "" ' Else ' BPVKONT = Cells(i_rows, i_cols).value ' End If ' End If ' end of changes 7/27/05 If i_cols = BPFSCDDataCol Then If BPVKONT = False Then Call BDC(j, "", "", "", "FKKOP-VKONT", "") j = j + 1 BDCTABLE.Rows.Add End If Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLVLVZ 2000DOP_APPL") j = j + 1 BDCTABLE.Rows.Add GoTo end_i_cols End If If i_cols = BPGDataCol Then Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLZSCREEN 0100DOP_CUST") j = j + 1 BDCTABLE.Rows.Add GoTo end_i_cols End If If i_cols = GLCol Then Call BDC(j, "SAPLFKPP", "0302", "X", "", "") j = j + 1 BDCTABLE.Rows.Add If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then Call BDC(j, "", "", "", "BDC_OKCODE", "=COPA") j = j + 1 BDCTABLE.Rows.Add GoTo end_i_cols End If If NoBP = True Or i_rows > BPItemDataERow Then If i_rows = ItemDataERow Then Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA") j = j + 1 BDCTABLE.Rows.Add Else Call BDC(j, "", "", "", "BDC_OKCODE", "=IOPK") j = j + 1 BDCTABLE.Rows.Add End If Else If i_rows = ItemDataERow Then Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA") j = j + 1 BDCTABLE.Rows.Add Else Call BDC(j, "", "", "", "BDC_OKCODE", "=IOP") j = j + 1 BDCTABLE.Rows.Add End If End If GoTo end_i_cols End If If i_cols = GLFSCDDataCol Then Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLVLVZ 1000DOPK_APPL") j = j + 1 BDCTABLE.Rows.Add GoTo end_i_cols End If If i_cols = GLGDataCol Then Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLZSCREEN 0200DOPK_CUST") j = j + 1 BDCTABLE.Rows.Add GoTo end_i_cols End If If i_cols = COPADataCol Then If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then Call BDC(j, "SAPLKEAK", "0300", "X", "", "") j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "BDC_OKCODE", "=P+") j = j + 1 BDCTABLE.Rows.Add End If GoTo end_i_cols End If If i_cols = COPAP2Col Then If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then Call BDC(j, "SAPLKEAK", "0300", "X", "", "") j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "BDC_OKCODE", "=P+") j = j + 1 BDCTABLE.Rows.Add End If GoTo end_i_cols End If If i_cols = COPAP3Col Then If Trim(Cells(i_rows, GLCol).Value) = ".LC" Then Call BDC(j, "SAPLKEAK", "0300", "X", "", "") j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "BDC_OKCODE", "=WEIT") j = j + 1 BDCTABLE.Rows.Add End If GoTo end_i_cols End If If i_cols > COPADataCol Then If Trim(Cells(i_rows, GLCol).Value) = ".LC" And _ Trim(Cells(i_rows, i_cols).Value) <> "" Then Call BDC(j, "", "", "", Trim(Cells(HeaderDataRow, i_cols).Value), _ Trim(Cells(i_rows, i_cols).Value)) j = j + 1 BDCTABLE.Rows.Add End If If i_cols = Endcol And Trim(Cells(i_rows, GLCol).Value) = ".LC" Then Call BDC(j, "SAPLFKPP", "0302", "X", "", "") j = j + 1 BDCTABLE.Rows.Add If NoBP = True Or i_rows >= BPItemDataERow Then If i_rows = ItemDataERow Then Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA") j = j + 1 BDCTABLE.Rows.Add Else Call BDC(j, "", "", "", "BDC_OKCODE", "=IOPK") j = j + 1 BDCTABLE.Rows.Add End If Else If i_rows = ItemDataERow Then Call BDC(j, "", "", "", "BDC_OKCODE", "=UPDA") j = j + 1 BDCTABLE.Rows.Add Else Call BDC(j, "", "", "", "BDC_OKCODE", "=IOP") j = j + 1 BDCTABLE.Rows.Add End If End If Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLVLVZ 1000DOPK_APPL") j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "BDC_SUBSCR", "SAPLZSCREEN 0200DOPK_CUST") j = j + 1 BDCTABLE.Rows.Add End If GoTo end_i_cols End If ' Start of new logic for OPTXT fields 05/24/06 L_OPTXT = Trim(Cells(HeaderDataRow, i_cols).Value) Like "ZSCREENTXT*" If L_OPTXT = True Then Call BDC(j, "", "", "", Trim(Cells(HeaderDataRow, i_cols).Value), _ Trim(Cells(i_rows, i_cols).Value)) j = j + 1 BDCTABLE.Rows.Add GoTo end_i_cols End If ' End of new logic for OPTXT fields 05/24/06 If Trim(Cells(i_rows, i_cols).Value) <> "" Then Call BDC(j, "", "", "", Trim(Cells(HeaderDataRow, i_cols).Value), _ Trim(Cells(i_rows, i_cols).Value)) j = j + 1 BDCTABLE.Rows.Add End If end_i_cols: Next i_cols If i_rows >= BPItemDataERow Then StartCol = GLCol If i_rows >= GLItemDataERow Then Endcol = BPECol Next Call BDC(j, "SAPLFKK_WORKFLOW", "0100", "X", "", "") j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "BDC_OKCODE", "=CONT") j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "FKK_DOCAPPR-END_MAIL", "X") j = j + 1 BDCTABLE.Rows.Add Call BDC(j, "", "", "", "WA_COMMENT(01)", WFText) Range("A1").Select ' Ok, now post in SAP ------------------------------- ' result = ObjFunctions.Call result = objfunctions.Call If result <> True Then MsgBox (objfunctions.Exception) R3.Connection.Logoff Set Connection = Nothing Exit Sub End If

stefan_schnell
Active Contributor
0 Kudos

Hello Timothy,

please post it as CODE.

Thanks and cheers
Stefan

0 Kudos

Did you have a minute to look at this code ?

Just running out of options at this point ...

Tim Keating

0 Kudos


i tried to attach a file as .txt but it said wrong file type

0 Kudos

We use FS-CD which is the Collection Disbursement module of SAP. It operates as a sub-ledger interface to SAP FI-CO (GL)

Does that answer your question ?

stefan_schnell
Active Contributor
0 Kudos

Hello Timothy,

unfortunately not. Can you please post your code where we can see which RFM and parameters do you use.

Cheers
Stefan