We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

Re: [sap-dev] Split N Number Words from String

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Toolbox sap-dev

Reply from ameensha on Dec 17 at 12:12 PM
Hi Samis,
It can be achieved by passing the values to an ITAB. I'm here providing
a sample code for your reference, simulating the requirement.

DATA : X TYPE STRING VALUE 'A1-A2-A3-A4',
Y TYPE STRING.
DATA : BEGIN OF WA,
VAL(10),
END OF WA,
IT LIKE TABLE OF WA.

DO.
IF X CA '-'.

SPLIT X AT '-' INTO X Y.
IF SY-SUBRC EQ 0.
WA-VAL = X.
APPEND WA TO IT.
CLEAR : WA, X.
X = Y.
CLEAR Y.
ENDIF.
ELSE.
WA-VAL = X.
APPEND WA TO IT.
CLEAR WA.
EXIT.
ENDIF.
ENDDO.

All the data is stored in the internal table IT.

Hope your issue is solved.

Cheers,
Ameen.

---------------Original Message---------------
From: samis
Sent: Monday, December 17, 2012 11:39 AM
Subject: Split N Number Words from String

s1 : word1-word2-word3………word n etc.......... i have big sentence(string) i want to split by a separator(-),how can i store values spilted values into varibles insted of taking n number of varibles for each splited …
ex:word1-word2-word3 for this simply we can put into three varibles
like:split s1 at '-' into s2 s3 s4.
write :s1,s2,s3…
but i want n number of values to split …
please buddys help me to do this

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
ameensha  

achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Become a blogger at Toolbox.com and share your expertise with the community. Start today.

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language