Monday, 29 December 2014

OPERATIONS ON INTERNAL TABLE

*&---------------------------------------------------------------------*
*& Report  ZA_DEMO_ITABS_OPERATIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZA_DEMO_ITABS_OPERATIONS.
DATA : V_LINES TYPE I.
TYPES BEGIN OF TY_T001,
        DEP_ID TYPE I,
        F_NAME TYPE STRING,
        l_NAME TYPE STRING,
        GENDER(4) TYPE C,
  END OF TY_T001.

  DATA ITAB1 TYPE TY_T001 OCCURS 2.
  DATA ITAB2 TYPE TY_T001 OCCURS 2.
  DATA WA_T001 TYPE TY_T001.

WA_T001-DEP_ID = '001'.
WA_T001-F_NAME = 'ANVESH'.
WA_T001-L_NAME = 'GODDATI'.
WA_T001-GENDER = 'MALE'.


INSERT WA_T001    INTO ITAB1 INDEX 1  .
CLEAR WA_T001.

WA_T001-DEP_ID = '002'.
WA_T001-F_NAME = 'RAMESH'.
WA_T001-L_NAME = 'GODAPATI'.
WA_T001-GENDER = 'MALE'.

APPEND WA_T001    TO ITAB1  .
CLEAR WA_T001.

WA_T001-DEP_ID = '003'.
WA_T001-F_NAME = 'SURESH'.
WA_T001-L_NAME = 'KODATI'.
WA_T001-GENDER = 'MALE'.

APPEND WA_T001    TO ITAB1  .
CLEAR WA_T001.

WA_T001-DEP_ID = '004'.
WA_T001-F_NAME = 'GURESH'.
WA_T001-L_NAME = 'KODATI'.
WA_T001-GENDER = 'MALE'.

INSERT  WA_T001   INTO ITAB1 INDEX 4  .
CLEAR WA_T001.
WA_T001-DEP_ID = '005'.
WA_T001-F_NAME = 'PADMESH'.
WA_T001-L_NAME = 'RUDRAPATI'.
WA_T001-GENDER = 'MALE'.

INSERT WA_T001    INTO ITAB1 INDEX 5  .
CLEAR WA_T001.

SORT ITAB1 ASCENDING BY  F_NAME.

LOOP AT ITAB1 INTO WA_T001.
  WRITE WA_T001-DEP_ID , 24
           WA_T001-F_NAME ,36
           WA_T001-L_NAME,45
           WA_T001-GENDER.
  SKIP.
           ENDLOOP.
CLEAR WA_T001.

*APPEND LINES OF ITAB1  TO ITAB2.
INSERT LINES OF ITAB1 FROM TO INTO ITAB2 INDEX 1.


LOOP AT ITAB2 INTO WA_T001.
  WRITE WA_T001-DEP_ID , 24
           WA_T001-F_NAME ,36
           WA_T001-L_NAME,45
           WA_T001-GENDER.
  SKIP.
           ENDLOOP.

DESCRIBE TABLE  ITAB1 LINES V_LINES.
           WRITE V_LINES.

WA_T001-DEP_ID = '004'.
WA_T001-F_NAME = 'GURESH'.
WA_T001-L_NAME = 'KODATI'.
WA_T001-GENDER = 'MALE'.



INSERT WA_T001 INTO ITAB2 INDEX 4.
READ TABLE ITAB2 INTO WA_T001 INDEX 4.
WRITE :5 WA_T001-DEP_ID , 24
           WA_T001-F_NAME ,36
           WA_T001-L_NAME,45
           WA_T001-GENDER.
*DELETE ITAB2 INDEX 4.
*READ TABLE ITAB2 INTO WA_T001 INDEX 1.
*WRITE :5 WA_T001-DEP_ID , 24
*           WA_T001-F_NAME ,36
*           WA_T001-L_NAME,45
*           WA_T001-GENDER.

ADDING LINES TO THE INTERNAL TABLE USING HEADER LINE / WORK AREA.

*&---------------------------------------------------------------------*
*& Report  ZA_DEMO_ITABS_DISPLAY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZA_DEMO_ITABS_DISPLAY.

TYPES BEGIN OF  TY_MARA,
  CLIENT_NAME(20) TYPE C,
  MAT_NUMBER TYPE I,
  LASTCHNGDATE TYPE DATE,
  END OF TY_MARA.


  DATA IT_MARA TYPE  TABLE OF TY_MARA.
  DATA WA_MARA TYPE  TY_MARA.
  WA_MARA-CLIENT_NAME = '1.BAJAJALLIANZ'.
  WA_MARA-MAT_NUMBER = '1234'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.


APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.

 WA_MARA-CLIENT_NAME = '2.ICICILAMBORD'.
  WA_MARA-MAT_NUMBER = '4567'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.

APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
  WA_MARA-CLIENT_NAME = '3.HDFCERGO'.
  WA_MARA-MAT_NUMBER = '8901'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.


APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
 WA_MARA-CLIENT_NAME = '4.SBI-LIFE'.
  WA_MARA-MAT_NUMBER = '1212'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.

APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
WA_MARA-CLIENT_NAME = '5.LIC-INDIA'.
  WA_MARA-MAT_NUMBER = '1212'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.

APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.

  WA_MARA-CLIENT_NAME = '6.NEWINDIA-ASSURANCE'.
  WA_MARA-MAT_NUMBER = '1234'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.

APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
 WA_MARA-CLIENT_NAME = '7.OBC'.
  WA_MARA-MAT_NUMBER = '4567'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.

APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
  WA_MARA-CLIENT_NAME = '8.AB'.
  WA_MARA-MAT_NUMBER = '8901'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.


APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
 WA_MARA-CLIENT_NAME = '9.CANARA'.
  WA_MARA-MAT_NUMBER = '1212'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.

APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
WA_MARA-CLIENT_NAME = '10.P&S'.
  WA_MARA-MAT_NUMBER = '1212'.
  WA_MARA-LASTCHNGDATE = '13/12/2014'.

APPEND WA_MARA TO IT_MARA.
CLEAR WA_MARA.
  LOOP AT IT_MARA INTO WA_MARA.

    WRITE  WA_MARA-CLIENT_NAME,31 WA_MARA-MAT_NUMBER , 52  WA_MARA-LASTCHNGDATE.
    SKIP.


    ENDLOOP.
*WRITE : 60 'ANVESH',
*        127 'GODDATI'.

Saturday, 27 December 2014

STRING COMPARISIONS

'AABB' co 'AB' True
         'ABCD' co 'ABC' False---->string1 is refernce 
         'AABB' cn 'AB' False------>string1 is refernce 
         'ABCD' cn 'ABC' True----->string1 is refernce
         'AXCZ' ca 'AB' True------>any string is reference
         'ABCD' ca 'XYZ' False------>any string is reference
         'AXCZ' na 'ABC' False------>any string is reference
         'ABCD' na 'XYZ' True ------>any string is reference
        'ABCD' CS    'A'          TRUE. ------>any string is reference
       'ABCD'  CS   'XYZ'    FALSE. ------>any string is reference
        'ABCD' NS    'A'          TRUE. ------>any string1 is reference
       'ABCD'  NS   'XYZ'    FALSE. ------>any string1 is reference




CA:

*    srting str1 should be less than string 2 in case of co comparision.
*    STRING(STR1) MUST CONTAIN ALL OR ATLEAST ONE CHARACTER THAT  ARE IN 
     THE STRING 2.
*   BLANK SPACES ARE IGNORED EVEN IN THE STATEMENT STR1 OR STR2 .
*   the blanks or spaces  before or after the string1 and string2 are ignored.
    IF THE STATEMENT IS TRUE THE STRING1 LENGHT IS RETURN OTHERWISE,THE POSITON OF CHARACTER OF STRING2 THAT IS NOT THERE IN THE STRING ONE IS RETURN.


DATA : V_STR1(25) TYPE C,
              V_STR2(20) TYPE C.

 V_STR1 = '   ab      '.
 V_STR2 = '     abc@#$    '.

 IF V_STR1 co V_STR2 .
*   WRITE : 'TRUE'.
   write : sy-fdpos.
   ELSE .
*      WRITE : 'FALSE'.
       write : sy-fdpos.
     ENDIF.

CS:
REPORT  ZA_DEMO_STRINGS_COMPARISONS.
PARAMETERS : V_STR1 TYPE STRING,
             V_STR2 TYPE STRING.



IF  V_STR1 cs V_STR2 .

WRITE  'TRUE'.

ELSE.
  WRITE 'FALSE' .

ENDIF.




Sunday, 14 December 2014

FORMAT COLOR DEMO PROGRAMME

WHILE SY-INDEX  <= 7.
FORMAT  COLOR = SY-INDEX.
  WRITE :   / SY-INDEX INTENSIFIED ,SY-INDEX   INTENSIFIED OFF,SY-INDEX INVERSE,SY-INDEX INVERSE OFF.
  SY-INDEX = SY-INDEX + 1.
  ENDWHILE.

SAP ABAP FORMAT OPTIONS DEMO PROGRAMME

