DATA gt_mara_sort TYPE SORTED TABLE OF mara WITH UNIQUE KEY primary_key COMPONENTS matnr. "旧语法 DATA LV_MATKL TYPE MARA-MATKL. READ TABLE GT_MARA INDEX 1 INTO DATA(LS_MARA). READ TABLE gt_mara_sort INTO DATA(ls_mara_sort1) INDEX 1 USING KEY primary_key. READ TABLE gt_mara_sor...
```abap 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 KE...
READ TABLE itab INDEX idx INTO wa. After: wa = itab[ idx ]. 1. 2. 3. 4. 5. 2.1.3 Read Table using key Before: READ TABLE itab INDEX idx USING KEY key INTO wa. After: wa = itab[ KEY key INDEX idx ]. 1. 2. 3. 4. 5. 6. 2.1.4 Read Table index Before: DATA idx...
col3TYPEi,ENDOFty_line,"结构体ty_tabTYPESTANDARDTABLEOFty_lineWITHEMPTY KEY.*&***通过语法1给新內表赋值 - 类似于JAVA中的FOR循环"for每次遍历一次都将结果,通过value赋值给内表gt_itabDATA(gt_itab) = VALUE ty_tab(FORj =11THENj +10UNTIL j >40"初始值,递增量,结束条件"结构中的字段赋值-...
相当于READ TABLE itab INDEX idx INTO wa. 使用次级/二级索引访问内表 wa = itab[ KEY key INDEX idx ]. 相当于READ TABLE itab INDEX idx USING KEY key INTO wa.这里注意itab必须指定次级索引,key为次级索引名不是内表字段。举例: types: BEGIN OF ty, ...
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...
If theprimary table keyis used to access astandard tableand the key isempty, the first row of the internal table is read. If this is known statically, the syntax check produces a warning. Notes When using the primary table key, note that this key can be thestandard key, which can also...
READ TABLE itab INDEX idx USING KEY sort_key ASSIGNING FIELD-SYMBOL(<fs>). idx = idx - 1. CHECK <fs> > 2. output = output && <fs> && ` `. ENDWHILE. cl_demo_output=>display( output ). Cause:When reading a table usingREAD ... WITH[TABLE]KEY, overlapping or duplicate keys we...
READ TABLE lt_bseg INTO ls_bseg WITH KEY ('MANDT') = 800 (' ') = '' ('BUKRS') = '0005' ('BELNR') = '0100000000' ('GJAHR') = 2005 ('BUZEI') = '002' ('') = '' (' ') = '' (' ') = ' ' (lv_string1) = '1' (lv_string2) = ''. By using this syntax ...
USING 之后跟随着不会发生变化的子程序参数 FUNCTION 函数调用 与子程序一样也支持按照具体的功能体模块化代码的重复利用功能 1.函数包含在称为函数组的一个池中 2.函数提供例外处理功能 因此当发生错误时候调用自定义设定的例外处理程序 3.函数调用的程序无关可以单独在Stand_alone模式下进行测试 ...