Friday, September 5, 2014

ABAP TIP system variable SY-FDPOS

ABAP TIP system variable SY-FDPOS

When searching the statement in char or string variable, you can find the position which start with the statement from SY-FDPOS.
For example, in order to find with ‘SEARCH’ command if there is a ‘SAP’ string in variable, you can write up like below program.


REPORT           ZTEST.

  DATA : gv_str TYPE string.

  gv_str = 'Enjoy SAP'.
  SEARCH gv_str FOR 'SAP'.

 IF SY-SUBRC EQ 0.
  WRITE sy-fdpos.
 ENDIF.




Since ‘SAP’ statement located in 6th position, the outcome of program is 6.

SY-FDPOS system variable is also used with the command ‘CO, CN, CA, NA, CS, NS, CP, NP’.
You can get more detailed information.

, FIND 명령어에서는 SY-FDPOS는 지원되지 않는다.
 


No comments:

Post a Comment