Saturday, June 25, 2011

Oracle Version

Requirement is simple; you want to retrieve/recover the Version Information of your currently installed Oracle Database. Let us discuss most of the ways of doing so in Oracle & SQL Server.
Here are some of the ways to get it:

1) DBA_REGISTRY (Table) 


SELECT comp_id, comp_name, version, status, namespace, control FROM DBA_REGISTRY WHERE comp_name LIKE '%Oracle%' ORDER BY comp_name;

This will give you the db version along with all the other oracle components installed.
Here is the result:
Oracle Database Catalog Views
Oracle Database Packages and Types

2)      V$VERSION (View)


This is the result:
Oracle Database 9G Enterprise Edition Release - 64bi
PL/SQL Release - Production
NLSRTL Version - Production

3)      DBMS_DB_VERSION.VERSION (Procedure)

In case you are using SQL Assistant from Oracle you need the Server output to be set.


In case you are using 3rd Party Vendors for SQL Assistant as Benthic Golden Software you can have an output like this:
Press F10 or select View à DBMS OUTPUT Window
Then run the above code by F7. You will have the DBMS_OUTPUT.PUT_LINE generated output in the following window:

The result of the above query will be as:

4)      DBMS_UTILITY.DB_VERSION (Function)
mydb_version       varchar2 (200);
mydb_compatibility varchar2 (200);
dbms_utility.db_version( mydb_version, mydb_compatibility );
dbms_output.put_line( mydb_version );
dbms_output.put_line( mydb_compatibility );
Here is the result using Benthic Golden Software.

SELECT * FROM database_properties WHERE property_name LIKE '%RDBMS%';

Here is the result:
RDBMS version for NLS parameters

SQL Server Version Information
            1) SERVERPROPERTY()
SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

The result will be something like this:
Developer Edition

SERVERPROPERTY can be used to extract other data as well including COLLATION, BUILD etc.
Refer to the following link for more details:


The result will be something like this:
Microsoft SQL Server 2008 (SP1) - 10.0.2411.0 (X64)   Feb 21 2009
1:08:36   Copyright (c) 1988-2008 Microsoft Corporation Express
Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600)

Refer to the following link for more details:

Saturday, June 11, 2011

Automate SAP R/3 Login with QTP

Test automation for SAP R/3 applications using QTP has become quite an interesting topic and in absolute demand by most companies implementing SAP these days worldwide. As a result, it has become necessary to have, in hand, a ready library of functions which assist to implement QTP scripting for SAP R/3 application quickly and easily.

In this section, we will discuss how to login to SAP R/3 application using QTP and Vbscript when the user credentials are provided through an external spreadsheet. The steps towards building such script would be;
1)       Close any existing excel process running on the system.
2)       Open the spreadsheet where user credentials have been provided and read the 
3)       Read the details like Server name, Client details and Language from the spreadsheet
4)       Login to SAP.
5)       Quit Excel process and close all open objects.

Following sections helps to understand the code used for each steps.
1)       Close any existing excel process running on the system.

The  SystemUtil.CloseProcessByName(“Excel.exe”) method can be used to do this. One needs to note that SystemUtil is a QTP reserved object and can be used only with QTP.

However if one needs to achieve this using vbscript, then the following code may be used. This block of code may also be used to close multiple processes.

myComputer = "."

‘Enter the list of processes in the array. These processes will be closed by the block of code.
myArrayOfTargetProcess = Array("EXCEL.EXE")

Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" &myComputer & "\root\cimv2")
Set CollectionOfProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process")

For Each IndividualProcess in CollectionOfProcesses
 For Each TargetProcess In myArrayOfTargetProcess
                                If LCase(IndividualProcess.Name) = LCase(TargetProcess) Then
                                intReturn = IndividualProcess.Terminate
 End If

2)       Open the spreadsheet where user credentials have been provided and read the   
          credentials.  For this, use the following code block.

    PathForLoginSpreadSheet = <enter the path for login spread sheet>
       'Create an excel application                   
                       Set  myExcelForLogin = CreateObject( "Excel.Application")
                      ‘Open the file in the specified location                     
                      Set ExcelWorkBook = myExcelForLogin.ActiveWorkbook
                      Set ExcelLoginSheet = ExcelWorkBook.Worksheets("Login")

3)       Read the details like Server name, Client details and Language from the spreadsheet

Let’s assume that the data is entered in the second row of the excel sheet. Data for “Server”, “Client”, “User”, “Password” and “Language” are in the 2nd, 3rd, 4th, 5th and 6th column of the spreadsheet respectively.
This code is in continuation with the previous blocks.

With ExcelLoginSheet
                ‘Read the values for “Server”, “Client”, “User”, “Password” and “Language”
                SAPR3ServerName = .Cells(intRow,2)
                SAPR3Client = .Cells(intRow,3)
                UserLanguage = .Cells(intRow,6)
End With                    
4)      Login to SAP.

Use the statement below:

SAPGuiUtil.AutoLogon SAPR3ServerName, SAPR3Client, SAPUserName, SAPPassword, UserLanguage

Please note that SAPGuiUtil.AutoLogon is a QTP reserved keyword.

5)      Quit all created objects.

                Set ExcelWorkBook =Nothing
    Set ExcelLoginSheet=Nothing
                Set myExcelForLogin =Nothing

Friday, June 10, 2011

Automatic Replenishment ~ Warehouse Management (WM) in SAP

This article is intended for SAP functional consultants to configure automatic replenishment of a particular storage type for transfer orders. Whenever the stock in a bin falls below the MIN value (predefined minimum quantity), it will trigger replenishment or transfer request (TR) which will in turn get converted into a transfer order, so that the workers in the warehouse can carry out the actual physical transfer of stock.
We have a provision of assigning a definite storage type from where the stock will be picked up for replenishment.  

Step 1:
Material Master has to be maintained with Warehouse Views.
Under Warehouse Mgmt 2 Storage bin, Maximum bin Quantity, Minimum bin Quantity and Replenishment Quantity has to be maintained.

Configuration Changes:
Step 2:
Movement type 320 is copied from existing movement type 319 under Logistics Execution ->Warehouse management->Activities->Transfers->Define Movement Types.

Movement type 320 is configured as the following and saved. We can define SRC for the Source storage bin so that no interim storage bin is taken into consideration.

Step 3:
Replenishment Control is defined for the storage type under Logistics Execution ->Warehouse management->Activities->Transfers-> Define Replenishment Control for Storage Type and saved.

Dedicated printers can be set up under Logistics Execution ->Warehouse management->Activities->Define Print Control for a particular storage type and saved

Step 4:
One job needs to be scheduled for each report. The report jobnames are randomly defined: