LOOP AT items INTO data. WRITE data-name. ENDLOOP. 其他特性:ABAP中的动态循环还提供了几个附加特性来增强其灵活性: WHERE子句,允许根据条件过滤数据结构。 ORDER BY子句,指定数据结构的遍历顺序。 GROUP BY子句,根据指定字段对数据结构进行分组。 关联表字段,将特定表字段分配给循环变量的组件。©...
"test6"secondary keyFORMf_test6.DATA:lt_spfliTYPETABLEOFspfliWITHUNIQUE HASHED KEY k_hash COMPONENTS carrid connid countryfrWITHNON-UNIQUE SORTED KEY k_sort COMPONENTS carrid connid.SELECT*FROMspfliINTOTABLElt_spfli."loop时使用LOOPATlt_spfliINTODATA(ls_spfli)USINGKEY k_sortWHEREcarrid ='AA'...
Open SQL能够动态定义WHERE条件。如下: [For Example] DATA: WHERE_TABTYPE TABLE OFEDPLINE. DATA: DT_SCUSTOMLIKE STANDARD TABLE OFSCUSTOMWITH HEADERLINE. APPEND' ID = 11279 'TOWHERE_TAB. "添加条件 APPEND' OR 'TOWHERE_TAB. APPEND' ID = 36 'TOWHERE_TAB. *DATA COND TYPE STRING. *LOOP ...
CONCATENATE 'matnr like ''%' s_trx '%''' INTO where_tab. APPEND where_tab. CONCATENATE ' and SPRAS = ''' lan ''' INTO where_tab. APPEND where_tab. CLEAR where_tab. SELECT * FROM makt INTO TABLE wa_itab WHERE (where_tab). END-OF-SELECTION. LOOP AT wa_itab. WRITE:/ wa_i...
ENDLOOP. SKIP. SELECT cityfrom INTO wa FROM spfli WHERE (itab). WRITE / wa. ENDSELECT. REPORT demo_select_dynamic_conditions . DATA: cond(72) TYPE c, itab LIKE TABLE OF cond. PARAMETERS: city1(10) TYPE c, city2(10) TYPE c. ...
一、Loop Where条件的使用 1.用Where条件过滤数据 ABAP Loop Where使用一个条件表达式来筛选出满足 Where 条件的数据行。可以通过跳过不相关的行来提高程序的性能。条件表达式必须返回布尔值。 DATA: lt_sflight TYPE STANDARD TABLE OF sflight, ls_sflight TYPE sflight. "获取所有航班号 SELECT * INTO TABLE ...
LOOP AT TAB INTO TAB_WA. INSERT INTO CUSTOMERS VALUES TAB_WA. ENDLOOP. 7.3.Select-Endselect vs. Array-Select 对于只需要使用一次的数据,使用Select-Endselect-loop来 代替Select Into Table。内表需要更多的内存空间。例如: SELECT * FROM T006 INTO X006_WA. ...
添加条件 ???APPEND??OR??TO?WHERE_TAB. ???APPEND??ID?=?36??TO?WHERE_TAB. ?? *DATA?COND?TYPE?STRING. ???*LOOP?AT?WHERE_TAB?INTO?COND.? 无HEADER LINE内表LOOP...INTO FIELD ???WRITE:?/?COND. ???*ENDLOOP. ???SELECT?ID?NAME?FROM?SCUSTOM?INTO?CORRESPONDING?FIELDS?OF??DT_SCU...
LOOP AT gt coep1 WHERE kstar gt coep2 kstar ASSIGN COMPONENT gt coep1 objnr6 OF STRUCTURE TO gt coep1 wkgbtr ENDLOOP APPEND TO 将工作区中的数据append到动态内表中去 ENDLOOP ENDFORM 动态内表ALV展示时构建fieldcatalog 通过循环it structure来实现 FORM build fieldcat1 DATA lv name TYPE ...
”动态条件分组 DATA: lv_field TYPE c VALUE 'B'. LOOP AT <dy_table> ASSIGNING <dyn_wa> GROUP BY SWITCH string( lv_field WHEN 'A' THEN | BELNR = <DYN_WA>-BELNR| WHEN 'B' THEN | BELNR = <DYN_WA>-BELNR WAERS = <DYN_WA>-WAERS | ) ASSIGNING FIELD-SYMBOL(<group>). ...