‎2007 Nov 26 1:54 PM
hi,
in internal table i_filedata one field is type c, that field is 4 amount.
ex. amount(27),
when it is assigned to a varible v_amt type bapiwrbtr, dump occurs.
v_amt = amount.
hw to rectify that type mismatch.
amount should be c or t or string or d.
thanks in advance,
‎2007 Nov 26 1:55 PM
Hi for amount type declare the type as PACK
ex:
data: v_amt type P dec 2.
Regs
Manas.
‎2007 Nov 26 2:29 PM
Hi i wrote this code..
it is working fine. i checked in ECC5 as well as ECC6
data:
amount(27).
data: v_amt type bapiwrbtr.
amount = 123.
v_amt = amount.
write: v_amt.
‎2007 Nov 27 4:00 AM
hi
ur coding is is wrking fine when we give numbers, but if u give alphanumeric, then dump occurs. If the enduser wrongly type amount as alphanumeric, that error should be handled, hw to handle that error.
thanks
‎2007 Nov 27 4:11 AM
Than change your field declaration for AMOUNT to type P.
PARAMETERS: P_AMT TYPE BSEG-DMBTR.
Regards,
Naimesh Patel
‎2007 Nov 27 4:26 AM
hi
amount should be in type C or D or T or N or string.
since amount is taken from flatfile.
thanks
‎2007 Nov 27 4:33 AM
You can do it like this:
DATA: C_AMOUNT(30),
P_AMOUNT TYPE BSEG-DMBTR.
C_VALUE = '-12,345,678.90'.
replace ',' in c_value with ' '.
replace ',' in c_value with ' '.
replace ',' in c_value with ' '.
replace ',' in c_value with ' '.
condense c_value NO-GAPS.
IF C_VALUE CA SY-ABCDE.
message e398(00) with 'Error in data'.
ENDIF.
move c_vALUE to P_AMOUNT.Regards,
Naimesh Patel
‎2007 Nov 27 4:40 AM
Hi,
Try this code and change it according to your requirement
DATA digit(11) VALUE ' 0123456789'.
PARAMETERS: text(16) DEFAULT 'A20,000.00'.
DATA c_text(16).
DATA amount TYPE p DECIMALS 2.
DATA n TYPE n.
DATA i TYPE i.
c_text = text.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
MOVE c_text TO amount.
ENDCATCH.
IF sy-subrc EQ 1.
CALL FUNCTION 'PREPARE_STRING'
EXPORTING
i_valid_chars = digit
i_xvalid_check = 'X'
i_xchar_repl = 'X'
i_xtoupper = 'X'
CHANGING
c_string = c_text.
CONDENSE c_text NO-GAPS.
DESCRIBE FIELD amount DECIMALS n.
i = 10 ** n.
amount = c_text / i.
ENDIF.
WRITE:/ text, 50 amount.
Regards,
AMit
‎2007 Nov 27 5:46 AM