‎2009 Feb 09 9:20 PM
Hi Frnds,
I have a requirement ,A condition needs to be written.
If 2nd element of PRDHA is 'D' then
.........
...........
............
............
endif.
In field values may be PRDHA = FD21,RS31,EDS4,RSDE etc....,
Now My if condition should satisfy only if the second field has D .So in the above case for 1st & third fields My condition should satisfy.
thank U very much
‎2009 Feb 09 9:39 PM
In field values may be PRDHA = FD21,RS31,EDS4,RSDE etc....,
Now My if condition should satisfy only if the second field has D .So in the above case for 1st & third fields My condition should satisfy.
how is the 2nd element D in case of FD21 and EDS4 ?
‎2009 Feb 09 9:39 PM
In field values may be PRDHA = FD21,RS31,EDS4,RSDE etc....,
Now My if condition should satisfy only if the second field has D .So in the above case for 1st & third fields My condition should satisfy.
how is the 2nd element D in case of FD21 and EDS4 ?
‎2009 Feb 09 9:40 PM
‎2009 Feb 09 9:47 PM
‎2009 Feb 09 9:39 PM
As an alternative SPLIT the string at D and get the position.
If its greater than 2 then get the charater before it and check its an special character than use it.
If its equal to 2 then use it directly.
If its less than 2 then check for the second occurance of D and Repeat Step 1 and 2.
‎2009 Feb 09 9:52 PM
DATA: BEGIN OF itab OCCURS 0,
string TYPE string,
END OF itab.
itab-string = 'FD21'.
APPEND itab.
itab-string = 'RS31'.
APPEND itab.
itab-string = 'EDS4'.
APPEND itab.
itab-string = 'RSDE'.
APPEND itab.
LOOP AT itab.
IF itab-string+1(1) = 'D'.
WRITE: itab-string.
ELSE.
DELETE itab INDEX sy-tabix.
ENDIF.
ENDLOOP.