Creating A Command Field Widget For SAP
Creating A Command Field Widget For SAP
Applies to:
SAP ECC 6.0, SAP NetWeaver 7.0 (2004s).
Summary
This document explains a step by step approach in how to create a Command Field Widget for SAP. In order
to proceed with this article, you should have a basic idea about widgets. You can find the Command Field
Widget here.
Author Bio
Jaideep Srinivasan is an Abaper in EDS (India). He is more interested in developing tools for
Web applications and SAP.
© 2007 SAP AG 1
Enterprise Widget for SAP Command Field
Table of Contents
Objectives
The main objective is to provide SAP Users with a simple Widget which is similar to the Command Field in
SAP.(ie.user can call SAP R/3 transactions from the Command Field Widget)
Credits
Special thanks to Tarun Telang & Abesh Bhattacharjee for introducing about the concepts of Widgets and
SAP GUI for Windows.
Create a text file with the following conten with .sap extension.
[System]
Name=NSP
Client=000
Description=NSP1
[User]
Name=BCUSER
Password=minisap
Language=EN
© 2007 SAP AG 2
Enterprise Widget for SAP Command Field
[Function]
Command=se38
Title=ABAP Editor
Type=Transaction
[Configuration]
WorkDir=D:\Documents and Settings\abcdef\SapWorkDir
[Options]
Reuse=1
Save the file with extension .SAP (for eg : "main.SAP"). This will create a SAP Shortcut (For more details
view Tarun Telang blog about SAP GUI for Windows.)
Create another text file with extension .kon (for example "Command_Field.kon").
<preference>
<name>Description</name>
<title>Description:</title>
<type>text</type>
<defaultValue>NSP1</defaultValue>
</preference>
<preference>
<name>User</name>
<title>User:</title>
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 3
Enterprise Widget for SAP Command Field
<type>text</type>
<defaultValue>BCUSER</defaultValue>
</preference>
<preference>
<name>Password</name>
<title>Password:</title>
<type>text</type>
<defaultValue>minisap</defaultValue>
<secure>yes</secure>
</preference>
<window>
<name>main_window</name>
<title>SAP Command LINE</title>
<height>102</height>
<width>230</width>
<visible>yes</visible>
<opacity>95%</opacity>
<onGainFocus>
searchText.focus();
</onGainFocus>
</window>
© 2007 SAP AG 4
Enterprise Widget for SAP Command Field
</textArea>
<preference name="windowLevel">
<hidden>true</hidden>
</preference>
//initialization event
<action trigger="onLoad" >
<![CDATA[
include("sap.js");
]]>
</action>
<action trigger="onPreferencesChanged">
doRetrieve();
</action>
</widget>
searchText.focus();
function doRetrieve()
{
tcode = searchText.data;
lines = filesystem.readFile( "main.sap");
replace_tcode = lines.replace("se38",tcode);
Server = preferences.Server.value;
replace_Server = replace_tcode.replace("NSP",Server);
Client = preferences.Client.value;
replace_Client = replace_Server.replace("000",Client);
Description = preferences.Description.value;
replace_Description = replace_Client.replace("NSP1",Description);
User = preferences.User.value;
replace_User = replace_Description.replace("BCUSER",User);
Password = preferences.Password.value;
© 2007 SAP AG 5
Enterprise Widget for SAP Command Field
replace_Password = replace_User.replace("minisap",Password);
filesystem.writeFile( "c:/temp.sap",replace_Password);
filesystem.open( "c:/temp.sap"); //new file has been created and
opened.
The widget is now ready to execute. Double click on the main.kon to execute the Widget or right click and
open with Yahoo! Widget Engine.
This saves you from login into the SAP system and typing the transaction code every time to start the
corresponding SAP Screen.
Screen Shots
Preferences
© 2007 SAP AG 6
Enterprise Widget for SAP Command Field
About window(about.png)
This is my first widget for SAP applications. Please post your comments to [email protected]
Related Content
.
• About Widgets
• Create First Yahoo widget
• Enterprise Widget Foundation
• SAP GUI Basics
© 2007 SAP AG 7
Enterprise Widget for SAP Command Field
© 2007 SAP AG 8