ABAP-字符串语法综合运用

*&---------------------------------------------------------------------*
*& Report  Z10
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT z10.


DATA join TYPE string.

join = '1,3,5,7,9,'.


WRITE join.
SKIP.

SHIFT join RIGHT DELETING TRAILING ','.

CONDENSE join NO-GAPS.

WRITE join.

data  cmdText type string.
data  sql type string.

cmdText = 'select * from uf_sd_customer where id in'.

CONCATENATE cmdText '(' join ')' ' order by customerid desc' INTO sql.

SKIP.
WRITE sql.


WRITE strlen( sql ).

SEARCH sql for 'uf_sd_customer'.

DATA status type i.

status = sy-subrc.

IF status = 0 .
  
  WRITE '查询的是用户表'.
  
ENDIF.


REPLACE 'uf_sd_customer' WITH 'uf_sd_user' INTO sql.

SKIP.
WRITE sql.
运行结果                                                                                                        1

1,3,5,7,9,

1,3,5,7,9

select * from uf_sd_customer where id in(1,3,5,7,9) order by customerid desc         76  查询的是用户表

select * from uf_sd_user where id in(1,3,5,7,9) order by customerid desc

 

原文地址:http://www.cnblogs.com/hua900822/p/16852937.html

发表评论

您的电子邮箱地址不会被公开。