首页 > 其他分享 >ABAP-字符串语法综合运用

ABAP-字符串语法综合运用

时间:2022-11-02 23:22:05浏览次数:43  
标签:customer WRITE join 语法 ABAP sql 字符串 uf sd

*&---------------------------------------------------------------------*
*& 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

 

标签:customer,WRITE,join,语法,ABAP,sql,字符串,uf,sd
From: https://www.cnblogs.com/hua900822/p/16852937.html

相关文章