REPORT  ZADEMO_FORMAT_OPTIONS.
DATA : G_VAR TYPE F .
      G_VAR = '534.123'.

WRITE  :  /40  G_VAR ROUND 2.
 WRITE  :     SY-ULINE.
  WRITE  :     SY-VLINE.
 WRITE   SKIP LINES.
WRITE  :  /40 G_VAR EXPONENT 3.
WRITE  :     SY-ULINE.
 WRITE  :     SY-VLINE.
WRITE  :  /40 G_VAR DECIMALS 3.
WRITE  :     SY-ULINE.
 WRITE  :     SY-VLINE.
WRITE : G_VAR NO-SIGN.

Tuesday, 9 December 2014

SAP ABAP FORMAT OPTIONS

Skip to end of metadata
Go to start of metadata

Link to Content's target Space :

WRITE WITH COLOR SPECIFICATIONS.
NEW LINE SPEC /, COLUMN SPEC, LENGTH SPEC
FORMAT STATEMENT. FORMAT RESET, FORMAT HOTSPOT = <V>
                                   <V> VALUE ON/OFF
COLOR SPEC AT DATA OBJECT LEVEL
COLOR CONTROL: EITHER BACKGROUND OR FOREGROUND
----------------------------------------------------------
| VAL | INTENSIFIED ON |INTENSIFIED OFF |INVERSE ON      |
| -UE | (BACKGROUND)      | (BACKGROUND)           | (FOREGROUND)        |
----------------------------------------------------------
|  0  |COL_BACKGROUND  |COL_BACKGROUND      |COL_BACKGROUND  |
|  1  |COL_HEADING           |COL_HEADING                |COL_HEADING           |
|  2  |COL_NORMAL           |COL_NORMAL                 |COL_NORMAL           |
|  3  |COL_TOTAL              |COL_TOTAL                     |COL_TOTAL              |
|  4  |COL_KEY                   |COL_KEY                         |COL_KEY                  |
|  5  |COL_POSITIVE          |COL_POSITIVE                  |COL_POSITIVE          |
|  6  |COL_NEGATIVE       |COL_NEGATIVE                 |COL_NEGATIVE        |
|  7  |COL_GROUP             |COL_GROUP                     |COL_GROUP             |
----------------------------------------------------------
Output format of predefined data types
=================================================
Data    Output length          Positioning
Type
=================================================
C       field length           left-justified
D       8                      left-justified
F       22                     right-justified
I       11                     right-justified
N       field length           left-justified
P       2 * field length       right-justified
T       6                      left-justified
X       2 * field length       left-justified
=================================================













Formatting options for all data types
=========================================================
Option                     Function
=========================================================
LEFT-JUSTIFIED           Output is left-justified.
CENTERED                 Output is centered.
RIGHT-JUSTIFIED          Output is right-justified.
UNDER <g>                Output starts directly under field <g>.
NO-GAP                   The blank after field <f> is omitted.
USING EDIT MASK <m>      Specifies format template <m> ('==XXXXX').
USING NO EDIT MASK       Deactivates a format template specified in the ABAP Dictionary.
NO-ZERO                  If a field contains only zeros, these are replaced by blanks.
                        For type C and N fields, leading zeros are replaced automatically.
Formatting options for numeric fields
=========================================================
Option                  Function
=========================================================
NO-SIGN                 The leading sign is not displayed on the
screen.
DECIMALS <d>            <d> defines the number of digits after the decimal point.
EXPONENT <e>            In type F fields, the exponent is defined in <e>.
ROUND <r>               Type P fields are multiplied by 10**(-r) and then rounded.
CURRENCY <c>            Format according to currency <c> in table TCURX.
UNIT <u>                The number of decimal places is fixed according to unit
                       <u> specified in table T006 for type P fields.






Formatting options for date fields
=========================================================
Option                  Function
=========================================================
DD/MM/YY                Separators as defined in user’s master record.
MM/DD/YY                Separators as defined in user’s master record.
DD/MM/YYYY              Separators as defined in user’s master record.
MM/DD/YYYY              Separators as defined in user’s master record.
DDMMYY                  No separators.
MMDDYY                  No separators.
YYMMDD                  No separators.
ULINE COMMAND, SY-ULINE, SY-VLINE
SKIP LINES, SKIP TO LINE <l>, POSITION <L>
OUTPUTTING BLANK LINES, SET BLANK LINES ON
WRITE <f> AS CHECKBOX.
WRITE <symbol-name> AS SYMBOL.
WRITE <icon-name> AS ICON.
LINE-SIZE, LINE-COUNT(FL) WITH REPORT STATEMENT.
NEW-PAGE [stage:(LINE-COUNT)] COMMAND, TOP-OF-PAGE EVENT,
END-OF-PAGE EVENT, NEW-LINE NO-SCROLLING.
SET LEFT SCROLL-BOUNDARY [stage:COLUMN <col>].
STANDARD PAGE HEADER THRU TEXT ELEMENTS
SY-TVAR0 - SY-TVAR9
SY-TITLE, SY-PAGNO, SY-LINSZ, SY-LINCT.SY-LINNO
RESERVE <n> LINES.

