READ TABLE lt_table WITH KEY your_key_field = your_key_value INTO ls_table. ``` 在上述代码中,“your_key_field”是作为搜索条件的字段,而“your_key_value”是该字段对应的值。读取成功后的数据将会保存在ls_table中。 ### 步骤3:处理读取到的数据 当我们成功地使用“READ TABLE WITH KEY”关键字...
2.在循环(LOOP AT ...WHERE..)或查询(READ TABLE ...)某内表时,如果未使用索引(排序表、哈希表)或二分查找,则在查询组合字段创建第二索引,查询时通过USE KEY或WITH [TABLE] KEY选项使用第二索引,这样在查询时会自动进行二分查找或哈希找查 在没有用二分查找的情况下,可在查询组合字段上创建第二索引(哈...
2. DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn. 3. DELETE TABLE itab [FROM wa]. 4. DELETE itab INDEX idx. 5. DELETE itab FROM idx1 TO idx2. 6. DELETE itab WHERE logexp. 7. DELETE ADJACENT DUPLICATES FROM itab. (4).修改数据: 1. MODIFY itab [FROM wa] [I...
REPORTz_simple_fieldsymbols.DATA:BEGINOFaddress,no(5)TYPEn,street(30)TYPEc,ENDOFaddress.DATAitab_addLIKETABLEOFaddress.address-no='001'.address-street='street1'.INSERTaddressINTOTABLEitab_add.FIELD-SYMBOLS<fs>TYPEINDEXTABLE.ASSIGNitab_addTO<fs>.READTABLEitab_addWITHTABLEKEYno='001'street='...
9, 二分查找比线性查找要高效,READ TABLE的之前使用SORT TABLE BY XXX 某个表关键字段进行排序, 然后使用READ TABLE WITH KEY XXX = ‘XXX’ BINARY SEARCH. 这个就是所谓的二分查找法的应用. 10, 避免使用SQL语句动态查询条件,动态表名和动态字段名, 必要时候用宏或者子程序模块代替. ...
按具体值删除:DELETE TABLE itab WITH TABLE KEY k1=v1...kn=vn. 参照其它内表值删除:DELETE TABLE itab [FROM wa]. 删除具体行数据:DELETE itab INDEX idx. 删除具体行数范围间数据:DELETE itab FROM idx1 TO idx2. 删除重复数据,执行此条件前必须先排序: DELETE ADJACENT DUPLICATES FROM itab. ...
select 数据1,数据2from 透明表 into table 内表.sort 内表 by 数据1数据2.DELETEADJACENTDUPLICATESFROMitab(内表名)COMPARING针对的字段.loop 内表 into 工作区.read 内表 into 工作区withkey1=值1BINARYSEARCH.modify 内表 from 工作区.endloop.
street='ChangCheng'.address-city='Beijing'.INSERTaddressINTOTABLEitab_address.READTABLEitab_addressWITHTABLEKEYcity='Xian'INTOaddress.WRITE:/address-street,address-city.READTABLEitab_addressINTOaddressINDEX1.WRITE:/address-street,address-city.LOOPATitab_addressINTOaddress.WRITE:/sy-tabix,address-street...
ABAP READ TABLE使用BINARY SEARCH如题,read table使用binary search,with key有多个字段的时候,寻找数据的内部逻辑是怎样的比如有内表(按A,B已排好序)T_DATAA B C1 1 11 2 22 1 32 2 42 3 53 1 63 2 73 3 8现在用如下语句查找READ TABLE T_DATA INTO W_DATA WITH KEY A='2' B = '3' BINA...
READ TABLEit_zspfliWITH KEYcarrid='AA'connid='0011'. it_zspfli-distance=2000. MODIFYzspfliFROMit_zspfli."修改数据 ENDIF. BREAK-POINT. CALL FUNCTION'DEQUEUE_EZ_ZSPFLI'"解锁 EXPORTING mode_zspfli='E' mandt=sy-mandt carrid='AA'