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: 

handling currency and quantity fields in BDC

Former Member
0 Kudos

Hi all,

I am running BDC with currency fields,

my flat file is having currnecy values as 1,2 1,3 1,5 ....etc.

if i change my user settings to dot delimeter values(1.2 1.3 1.5......etc)

it is giving error during the BDC running .

Can any one help me in this please.

I tried with character declarations and all ,but it is not working

Thanks and regards,

gopal

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

you have to declare character variable (same length like target field on the screen) and:

WRITE value TO char_variable.

the WRITE ... TO ... will always pass the data acc. to current user settings, then you hand over the character variable to the bdc table

5 REPLIES 5

JozsefSzikszai
Active Contributor
0 Kudos

you have to declare character variable (same length like target field on the screen) and:

WRITE value TO char_variable.

the WRITE ... TO ... will always pass the data acc. to current user settings, then you hand over the character variable to the bdc table

0 Kudos

hi

Thanks for the reply,

i declared my currency field as CHAR12 ,if i declare with data element ,it is not uploading the value,so i used char12 .

if i use write to statement to move one character fields to another character field,it is not the way i think.

please can u give me any other solution

0 Kudos

I though the original values are in type p variables (and you move from the type p to the type c one). In this case let's start from the beginning:

From where does the data come?

In which format is it?

Alternatively you can copy your code here (not the whole, if it is too long, only the relevant part.)

0 Kudos

Thanks for the reply

TYPES : BEGIN OF GT_FILE,

KUNNR TYPE KUNNR, "Customer

VKORG TYPE VKORG, "Sales Organization

EDS TYPE /NFM/EDS, "Coverage Key

ZTYPE TYPE ZCOVERTYPE, "Coverage Type

ZDESCRIPTION TYPE ZCOVERDESCRIPTION, "Coverage Description

DATAB TYPE DATAB, "Valid From Date

UKURS TYPE P DECIMALS 5, "Exchange Ra

Before my UKURS was CHAR12

i changed to pack decimals as shown below.

UKURS fields i took as P DECIMAL 5 and am using

WRTIE UKURS to LV_UKURS.

LV_UKURS is the CHAR 12 field.

in flat file i am ghetting decimal separator as ' ,' (EX : 1.234,00000)

my user settings are like (1,234.00000)

but my code is not working for this user settings (My CODE SHOULD HAVE TO WORK FOR ANY TYPE OF USER SETTINGS )

Edited by: gopaludu p on Nov 20, 2008 3:44 AM

0 Kudos

>

> Before my UKURS was CHAR12

> i changed to pack decimals as shown below.

>

> UKURS fields i took as P DECIMAL 5 and am using

>

> WRTIE UKURS to LV_UKURS.

>

> LV_UKURS is the CHAR 12 field.

>

> in flat file i am ghetting decimal separator as ' ,' (EX : 1.234,00000)

> my user settings are like (1,234.00000)

>

> but my code is not working for this user settings (My CODE SHOULD HAVE TO WORK FOR ANY TYPE OF USER SETTINGS )

From flat file the data directly goes to internal table gt_file? In this case I would leave that field (ukurs) as character type.

Data in flat file always looks like this? (EX : 1.234,00000), because SAP internally stores that as 1234.00000. This means I would remove the dots as thousand separator, than would replace the coma (decimal) with dot (to look like SAP format), than move to a field which is type p, then move to char field again (with WRITE TO), something like:

DATA : lv_number TYPE p DECIMALS 5.

TRANSLATE ukurs USING '. '. "there is a space after the dot
CONDENSE ukurs NO-GAPS.
TRANSLATE ukurs USING ',.'.
lv_number = ukurs.
MOVE lv_number TO lv_char.