Saturday, 22 November 2014

STOP CONTINUE EXIT RETURN STATEMENTS

SAPNUTS_SAPABAP  

Tutorial Details

Tutorial NameWorking with EXIT, STOP, CONTINUE and RETURN in SAP ABAP
Tutorial DescriptionLearn how to use STOP, EXIT, CONTINUE and RETURN commands in SAP ABAP, difference between STOP, EXIT, CONTINUE and RETURN in SAP ABAP
Tutorial AreaCore ABAP
PrerequisitesABAP
Learning LevelIntermediate
Estimated Time to learn30
In our day to day ABAP programming implementations, we may need to use exit, continue, stop and return statements, this article will help you to understand what are exit, stop, continue and return statements? And when do we use them.

EXIT

The behavior of EXIT keyword is depends on where you use it.
  • If you use EXIT keyword inside IF .. ENDIF., it will comes out of the program.
  • If you use EXIT inside LOOP .. ENDLOOP., it will come out of loop.
  • If you use EXIT inside FORM .. ENDFORM., it will comes out of form (subroutine).
Example program os using EXIT keyword
REPORT ZSAPN_EXIT.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.
PARAMETERS: P_MATNR TYPE MARA-MATNR.

START-OF-SELECTION.
  SELECT SINGLE * FROM MARA INTO WA_MARA WHERE MATNR = P_MATNR.

  IF WA_MARA IS INITIAL.
    EXIT. “exit program
  ENDIF.
  WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL.

STOP

STOP is a statement which is used to stop processing an event block, ex: If I have two events START-OF-SELECTION and END-OF-SELECTION in my program, If I use STOP keyword in START-OF-SELECTION, the keyword will exits start-of-selection and goes to END-OF-SELECTION.
See the difference between below two programs.
Program1Program2
REPORT ZSAPN_STOP.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.

START-OF-SELECTION.
  SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS.
  STOP.

  LOOP AT IT_MARA INTO WA_MARA.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL.
  ENDLOOP.
REPORT ZSAPN_STOP.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.

START-OF-SELECTION.
  SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS.
  STOP.

END-OF-SELECTION.
  LOOP AT IT_MARA INTO WA_MARA.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL.
  ENDLOOP.
Result: NO OUTPUTRESULT: OUTPUT WILL BE DISPLAYED

CONTINUE

CONTINUE is a statement, which is used to skip execution of a record inside loop.. endloop, do..endo, while..endwhile etc. This keyword will only be used in loops.
REPORT ZSAPN_CONTINUE.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.
START-OF-SELECTION.
  SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS.

  LOOP AT IT_MARA INTO WA_MARA.
    IF WA_MARA-MTART = 'HALB'. "Don’t print if material type is 'HALB'
      CONTINUE. “Skip the record and go for next record
    ENDIF.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL.
  ENDLOOP.
In the above program, the output will not display materials of type ‘HALB’ because loop skips the records with HALB material type.

RETURN

RETURN is a statement which is used to stop processing of current block immediately. Execute and see the difference between the below two programs.
Program1Program2
REPORT ZSAPN_RETURN.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.

START-OF-SELECTION.
  SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS.
  RETURN.

END-OF-SELECTION.
  LOOP AT IT_MARA INTO WA_MARA.
    IF WA_MARA-MTART = 'HALB'.

    ENDIF.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL.
  ENDLOOP.
REPORT ZSAPN_RETURN.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.

START-OF-SELECTION.
  SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS.

END-OF-SELECTION.
  LOOP AT IT_MARA INTO WA_MARA.
    IF WA_MARA-MTART = 'HALB'.
RETURN.
    ENDIF.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL.
  ENDLOOP.
Result: NO OUTPUTRESULT: SOME RECORDS as program execution stops after ‘HALB’ material type.

Saturday, 15 November 2014

strings operations


String Operations:
String is the variable length data type
Dynamic memory management is used internally i.e the memory allocation at the run time according to the current field content
Note: we can’t declare the string variable through PARAMETER
PARAMETER p_name type String. Is not allowed because the system can’t understand how big it is
Difference between the character and string:
Character
String
Data: v1 type cahr50.
V1 = ‘Career it’.

