All,
I have the following code While executing system is pointing to sy-tabix, but the data I am getting in the READ statement is from last record in the internal table
report z_9699_30.
tables : eket.
types : begin of ty_eket.
include structure eket.
types: end of ty_eket.
data: wa_eket type ty_eket.
data: it_eket like sorted table of wa_eket
with unique key primary_key
components ebeln ebelp etenr
with non-unique sorted key secondary_key
components ebeln ebelp.
parameters: p_ebeln like eket-ebeln.
parameters: p_ebelp like eket-ebelp.
select * from eket into table it_eket
where ebeln eq p_ebeln.
read table it_eket into wa_eket with table key secondary_key
components ebeln = p_ebeln
ebelp = p_ebelp.
Please copy and execute this by giving EBELN and EBELP from EKET
Please make sure while selecting from EKET please select data of multiple records available for same EBELP ie llike
Here below PO # 4500000003 and for Item # 00030 is have multiple records
Here in selection screen by giving PO # as 4500000003 (EBELN) Item # as 00030 (EBELP) , then in the above READ statement system giving SY-TABIX as 3 but if you see the WA_EKET-ETENR is showing 2 instead of 1. This is where is the issue is
EBELN | EBELP | ETENR | Header 4 |
---|---|---|---|
4500000003 | 00010 | 1 | |
4500000003 | 00020 | 1 | |
4500000003 | 00030 | 1 | |
4500000003 | 00030 | 2 |