‎2006 Jun 05 3:55 PM
Guy's
i created BDC for tcode:ko01 ,it was working
fine ,but recently they discovered very strange issue
,when they run this BDC in background value of one
of the field which hold currency value get changed
for example 23.78 will become 23,78 and this result
in program failure ,while if they run program
in foreground ,it remain same,it's strange as issue
is only in one client ,it's working fine in other client
of same server,i check user profile also,but no use.
pls help as this is urgent
‎2006 Jun 05 4:02 PM
hi
u need to ssee usr01 tabl to find the default deciaml notation
select single dcpfm
from usr01
into (v_decformat)
where bname = sy-uname.
case v_decformat.
when 'X'.
when ' '.
when 'Y'.
endcase.
handle the decimals as per ur req.
‎2006 Jun 05 4:03 PM
Sanju,
Can you check this? While populating the currency value in your BDC tab, are you using this command?
WRITE <value> to BCDTAB-fval
CURRENCY <currency field WAERS>.
‎2006 Jun 05 4:31 PM
‎2006 Jun 05 4:40 PM
guy's
issue is on what basis currency value got
changed to comma in background but not in foreground
‎2006 Jun 05 4:53 PM
guy's
i got the hint ,system is changing currency value
based on profile given while executing program in background ,now question is how to change decimal
value into value specified as per user profile,
i want all the value of my internal table for currency field to get changed based on user profile, like
select dcpfm from usr01 where bname = 'ZZBATCH'
IF dcpfm = ''
i want all my value of internal table to get changed
to this profile
‎2006 Jun 05 4:54 PM
Sanju,
Use that WRITE coomand then instead of just assigning with '=' sign. That will solve your problem (will take care of the decimal separator thing itself).
‎2006 Jun 05 4:56 PM
Have you tried WRITE? Is it not working in background? As far as I know it should take care of the decimal format based on user-profile.
‎2006 Jun 05 4:10 PM
Hi Sanju,
Currency and Date formats are displayed based on the user record. tcode SU01.
So, if you dont change the format in your BDC, it will always problem with the default formats. So, try to use SAP internal formats rather than external display format.
Regards,
Ram
‎2006 Jun 05 4:57 PM
Hi Sanju,
You always face such issues in BDC programs hence its better to take care of user profile issues.
Please take a reference from the following piece of code to determine the profile of the user.
FORM CONVERT-DEC.
tables : usr01.
data : field_num(10) type c value '123,456',
VAR_DCPFM type usr01-dcpfm.
SELECT SINGLE DCPFM FROM USR01
INTO VAR_DCPFM WHERE BNAME EQ SY-UNAME.
IF VAR_DCPFM EQ 'X'.
REPLACE ',' WITH '' INTO FIELD_NUM .
condense FIELD_NUM no-gaps.
ELSEIF VAR_DCPFM EQ ''.
REPLACE '.' WITH '' INto FIELD_NUM.
TRANSLATE FIELD_NUM USING ',.'.
ELSEIF VAR_DCPFM EQ 'Y'.
TRANSLATE FIELD_NUM USING ',.'.
ENDIF.
Cheers,
Vikram
Pls reward for helpful replies!!
‎2006 Jun 05 5:17 PM
HI Vikram
that was a nice program but try this thing in your system
report zuser01_curr .
tables : usr01.
data : field_num(20) type c value '123456333.556',
var_dcpfm type usr01-dcpfm.
select single dcpfm from usr01
into var_dcpfm where bname eq sy-uname.
if var_dcpfm eq 'X'.
replace ',' with '' into field_num .
condense field_num no-gaps.
elseif var_dcpfm eq ''.
replace '.' with '' into field_num.
translate field_num using ',.'.
elseif var_dcpfm eq 'Y'.
translate field_num using ',.'.
endif.
write field_num.
copy value of filed_num to coas-user4 ,check some of the
cases your program will not help me,i hope u got what
exactly i am trying to tell u
‎2006 Jun 05 5:21 PM
Sanju,
I am interested to know if WRITE doesnot solve your problem. Did you give it a try?
‎2006 Jun 05 5:24 PM
HI vikram
sorry your program work's fine , i kept decimal
to size of 3 ,u got ur point
‎2006 Jun 05 5:51 PM
Hi Sanju,
There is an issue of 3 decimal places. Its hould be kept as 2 to retrieve data from COAS table based on field USER4.
What you can do is to move the your field into a another field of the data type USER4.
e.g.
data : field_num(20) type c value '123456333.556',
VAR_DCPFM type usr01-dcpfm,
field_num1 like coas-user4.
SELECT SINGLE DCPFM FROM USR01
INTO VAR_DCPFM WHERE BNAME EQ SY-UNAME.
IF VAR_DCPFM EQ 'X'.
REPLACE ',' WITH '' INTO FIELD_NUM .
condense FIELD_NUM no-gaps.
TRANSLATE FIELD_NUM USING ','.
ELSEIF VAR_DCPFM EQ ''.
REPLACE '.' WITH '' INto FIELD_NUM.
TRANSLATE FIELD_NUM USING '.'.
TRANSLATE FIELD_NUM USING ',.'.
ELSEIF VAR_DCPFM EQ 'Y'.
TRANSLATE FIELD_NUM USING ',.'.
ENDIF.
field_num1 = field_num.
write : FIELD_NUM1.
Cheers,
Vikram
Pls reward for helpful replies!!
‎2006 Jun 05 7:42 PM
Hi Sanju,
I am seeing that you have assigned and then unassigned the points. Please do let me know if there is any concern. Tx.
Cheers,
Vikram
Please reward for helpful replies!!
‎2006 Jun 07 10:36 AM
hi vikram
program work fine,but i will tell u the cases where
it got failed .will send u test cases immediatly,
pls don't take it wrong,i don't won't to close this
thread ,until and unless my issue is not solved