Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

data type issue

Former Member
0 Kudos

Hi,

This might sound very silly to u.but i am finding it a difficult. I have a field which is to enter interest rate in percentage.it might be a whole number or it might be a decimal number.i have tried giving this type using data elements with curr,quan etc...how do i proceed?

5 REPLIES 5

Former Member
0 Kudos

hii

it is not wrong to ask such questions...

coming to the answer...

TRANSLATE

Variants

1. TRANSLATE c TO UPPER CASE.

2. TRANSLATE c TO LOWER CASE.

3. TRANSLATE c USING c1.

4. TRANSLATE c FROM CODE PAGE g1 TO CODE PAGE g2.

5. TRANSLATE c FROM NUMBER FORMAT n1 TO NUMBER FORMAT n2.

Variant 1

TRANSLATE c TO UPPER CASE.

Variant 2

TRANSLATE c TO LOWER CASE.

Effect

In the field c , converts all lower case letters to upper case or all upper case letters to lower case, as specified.

Example

DATA LETTERS(3).

MOVE 'abc' TO LETTERS.

TRANSLATE LETTERS TO UPPER CASE.

The field LETTERS now contains 'ABC' .

Variant 3

TRANSLATE c USING c1.

Effect

Replaces the letters in the field c according to the contents of c1 .

If a character in c also exists in c1, it is replaced by the letter that f o l l o w s it in c1. If a character from c is not found in c1, it remains unchanged.

Example

DATA: LETTERS(10) VALUE 'abcX',

CHANGE(6) VALUE 'aXBY'.

TRANSLATE LETTERS USING CHANGE.

The field LETTERS now contains 'XbcX' .

Variant 4

TRANSLATE c ...FROM CODE PAGE g1 ...TO CODE PAGE g2.

TRANSLATE F TO CODE PAGE G2.

TRANSLATE F FROM CODE PAGE G1.

Effect

Performs a character code conversion in the field F . To achieve this, the SAP character code is determined from the conversion table G1 and a new character code derived from G2 . You can use the Transaction SPAD to maintain the conversion tables TCP00 - TCP02 .

Example

DATA F(72).

TRANSLATE F FROM CODE PAGE '1110' TO CODE PAGE '0100'.

translates the contents of F from the HP character set to EBCDIC ( IBM 274).

Note

Type I , P , F and X fields remain unchanged. Field strings and work areas of internal tables are converted to the correct type for each individual field. At present, table work areas (as defined in TABLES ... ) are not treated according to type, but are converted as a whole. If necessary, declare a field string with INCLUDE STRUCTURE and then perform a conversion.

Variant 5

TRANSLATE c ...FROM NUMBER FORMAT n1 ...TO NUMBER FORMAT n2.

TRANSLATE F TO NUMBER FORMAT N1.

TRANSLATE F FROM NUMBER FORMAT N1.

Effect

Performs a number format conversion in the field F . The number formats supported at present are '0000' ( HP , SINIX , IBM ) and '0101' ( DEC alpha OSF ). Any attempt to enter formats other than these results in a runtime error. If you omit FROM NUMBER FORMAT or TO NUMBER FORMAT , the system number format is used for the omitted part.

Example

DATA: F TYPE F,

HEX (2) TYPE X,

NFORM LIKE TCP00-CPCODEPAGE.

...

  • In /ARCHIV was stored by another platform from HEX and F.

  • HEX contains the valid number format and can be read on all

  • platforms.

READ DATASET '/ARCHIV' INTO HEX.

READ DATASET '/ARCHIV INTO F.

NFORM = HEX. "Conversion of machine-independent HEX to NUMC(4)

TRANSLATE F FROM NUMBER FORMAT NFORM.

Effect

Converts the contents of F from the format NFORM of a platform to the system format.

Note

Type I and F fields are converted. Field strings and work areas of internal tables are converted to the correct type for each individual field. Table work areas (as defined with TABLES ... ) are treated as type C at present and are not converted. If necessary, declare a field string with INCLUDE STRUCTURE and then perform a conversion.

In the interests of storing additional information for archiving purposes, you can use the function module SYSTEM_FORMAT to display the system code page and system number format.

Note

Performance

Converting lower case letters to upper case letters or upper case letters to lower case letters in a 10-byte long character field takes approx. 7 msn (standardized microseconds).

Replacing two letters in a 10-byte long field with the variant ... c USING c1 ... takes approx. 9 msn.

Note

Runtime errors

TRANSLATE_WRONG_NUM_FORMAT : Invalid number format.

hope this hepls you...

Former Member
0 Kudos

Hi,

try it with

...type PRZ31

or

....type ABWERT_PRZ

Regards

Nicole

Former Member
0 Kudos

try with DEC data Type where length is 5 with 2 decimal places

Former Member
0 Kudos

Hi,

Try with the domain type WERTV6

regards,

Surinder

Former Member
0 Kudos

try this...

DDPERCENT data elt