Here memory is always allocated for 50 characters irrespective of number of characters should be stored currently
Data:v1 type string.
V1 = ‘Career it’.

Here memory is allocate for ‘Career it’ only because always string size depends on number of characters should be stored currently

String operations:
CONCATENATE: to join more than one substring into one variable
Syntax:
CONCATENATE <String1> <string2>………<string N> into <str> separated by <Separator>
Ex :
*&---------------------------------------------------------------------*
*& Report  ZVISHNU_STRING_OPERATIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT  ZVISHNU_STRING_OPERATIONS NO STANDARD PAGE HEADING.*//declare varibles
data :str1 type string.*//concatenating the strings
CONCATENATE 'Career it' 'Ammerpet' 'hyd' INTO str1 SEPARATED BY ','.*//Displaying output
write:/ str1.
Output:
2. *&---------------------------------------------------------------------*
*& Report  ZVISHNU_STRING_OPERATIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT  ZVISHNU_STRING_OPERATIONS NO STANDARD PAGE HEADING.*//declare varibles
data :str1 type string.CONCATENATE 'Career it' 'Ammerpet' 'hyd' INTO str1 SEPARATED BY ','.*//Displaying output
WRITE:/ str1.
Output:

CONDENSER: replace the sequence of spaces into one space
Ex: CONDENSER ‘Career                it’.
Result: Career it
Ex: CONDENSER ‘Career                it’ NO-GAPS.
Result: Careerit
TRANSLATE: to translate to UPPER / LOWER case
*&---------------------------------------------------------------------*
*& Report  ZVISHNU_STRING_OPERATIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT  ZVISHNU_STRING_OPERATIONS NO STANDARD PAGE HEADING.*//declare varibles
data :str1 type string.* Assigning values to those variables
str1 = 'career it'.*//Traslate the string into Uppercase
TRANSLATE str1 TO UPPER CASE.*//Displaying output
write:/ str1.
REPLACE:
Syntax :
REPLACE <str1> with <str2> into <str>.
*&---------------------------------------------------------------------*
*& Report  ZVISHNU_STRING_OPERATIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT  ZVISHNU_STRING_OPERATIONS NO STANDARD PAGE HEADING.*//declare varibles
data :str1 type string,
      str2 
type string,
      str3 
TYPE string.* Assigning values to those variables
str1 = 
'c'.
str2 = 
'i'.
str3 = 
'Career it'.*//Replaceing the stings
REPLACE  str2 WITH str1 INTO str3.*//Displaying output
write:/ str3.
Output:
                      
SPLIT: to split the main string into substrings at the given separator
SPLIT <String> AT <separator> into <str1> <str2>…….<str N>.
*//declare varibles
data :v_id TYPE char20,
      v_name 
TYPE char20,
      v_place 
TYPE char20,
      v_city 
TYPE char20.*//Calling the split
SPLIT 'c001, Careerit, ammerpet, hyd ' at ',' INTO v_id v_name v_place v_city.*//Displaying output
write: v_id, v_name, V_place, v_city.
Output:
SHIFT: By default shift to left by one place
SHIFT <str> <LEFT/RIGHT/CIRCULAR> by <N> places. (N>0)
SHIFT <str> LEFT DELETING LEADING <CHAR>
SHIFT <str> RIGHT DELECTING TRAILING <CHAR>.

SEARCH: searches for the required main string in the main string
SEARCH <str> FOR <str1>.
SEARCH string1 FOR string2 STARTING AT position1 ENDING AT position 2.
-       position1 and position2 are starting ending line of internal tables.


Comparing strings:
                Operator
Description
                   CO
Contains only
                   CN
Contains not only
                   CA
Contains any
                   NA
Contains not only
                   CS
Contains String
                    NS
Contains no String
                    CP
Matches pattern
                    NP
Does not Matches pattern

CO(Contains only):
IF <str1> CO <str2>.
Is TRUE if string1 contains only the characters from string2 the comparison is case sensitive including spaces
If the comparison  is true then the system field SY-FDPOS contains the length of string1
If it is false then SY-FDPOS contains the offset of the first character of string1 that does not occur in string2
Examples:
         'AABB' co 'AB' True
         'ABCD' co 'ABC' False
         'AABB' cn 'AB' False
         'ABCD' cn 'ABC' True
         'AXCZ' ca 'AB' True
         'ABCD' ca 'XYZ' False
         'AXCZ' na 'ABC' False
         'ABCD' na 'XYZ' True 

Read more at http://sapabap-freshers.blogspot.com/2012/06/string-operations-in-abap.html#JARcy2vr8hetvJ4i.99