SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Как мне преобразовать число из символьной в числовую перемен



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
dodge
Участник
Участник



Joined: 25 Sep 2007
Posts: 5

PostPosted: Thu Oct 18, 2007 10:03 am    Post subject: Как мне преобразовать число из символьной в числовую перемен Reply with quote

Символьная переменная содержит число, например, "123.456,78-".
Как преобразовать эту символьной переменной в числовую переменную?
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Thu Oct 18, 2007 5:46 pm    Post subject: Reply with quote

RS_CONV_EX_2_IN_DTEL - преобразование строкового значения к типу, определяемому по элементу данных.

Code:
DATA: lf_value LIKE bseg-dmbtr.

CALL FUNCTION 'RS_CONV_EX_2_IN_DTEL'
  EXPORTING
    input_external              = '123,09'
    dtel                             = 'DMBTR'
  IMPORTING 
    output_internal             = lf_value
  EXCEPTIONS
             input_not_numerical               = 1
             too_many_decimals                 = 2
             more_than_one_sign                = 3
             ill_thousand_separator_dist       = 4
             too_many_digits                   = 5
             sign_for_unsigned                 = 6
             too_large                         = 7
             too_small                         = 8
             invalid_date_format               = 9
             invalid_date                      = 10
             invalid_time_format               = 11
             invalid_time                      = 12
             invalid_hex_digit                 = 13
             unexpected_error                  = 14
             invalid_dtel                      = 15
             field_and_dtel_incompatible       = 16
             input_too_long                    = 17
             no_decimals                       = 18
             invalid_float                     = 19
             conversion_exit_error             = 20
             OTHERS                            = 21.

IF sy-subrc <> 0.
  EXIT.
ENDIF.

WRITE: / lf_value DECIMALS 2.


http://www.sapnet.ru/viewtopic.php?p=687#687
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.