Showing posts with label SAP. Show all posts
Showing posts with label SAP. Show all posts

Monday, March 02, 2009

UNIX Crontab

Cron is used to execute tasks as background job at the specific time in UNIX system. Crontab (Cron Table) is a file which contains the schedule of cron entries to be run at specified times.

1. Crontab Restriction
You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow. If that file does not exist, you can use crontab if your name does not appear in the file /usr/lib/cron/cron.deny. If only cron.deny exists and is empty, all users can use crontab. If neither file exists, only the root user can use crontab. The allow/deny files consist of one user name per line

2. Crontab Commands
export EDITOR=vi to specify a editor to open crontab file.

crontab -e Edit your crontab file, or create one if it doesn't already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems).

3. Crontab File
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval



* in the value field above means all legal values as in braces for that column.
The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).

4. Crontab Example
A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.

30 18 * * * rm /home/someuser/tmp/*


Changing the parameter values as below will cause this command to run at different time schedule below :



If you inadvertently enter the crontab command with no argument(s), do not attempt to get out with Control-d. This removes all entries in your crontab file. Instead, exit with Control-c.

5. Crontab Environment
cron invokes the command from the user's HOME directory with the shell, (/usr/bin/sh).
cron supplies a default environment for every shell, defining:
HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh

Users who desire to have their .profile executed must explicitly do so in the crontab entry or in a script called by the entry

6. Disable Mail
By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .

>/dev/null 2>&1

7. Generate log file
To collect the cron execution execution log in a file :

30 18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log

Wednesday, February 25, 2009

Assign New Print Format to Device Type

After you create a new print format, you can assign it to the device type. This step will assure you that when you select the device type for printing, the new created-format can be selected.
1. Run transaction code SPAD and select Full Administration. Select Device Types tab.
2. Enter the name of Device Types e.g. SAPWIN (for LOCL). Select Display button.
3. Change the Display mode to Change mode.
4. Choose Formats. Then choose change and create.
5. Enter the name of print format you just created.
6. In the Format tab select printer initialization, Reset After Exit, End of Page, and End of Line. In the Printer initialization enter below command:
# SAPWIN data stream
\e%SAPWIN%
# Landscape-Mode
\ePL
# Schrift 5 Punkt einstellen.
\eS75X
(this line must be adjust to meet the number of columns you have defined before. 75 for 350, 130 for 200, 200 fro 132, and 100 fro 255 column).
#8,5 lpi
\el8.5;
# output complete line with one call (do not use for proportional fonts)
\eOa1

7. In the Reset After Exit screen, enter commands:
# SAPWIN X_PAPER
# reset

8. In the End of Page screen, enter command:
\f
9. And in the End of Line screen, enter command:
\n
10. Save your entries.

Creating New Print Format on SAP

For Printing, SAP uses default format that specify number of rows or lines that can be printed and how many characters can be printed in one lines. If you select list format X_65_80, it means you can print 65 lines and 80 characters in one line.

If you want to define your own format, you can follow guide below.
1. Call transaction SPAD and select Full Administration. Select Device Types tab.
2. In the Format Types, select Display.
3. Change Display mode to Change mode and select a Default format, let say X_65_255.
4. Creating new format using template or just pressing F5.
5. In the Format Type field, enter the name of format type you want. Use format Y_LL_CC or Z_LL_CC. Where LL is the number of lines and CC is the number of characters.
6. Enter L in the Type field.
7. Select Any in the Page Format Field.
8. Enter the number of Rows and Columns.
9. You can select list driver.
10. Choose List Driver Attributes to determine the layout attribute.On the next screen you can determine the orientation of the output and define the margins.Note that the page format you selected (L or S) also exists with the orientation that you set for the format. If this is not the case, the system displays an error message.
11. Save your entry.

You have to assign the new format to the device type to make the process complete.

Saturday, January 31, 2009

SAP - Configuring Load Balancing

In SAP if you have more than 1 application server, ex. central instance and dialog instance, load balancing can be applied. SAP has given this function using transaction code SMLG. Load balancing can be made by defined logon group. Logon group can be grouped based on user group. If you have several user groups (FI , HR, MM user groups, for example) you can arrange them so the FI and MM user will be assigned to application server A and the HR user will be assigned to application server B. This method will give a chance to tune your application server properly and will leave you free to make memory and buffer adjustment.

To get the more benefit from this setup, you have to do the buffer hit ratio analysis/DB table and index access analysis (per user group).

From application server side, below the steps you can follow to create a new logon group:
1. Run transaction code SMLG
2. Create a new assignment and specify the desire name of the logon group name. Enter the desired instance that belongs to this logon group.
3. Repeat the last step until you have entered the all instance that belongs to the logon group.
4. Save your changes.

From user side, you can follow below step to ensure that you can connect using load balancing:
1. Open file services under drive:\windows\system32\drivers\etc
2. Add new service in the last row with the format
sapms(SID) port_number (3299)/tcp
3. Activate the new service by enter this command in cmd
services restart
4. Open your SAP GUI and create new item. Select Group/Server connection in the connection type. Enter your message server name or the IP address and system ID.
5. In the Group/Server field select your logon group.
6. Save the changes and try to connect to your message server.

If your logon group does not appear or can not make a connection to the application server, you have to check your entered-service in the file services. If everything is ok, you can do some tricks as describe below:
1. Give enter after you enter the service name
2. If trick number 1 does not success, you can create a new file in same directory with sapgui.ini and name it as sapmsg.ini. You type this command in the file:
SID = host name on which your message server is running

Friday, January 30, 2009

SAP - Client Copy

Why do we need client copy? and what the difference between client copy and database refresh? There are so many reason for you to performing SAP client copy, below are the some of them:
1. You have installed the new SAP system on the box and you want to make another client besides the standard ones.
2. You want to make a testing using data from the production. So you have to copy the production data to Q/A system.

When the client copy is performed, actually we erase the old data in the target client and fill the database with data from the source target. Client copy only copy client-dependent tables. This activity will effect only one client in a instance (system). Different with database refresh, where you delete all the table from 1 instance and fill it with all tables from the source.

Client copy in SAP can be done locally or remotely. Locally if you do it from one client to another client in one instance. On the other hand, remote client copy is done if you want to copy a client to another client in the different instance.

If you want to do the remote client copy, you have to make sure that the Support Package level between the source and target are same to avoid the inconsistency database. We also have to check the database structure from each standard table to ensure that nothing differences occur in the source and target system. But the important thing you have to do is check the space availability (please read OSS note 0118823)

If you want to make a fresh client, you can follow steps below (local client copy):
1. Run transaction code SCC4 and create new client.
2. Edit the value of parameter login/no_automatic_sap_star_user to 0 (zero)
3. Activate the profile.
4. Login to the new client using username SAP* and default password PASS
5. Run transaction code SCCL. Select profile, source client, and target client.
6. Perform test run to know that we will go well
7. Run the actual copy if the test run go well (no error)
8. Do not forget to always check the database space, especially saparch directory.

Remote client copy can be done as the steps below:
1. Run transaction code SCC9 from target client.
2. Select profile and source destination (please maintain in SM59)
3. Perform test run to know that we will go well
4. Run the actual copy if the test run go well (no error)
5. Do not forget to always check the database space, especially saparch directory

When the copy has been performed successfully, do the next step as describe in OSS note 8730 (for validation).

note:
-----
1. Sometimes you need to check parameter abap/buffersize. Please increase its value to avoid error no pxa storage available.
2. It's not recommended to perform remote client copy for a large database. Preferably choose client export/import.

Monday, December 01, 2008

Installing SNC SAP Router as NT Service

SAP router is a program that acts as a mediator in the network between SAP system and access is controlled before data is sent further along the communication path. Connections can also be established between SAP systems over several SAProuters. You can then secure connections between adjacent SAProuters using SNC.

SNC is used to make network connections using the Internet, in particular WAN connections, secure. It provides reliable authentication as well as encryption of the data to be transferred.SAProuter allows SNC connections to be set up. The route permission table can be used to specify precisely whether SNC connections are allowed, and if so, which ones.



Before you start the installation, download the necessary software component from SAP Service Marketplace. Besides, you have to request a certification in https://service.sap.com/saprouter-sncadd.

Following steps will describe how to install SAPRouter in your system.
1. Set the environment variables of SNC_LIB and SECUDIR
SNC_LIB = drive:\path_to_libsecude\ntintel\sapcrypto.dll
SECUDIR = directory_of_saprouter
2. Generate the certificate request using command
sapgenpse get_pse -v -r certreq -p local.pse “Distinguished Name"
3. You will be asked twice for a PIN here. Please choose a PIN and document it, you have to enter it identically both times. Then you will have to enter the same PIN every time you want to use this PSE.
4. Display the output file "certreq" and with copy & paste (including the BEGIN and END statement) insert the certificate request into the text area of the same form on the SAP Service Marketplace from which you copied the Distinguished Name.
5. In response you will receive the certificate signed by the CA in the Service Marketplace. Copy&paste the text to a new local file named "srcert", which must be created in the same directory as the sapgenpse executable.
6. With this in turn you can install the certificate in your saprouter using command:
sapgenpse import_own_cert -c srcert -p local.pse
7. Now you will have to create the credentials for the SAProuter with the same program by calling: sapgenpse seclogin -p local.pse
8. Check if the certificate has been imported successfully with the following command:
sapgenpse get_my_name -v -n Issuer
The name of the Issuer should be:
CN=SAProuter CA, OU=SAProuter, O=SAP, C=DE
9. Check if the certificate has a valid date with the following command:
sapgenpse get_my_name


Check your saprouttab file. It contains routing table from SAPROUTER to OSS . Add manually connection as many as you need. for more information you can go to http://help.sap.com/saphelp_nwmobile71/helpdata/en/65/8d09ab5c7e46028f633bb01a09b380/content.htm

After installing SAPRouter, you have to install the SNC as a NT service.
1. Minimum saprouter version 30
2. Create the subdirectory saprouter in the directory drive:\usr\sap
3. Copy the executables saprouter.exe and niping.exe to the directory you have just created
4. If the Saprouter has already been entered as a service with srvany.exe, the
definition of the service from the registry (path: HKLM -> System -> CurrentControlSet -> Services -> SAPRouter) should first be removed and then the machine should be rebooted.
5. To define new service. Enter this command :
ntscmgr install saprouter -b \saprouter.exe -p "service -r -W 60000 -R path\saprouttab -K ^p:^"
6. Edit the string in the registry under :
MyComputer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\saprouter\ImagePath –> Change both ^ to “
7. Additionally you'll have to do the following steps to make SAPCRYPTOLIB credentials available to a process that runs as an NT service. Run the command:
sapgenpse seclogin -p local.pse
8. Proceed as follows after the installation to maintain the general attributes of the service : Go to 'Control Panel -> Services: SAPRouter -> Button: Startup',set the startup type to 'Automatic' and enter the user .The SAPRouter should NOT run under the system account

Thursday, November 20, 2008

Maintain SAPRouter

Sometimes you face problem with your SAPRouter hence you can not connect to OSS. Please follow steps below to diagnose what really happen to your SAPRouter.

1. Ping sapserv2 (194.39.131.34) from your SAProuter. If you get time out error, it means your saprouter can not connect to the OSS server.
2. Please check your saprouttab file. This file containts the perrmission and deny connection from or to sapserv2. You edit this file and add manually your connection if you need it.

If your SAPRouter is a SNC connection, please proceed additional steps below to check the validity of SNC certificate.
1. Run command sapgenpse
2. Run command sapgenpse get_my_name
3. Run command sapgenpse get_my_name -v -n Issuer
4. Run command sapgenpse seclogin –l
5. Run command sapgenpse get_pse -v -r certreq -p local.pse "CN=hostname, OU=unique number, OU=SAProuter, O=SAP, C=DE"
6. Run command sapgenpse import_own_cert -c srcert -p local.pse
7. Run command sapgenpse seclogin -p local.pse
8. Run command sapgenpse get_my_name -v -n Issuer
9. Run command sapgenpse get_my_name

Wednesday, November 12, 2008

SAP Router Installation

On this posting, I’ll try to explain about how to install and configure SAProuter and also how to set your SAProuter to match with Secure Network Communication (SNC) just SAP want to if they have to support you.

The first thing you need to do, is to send a customer message to SAP Support(component XX-SER-NET-OSS-NEW) and tell them to register the hostname and IP of your new SAProuter.

You have to register it with a official IP address (no internal IPs allowed), but it’s allowed to use NAT in the firewall/router.

After you’ve received a confirmation from SAP that your SAProuter has been registered, you are ready to configure your SAProuter.

If your SAProuter directory is C:\usr\sap\saprouter, below the steps you can follow.

Note: You will be asked for a PIN code. Just pick your own 4 numbers, but
you’ll have to use the same PIN every time you’re asked to enter one.

1. Set 2 environment variables: SECUDIR and SNC_LIB according to the
guide you’ve downloaded.

2. Download the SAP Crypto Library and unpack it into C:\usr\sap\saprouter

3. To generate a certificate request, run the command:
sapgenpse get_pse -v -r C:\usr\sap\saprouter\certreq -p C:\usr\sap\saprouter\local.pse “”

4. Then you have to follow the guide and request the certificate from
http://service.sap.com/tcs -> Download Area -> SAProuter Certificate

5. Create a file C:\usr\sap\saprouter\srcert and copy the requested
certificate into this file. The run the command:
sapgenpse import_own_cert -c C:\usr\sap\saprouter\srcert -p C:\usr\sap\saprouter\local.pse

6. To generate credentials for the user that’s running the SAProuter service, run command:
sapgenpse seclogin -p C:\usr\sap\saprouter\local.pse -O
(this will create the file “cred_v2″)

7. Check the configuration by running command:
sapgenpse get_my_name -v -n Issuer
(This should always give the answer “CN=SAProuter CA, OU=SAProuter,
O=SAP, C=DE”)

8. Create SAProuter service on Windows with the command:
ntscmgr install SAProuter -b C:\usr\sap\saprouter\saprouter.exe -p
“service -r -R C:\usr\sap\saprouter\saprouttab -W 60000 -K
^p:^”

9. Edit the Windows Registry key as follows:
MyComputer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SAProute
r\ImagePath –> Change both ^ to “

10. Start the SAProuter service

11. Enter the required parameters in OSS1 -> Technical Settings

———————————————————————————

Installation on UNIX
———————————————-

1. Create the subdirectory saprouter in the directory /usr/sap/.

2. Get the latest version of the SAProuter from the SAP Service Marketplace (service.sap.com/patches). Choose Support Packages and Patches ® Entry by Application Group ® Additional Components ® SAPROUTER. The SAProuter is in packet saprouter*.SAR; the program niping is also in this packet. Copy programs saprouter and niping to the newly created directory /usr/sap/saprouter.

If you cannot copy the programs from SAP Service Marketplace, you can copy a version (may be obsolete) from your directory /usr/sap//SYS/exe/run.

3. (Optional) If you want to start the SAProuter on the same computer used for an SAP instance, insert the following line into file /usr/sap//SYS/exe/run/startsap:

#

# Start saprouter

#

SRDIR=/usr/sap/saprouter

if [ -f $SRDIR/saprouter ] ; then

echo “\nStarting saprouter Daemon “ | tee -a $LOGFILE

echo “—————————-“ | tee -a $LOGFILE

$SRDIR/saprouter -r -R $SRDIR/saprouttab \

| tee -a $LOGFILE &

fi

Insert the lines before the commands to start the SAP instance.

Normally the SAProuter runs on a different computer. If this is so, this step is omitted and you start the SAProuter as described in Starting the SAProuter.

4. Maintain the route permission table in directory /usr/sap/saprouter. If you want to keep it in another directory or under a name other than saprouttab, you must specify this with the SAProuter option -R (see Option R ).

This should help in SAP Router configuration and installation. Step forward, guys.