cancel
Showing results for 
Search instead for 
Did you mean: 

Transactions take longer to process after having logged on for sometime

Former Member
0 Kudos

I have a set of objects where I need to process something (eg. Putting billing blocks). I have a GUI Script that I use with Excel Macro that connects to a SAP session and executes what I want it to execute.

The problem that I have is that after about 10 minutes or 60-70 executions, the speed starts to slow down. If I log off and re-start the macro, it again starts at a much faster speed before slowing down again.

In the local data settings for history and cache, I have already made alterations but it has not helped.

Is there any setting I could do for the speed not to reduce?

Regs

Manas

Accepted Solutions (1)

Accepted Solutions (1)

holger_khn
Contributor
0 Kudos

Hello.

I would assume this issue is caused by your coding. May you can post your code for further Analysis on this? Thanks.

Former Member
0 Kudos

Hi,

Please find below a sample code for billing blocks -> this is called for each contract that needs to be put on block.

Also, I tried to monitor the time 'excel' takes and the time is spent 'waiting' for SAP to respond. What i noticed is that after 60-70 transactions, the total of excel time is nearly the same and is small whereas the time it takes to execute sap transaction (eg. clicking on the edit mode and waiting for it to change to edit mode) increases drastically.

Please let me know your thoughts.

Function BILLING_BLOCK(IROW)

Dim CONTRACT, CONTRACT_ITEM_NUMBER

'contract

If objSheet.Cells(IROW, 2) <> "" Then

        CONTRACT = objSheet.Cells(IROW, 2)

End If

   

objSess.FindById("wnd[0]/tbar[0]/okcd").Text = "/ncrmd_order"

objSess.FindById("wnd[0]").sendVKey 0

objSess.FindById("wnd[0]/tbar[1]/btn[17]").press

objSess.FindById("wnd[1]/usr/ctxtGV_OBJECT_ID").Text = CONTRACT

objSess.FindById("wnd[1]/usr/ctxtGV_OBJECT_ID").caretPosition = 10

objSess.FindById("wnd[1]").sendVKey 0

objSess.FindById("wnd[0]/usr/ssubSUBSCREEN_1O_MAIN:SAPLCRM_1O_MANAG_UI:0120/subSUBSCREEN_1O_WORKA:SAPLCRM_1O_WORKA_UI:2100/subSCR_1O_MAINTAIN:SAPLCRM_1O_UI:1100/subSCR_1O_MAINTAIN:SAPLCRM_SALES_UI:0300/subMAINSCR0:SAPLCRM_SALES_UI:3010/subSCRAREA1:SAPLCRM_SALES_UI:3101/tabsTABSTRIP_HEADER/tabpT\SALS_HD15").Select

objSess.FindById("wnd[0]/usr/ssubSUBSCREEN_1O_MAIN:SAPLCRM_1O_MANAG_UI:0120/subSUBSCREEN_1O_WORKA:SAPLCRM_1O_WORKA_UI:2100/subSCR_1O_MAINTAIN:SAPLCRM_1O_UI:1100/subSCR_1O_COMMON:SAPLCRM_1O_UI:3150/subSCR_1O_TT:SAPLCRM_1O_UI:2600/btnGV_TOGGTRANS").press

objSess.FindById("wnd[0]/usr/ssubSUBSCREEN_1O_MAIN:SAPLCRM_1O_MANAG_UI:0120/subSUBSCREEN_1O_WORKA:SAPLCRM_1O_WORKA_UI:2100/subSCR_1O_MAINTAIN:SAPLCRM_1O_UI:1100/subSCR_1O_MAINTAIN:SAPLCRM_SALES_UI:0300/subMAINSCR0:SAPLCRM_SALES_UI:3010/subSCRAREA1:SAPLCRM_SALES_UI:3101/tabsTABSTRIP_HEADER/tabpT\SALS_HD15/ssubHEADER_DETAIL:SAPLCRM_SALES_UI:7185/subSTATUS_ORDER_CHANGE:SAPLCRM_STATUS_UI:0201/subSTBL:SAPLCRM_STATUS_UI:0331/cntlSTATUSCONT_0331/shellcont/shell").PressContextButton "BT_STATUS_NOBILL_H"

objSess.FindById("wnd[0]/usr/ssubSUBSCREEN_1O_MAIN:SAPLCRM_1O_MANAG_UI:0120/subSUBSCREEN_1O_WORKA:SAPLCRM_1O_WORKA_UI:2100/subSCR_1O_MAINTAIN:SAPLCRM_1O_UI:1100/subSCR_1O_MAINTAIN:SAPLCRM_SALES_UI:0300/subMAINSCR0:SAPLCRM_SALES_UI:3010/subSCRAREA1:SAPLCRM_SALES_UI:3101/tabsTABSTRIP_HEADER/tabpT\SALS_HD15/ssubHEADER_DETAIL:SAPLCRM_SALES_UI:7185/subSTATUS_ORDER_CHANGE:SAPLCRM_STATUS_UI:0201/subSTBL:SAPLCRM_STATUS_UI:0331/cntlSTATUSCONT_0331/shellcont/shell").SelectContextMenuItem "I1075_04"

objSheet.Cells(IROW, 6) = "Billing Block has been set"

objSess.FindById("wnd[0]/tbar[0]/btn[11]").press

objSheet.Cells(IROW, 7) = objSBar.Text

objSheet.Cells(IROW, 4) = "Done"

'go out of crmd_order (to try to see if this helps in increasing speed'

objSess.FindById("wnd[0]/tbar[0]/btn[3]").press

End Function

regs

Manas

holger_khn
Contributor
0 Kudos

Thanks for this code.

As it is an function you call may you can Show us the calling code?

I assume it is caused by the way you call this function.

Have you set global variables for objSheet and objSess?

Got the get set once by your main code or each time again?

Former Member
0 Kudos

Hi,

Please see below the calling function.

Objsess is a global variable and is not set each time.

Public Sub SAP_SCRIPT_BILLING_BLOCK()

Dim W_Obj1, W_Obj2, W_Obj3, W_Obj4, IROW

Dim W_Func

Dim W_Src_Ord

Dim W_Ret As Boolean

Const startrow As Integer = 11 'First row with actual data

Set objSheet = ActiveWorkbook.ActiveSheet

For IROW = startrow To objSheet.UsedRange.Rows.count

    W_Ret = Attach_Session(IROW)

    If W_Ret Then

        If objSess.Info.SystemName & objSess.Info.Client <> objSheet.Cells(IROW, 1) Then

            'MsgBox "Connect to client " & objSheet.Cells(iRow, 1)

            Exit For

        End If

        Call BILLING_BLOCK(IROW)

     Next

     

    Set objSess = Nothing

    Set objGui = Nothing

    Set SapGuiAuto = Nothing

   

    MsgBox "Script completed.", vbInformation + vbOKOnly

End Sub

Thanks again,

Manas

holger_khn
Contributor
0 Kudos

Hello.

As I do not have all code this is what I understand so far.

You have a FOR-Loop in your main code.

Inside this FOR-Loop you assign in each Loop some objects again and again.

After a while this cause Performance issues.

You should redesign your code.

Assign objects only once in your main code (like onjSess and other).

The code from your function can be included in FOR-Loop

This will defintely improve your Performance issues.

Former Member
0 Kudos

Thank you. I made the changes and doesnt slow down now.

Many many thanks.

regs

Manas

Answers (0)