Skip to Content
avatar image
Former Member

Unable to make the SAP GUI ocx interface work in 640, it worked previously

I maintain a Powerbuilder application that communicates with SAP using wdtfuncs.ocx to call an ABAP procedure using the following code. This code worked correctly, but with the advent of SAPgui 640 it now fails on the Add method at the point in BOLD print below. I am unable to find any documentation explaining any changes in wdtfuncs.ocx and all of the code samples I have found look the same as the one I originally used to develop the code. I would greatly appreciate any assistance on resolving this issue.

Integer li_answer

Long ll_rc = -1

String ls_title = "SAP Update", &

ls_action, &

ls_parms[]

Pointer lp_save

OLEObject RfcCallTransaction

OLEObject ZSCD

OLEObject ZPGM

OLEObject ZPRT

OLEObject ZRPTFLG

OLEObject ZUSER

OLEObject ZACTION

OLEObject ZRC

//Get the active window

iw_parentwindow = gw_frame.GetActiveSheet()

// Don't process Transactions for SHARED PARTS

If iw_parentwindow.is_pgm_id = CMNPRTPGMNM Then Return 1

If iw_parentwindow.uo_1.dw_1.DeletedCount() > 0 Then

ls_action = "D"

ElseIf iw_parentwindow.uo_1.dw_1.GetItemStatus(1,0,Primary!) = NewModified! Then

ls_action = "I"

ElseIf iw_parentwindow.uo_1.dw_1.GetItemStatus(1,"prt_rpt_flg",Primary!) = DataModified! Then

ls_action = "U"

ElseIf inv_string.of_IsEmpty(iw_parentwindow.is_sap_action) Then

// Nothing to do

Return 1

Else

// Action set externally

// Save and Reset value

ls_action = iw_parentwindow.is_sap_action

SetNull(iw_parentwindow.is_sap_action)

End If

Do

// Get and save SAP user and password

If inv_string.of_IsEmpty(iw_parentwindow.is_SAP_parms[1]) &

OR inv_string.of_IsEmpty(iw_parentwindow.is_SAP_parms[2]) Then

Open(w_prism_logon)

If inv_string.of_ParseToArray(Message.Stringparm,Char(9),ls_parms) > 1 Then

If inv_string.of_IsEmpty(ls_parms[1]) &

OR inv_string.of_IsEmpty(ls_parms[2]) Then

// No user or password - ERROR

MessageBox(ls_title,"The RIT was not updated due to an Error obtaining the Logon Parameters.~nPlease contact the Help Desk.")

Return ll_rc

End If

Else

// No user or password - CANCEL

MessageBox(ls_title,"The RIT was not updated because you cancelled PRISM logon.")

Return ll_rc

End If

iw_parentwindow.is_SAP_parms = ls_parms

End If

// Set SAP Connection and Logon Parameters

ole_SAP_Logon.Object.Client = gnv_app.of_get_prism_client()

ole_SAP_Logon.Object.Language = gnv_app.of_get_prism_lang()

ole_SAP_Logon.Object.ApplicationServer = gnv_app.of_get_prism_svr()

ole_SAP_Logon.Object.SystemNumber = gnv_app.of_get_prism_sys_nbr()

ole_SAP_Logon.Object.User = iw_parentwindow.is_SAP_parms[1]

ole_SAP_Logon.Object.Password = iw_parentwindow.is_SAP_parms[2]

// Connect to SAP

This.Object.Connection = ole_SAP_Logon.Object.NewConnection()

If NOT IsValid(This.Object.Connection) Then

MessageBox(ls_title,"SAP Connection Failed.~nPlease contact the Help Desk.")

Return ll_rc

End If

// Logon to SAP

If NOT This.Object.Connection.logon(0,TRUE) Then

//BLE 03/27/07 - TAR RMS-025

SetNull(iw_parentwindow.is_SAP_parms[1])

SetNull(iw_parentwindow.is_SAP_parms[2])

li_answer = MessageBox(ls_title,"PRISM Logon failed.~n" + &

"Check your username and password and Retry or Cancel.", + &

Exclamation!, &

RetryCancel!)

Else

li_answer = 0

End If

Loop While li_answer = 1

ll_rc = -1

If li_answer = 0 Then

// Set the RFC Call Parameters

THE FOLLOWING CALL FAILS USING SAPgui 640

  • RfcCallTransaction = This.Object.Add("ZPCABS_PGM_PRT_TO_SAP")*

ZSCD = RfcCallTransaction.Exports("ZSCD")

ZSCD.Value = gnv_app.of_get_site_cd()

ZPGM = RfcCallTransaction.Exports("ZPGM")

ZPGM.Value = iw_parentwindow.is_pgm_id

ZPRT = RfcCallTransaction.Exports("ZPRT")

ZPRT.Value = iw_parentwindow.is_prt_nbr

ZRPTFLG = RfcCallTransaction.Exports("ZRPTFLG")

ZRPTFLG.Value = iw_parentwindow.is_prt_rpt_flg

ZUSER = RfcCallTransaction.Exports("ZUSER")

ZUSER.Value = iw_parentwindow.is_usr_id

ZACTION = RfcCallTransaction.Exports("ZACTION")

ZACTION.Value = ls_action

ZRC = RfcCallTransaction.Imports("ZRC")

// Perform the RFC Call

If RfcCallTransaction.Call() then

ll_rc = Long(ZRC.Value)

If ll_rc = 0 Then

ll_rc = 1

Else

ll_rc = -1

End If

Else

MessageBox(ls_title,"SAP RFC Call " + '"ZPCABS_PGM_PRT_TO_SAP"' + " Failed.~nPlease contact the Help Desk.")

End If

This.Object.Connection.Logoff

else

MessageBox(ls_title,"PRISM was not updated because Logon failed or was cancelled.")

End If

Return ll_rc

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 27, 2008 at 06:07 AM

    Hello William

    There are no major changes that are in wdtfuncs.ocx binary in 6.40 and 7.10.

    Please check the following:

    1. Please check whether wdtfuncs.ocx is registered.

    (To register wdtfuncs.ocx, start->Run, type regsvr32 <path of binary>\wdtfuncs.ocx.

    2. Check the name of the function module in ABAP and try to execute it in ABAP.

    3. Please try to run the following script:

    -


    Set SAPFunctions1 = CreateObject("SAP.Functions")

    SAPFunctions1.LogLevel=5

    SAPFunctions1.LogFileName="C:\FunctionLog.log"

    Set conn = SAPFunctions1.Connection

    If conn.logon(0, false) <> True Then

    MsgBox "Cannot logon!."

    Else

    MsgBox "logon succeed!."

    End If

    Set Funct = SAPFunctions1.Add("ZPCABS_PGM_PRT_TO_SAP")

    -


    4. If it fails then please send me the FunctionLog.log file which gets created in

    "C:\" drive. Also please send the error message that you are receiving.

    Regards,

    Dinesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 27, 2008 at 05:43 PM

    Thanks for the suggestion. The problem was actually caused by a BASIS change that removed my permission for RFC calls! Unfortunately, the way SAP coded this this function, that caused an application crash and the error is recorded in an undocumented (to the best of my knowledge) error file named dev_rfc.trc. There apparently is no good "fix" for this issue. The clue was that it was still working in production even though it wasn't working in my development system.

    Add comment
    10|10000 characters needed characters exceeded