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
ollenin
Участник
Участник



Joined: 24 Feb 2013
Posts: 5

PostPosted: Sun Jul 14, 2013 10:33 pm    Post subject: Поиск значения в строчке Reply with quote

Подскажите, у меня есть значение 547.05.1234 количество цифр может меняться, мне необходимо вытаскивать после первой точки и до второй точки значение. Как лучше сделать?
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 45
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Mon Jul 15, 2013 9:04 am    Post subject: Reply with quote

Code:
PARAMETERS input TYPE text132 DEFAULT '547.05.1234'.
PARAMETERS symbol TYPE c DEFAULT '.'.
PARAMETERS indx TYPE i DEFAULT 2.
DATA t_input TYPE TABLE OF text132 WITH HEADER LINE.

START-OF-SELECTION.
  SPLIT input AT symbol INTO TABLE t_input.
  IF sy-subrc <> 0.
    MESSAGE 'At least one of the segments was truncated on the right'
      TYPE 'S'.
    EXIT.
  ENDIF.

  CLEAR t_input.
  READ TABLE t_input INDEX indx.
  WRITE: / INPUT, t_input.

_________________
FunCoding.ru
KicksCollector.ru
Back to top
View user's profile Send private message Blog
alezhu
Специалист
Специалист



Joined: 29 Apr 2012
Posts: 86
Location: Spb

PostPosted: Mon Jul 15, 2013 10:28 am    Post subject: Reply with quote

Code:
DATA input TYPE text132 VALUE '547.05.1234'.
DATA lv_data TYPE string.

START-OF-SELECTION.

  FIND REGEX '[^.]*\.([^.]+)\.' IN input SUBMATCHES lv_data.
  IF sy-subrc = 0.
    WRITE lv_data.
  ENDIF.
Back to top
View user's profile Send private message
ollenin
Участник
Участник



Joined: 24 Feb 2013
Posts: 5

PostPosted: Wed Jul 17, 2013 11:17 am    Post subject: Reply with quote

Благодарю за подсказку!!!! Laughing
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.