reading multiple records from internal table with out loop
im reading internal table to fetch records based on few conditions and the records are MORE THAN ONE. is there any way i can retrieve those records with out using LOOP and ENDLOOP. your help would be appreciated.
You can use a binary read to get the first record. Then read each record sequentially until you have proccessed all the records that meet your critera. You will have to have the internal table sorted so that the binary search and subsequent reads will work:
READ TABLE his_data WITH KEY ebeln = ekpo_int-ebeln ebelp = ekpo_int-ebelp BINARY SEARCH. IF sy-subrc = 0. his_index = sy-tabix. DO. IF sy-subrc = 0. IF his_data-ebeln = ekpo_int-ebeln AND his_data-ebelp = ekpo_int-ebelp. his_index = his_index + 1. menge = menge + his_data-menge. READ TABLE his_data INDEX his_index. ELSE. EXIT. ENDIF. ELSE. EXIT. ENDIF. ENDDO. ENDIF.
Message was edited by: Rob Burbank