cancel
Showing results for 
Search instead for 
Did you mean: 

Select Variant Issue

Former Member
0 Kudos


Hi,

I created a SAP Scripting for run a transaction (Y_LAD_65000304) and select a specific layout for my report.

However, when I press the layout button, if the user have a default layout selected the macro didn't understant the comnad to select my specific variant.

If the layout default option is disable, the scripting works well. The problem is none of all users have this option disable.

Find below my codes:

'Select layout


session.findById("wnd[0]/tbar[1]/btn[33]").press

iRows = session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").RowCount

For i = 0 To iRows - 1
    sLayout = session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").getCellValue(i, "VARIANT")
    If sLayout = "/SCRIPT" Then Exit For
Next

session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").currentCellRow = i
session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").clickCurrentCell

Someone knows how to fixed it?

Accepted Solutions (1)

Accepted Solutions (1)

stefan_schnell
Active Contributor
0 Kudos

Hello Talita,

welcome to the SAP GUI Scripting forum.

As far as I can see your script works. I try it on the same way and it works as expected.

Set Layout =  session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")

Rows = Layout.RowCount()

For i = 0 To Rows - 1

  LayoutVariant = Layout.getCellValue(i, "VARIANT")

  If LayoutVariant = "STEFAN3" Then

    Layout.currentCellRow = i

    Layout.clickCurrentCell

    Exit For

  End If

Next

In my case I have no dependency to the default option.

Hint for all: The transaction code Y_LAD_65000304 is individual, but the report behind this TAC uses ABAP List Viewer (ALV) Grid. You can check it via TAC SE16 and the layout option.

Cheers

Stefan

Former Member
0 Kudos

Hi Stefan,

Thank you so much for your help!

Regards,

Talita

Answers (0)