SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

SAP Scripting and Sample Scripts for ABAP Developer

This SAP scripting guide provides an overview of sample scripts for SAP and ABAP developers that can be used in different applications.

SAP Scripting

In order to get the text message displayed on the status bar at the bottom of the SAP GUI, ABAP programmers can use following script


As a developer, if you are looking for the type of message in the status bar of the SAP GUI, then you can use following script:

Session.findById("wnd[0]/sbar").Messagetype 'S = Success, W = Warning, E = Error and I = Information

Instead of searching for the message text displayed in the current user's language on the SAP GUI status bar, you can get the message number using this script


Since message text will change from language to language, you can configure your solution based on the message number instead of using the message text.

If you want to select a program VARIANT from a list of variants, you can use the following script code

strVar = "/NL_BACKORD" 'Hier de gezochte variantnaam

Below is the table with the variants in the script:
The name is easy to capture with the script recorder.

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

arows = Layout.RowCount()

For r = 0 To arows - 1

If Len(SAP_Session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").getCellValue(r, "VARIANT")) = 0 Then

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

End If

'The following code guarantees that even if there are more than 200 VARIANTS in the list, you will still find the target VARIANT

If SAP_Session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").getCellValue(r, "VARIANT") = strVar Then

Layout.currentCellRow = r

Exit For

End If


SAP_Session.findById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell").selectedRows = r

SAP Scripting


Install SAP Free
CRM Companies List
Web Based CRM Software

Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.