Tuesday, February 27, 2007

GVim: changing DOS style end of line to UNIX, or vise-versa

How to use GVim to change DOS style end of line to UNIX, or vise-versa?
To save the file in DOS style:
:set fileformat=dos
:w
To save the file in UNIX style:
:set fileformat=unix
:w
Please refer to here.

Turn off variable substitution in SQL*Plus

I got a phone call from one of my friends in Montreal ask me how to turn off the variable substitution in SQL*Plus, here is how it should be done:
SET DEFINE OFF
* You can prevent variable substigution of ampersand character(&) in SQL script, when running it in SQL*Plus.

Monday, February 26, 2007

Find the list of SAP Transaction codes

There are three ways to find out the list of SAP transaction codes:
  1. SE11; TSTC table or TSTCT table.
  2. SM01
  3. SE93
Please refer to here.

Friday, February 23, 2007

How to change SAP default client

To change default client for SAP system, I found the following way:
In file explorer: open the instance profile, for example: D:\usr\sap\C11\SYS\profile\C11_DVEBMGS00_win2k3
add login/system_client=800.
Stop and restart the SAP system.

NOTE: directly edit the file is not sugguested by SAP, the correct way to change a parameter is to use Tools->CCMS ->Configuration->Profile Maintenance.
  1. RZ10
  2. Import the profiles; Utilities->Import profiles->Of active servers
  3. Extended maintenance the profile; Change
  4. Create new parameter or edit existing parameter
  5. Save, activate, and restart the server.
References:
Some SAP parameters.
How to change SAP default client?

Thursday, February 22, 2007

Oracle CharacterSet

1. What is impact of NLS_LANG variable setting of user session while import/export the data ?

On export, the data will be converted from the database character set to the character set specified by NLS_LANG. In import, the database will assume that the data is in the character set specified by NLS_LANG and use that value to perform the conversion to the database character set if the two values to not match.

2. Why do we need to set this NLS_LANG user session variable before export/import ?

If your database character set is the same as your OS, you don't necessarily have to set NLS_LANG. For instance, if you have a US7ASCII db, and your OS locale is set to AMERICA_AMERICAN.US7ASCII, there won't be any problems. The only time it's really important to set this is when the db and OS settings don't match.

3.If NLS_LANG variable is not set (doesnot have any value) what would happen ?

If your database character set doesn't match your OS, the data could be garbled because the db will incorrectly transcode the data on import/export.

4. If I have to set NLS_LANG varible, what should I set it to?

Depends on what your database character set is set to (see below).

5. How can I see the characterset of my database?

select * from nls_database_parameters and look for the value set for the NLS_CHARACTERSET parameter. Don't get confused by the NLS_NCHAR_CHARACTERSET, that's for NCHAR datatypes.

So, for instance, if your NLS_CHARACTERSET value is set to UTF8, you would set NLS_LANG to .UTF8 (the dot is important because that's actually shorthand for territory_language.characterset, or language_territory.characterset, I can never remember which comes first. In any case, use the dot). For example:

setenv NLS_LANG .UTF8


6. Where can I get more info about database charaterset and What are the valid values for database characterset and NLS_LANG varibale ?

It's all in the Oracle documentation.

Monday, February 19, 2007

Copy table structure and content (data)

I just started to read the book 'Sams Teach Yourself ABAP/4® in 21 Days', the first problem I ran into is how to copy table structure and content(data) from a standard table to a z_table. I found partial of the answer here:
How can I copy a standard table to make my own z_table. Go to transaction SE11. Then there is one option to copy table. Press that button. Enter the name of the standard table and in the Target table enter Z table name and press enter.
However, that is only partial answer to the question, it only copied the table structure, but without the content-data of the table, to copy the content(data), you may need to write small ABAP program to achieve the goal:

Example:
REPORT Z_COPYTABLEDATA .
tables lfa1.
select * from lfa1.
insert ztxlfa1 from lfa1.
endselect.
write 'data copied.'.

Friday, February 09, 2007

.Net form ComboBox SelectedIndex = -1 seems does not work.

I ran into a problem in programming ComboBox on .Net Windows Form, we were clearing the ComboBox and then set the ComboBox.SelectedIndex = -1, which supposed to deselect the SelectedItem. However, the ComboBox still showing the old SelectedItem.

I found a workaround, first set the ComboBox.SelectedIndex = -1 before you call ComboBox.Items.Clear()

Monday, February 05, 2007

How to add ODBC DSN via command line?

Try out odbcconf.exe.
Here is the further information.