Hi Sanjana,
try this code and add the extract structure.
Thanks,
Shakthi Raj Natarajan
Types: begin of ty_BDI,
SRC_HEADNO type /1BEA/CRMB_BDI-SRC_HEADNO,
BHD_GUID type /1BEA/CRMB_BDI-BHD_GUID,
End of ty_ BDI.
data: lt_ BDI type standard table of ty_ BDI,
ls_ BDI like line of lt_ BDI.
Types: begin of ty_ BDH,
BHD_GUID type /1BEA/CRMB_BDH-BHD_GUID,
HEADNO_EXT type /1BEA/CRMB_BDH- HEADNO_EXT,
End of ty_ BDH.
data: lt_ BDH type standard table of ty_ BDH,
ls_ BDH like line of lt_ BDH.
data: lv_tabix type sy-tabix.
case i_datasource.
when ' '.
data : l_t_data type "add extract structure name
clear : lt_ BDI, lt_ BDH.
select SRC_HEADNO BHD_GUID from /1BEA/CRMB_BDI into table lt_ BDI for all entries in c_t_data where SRC_HEADNO = c_t_data- SRC_HEADNO .
select BHD_GUID HEADNO_EXT from /1BEA/CRMB_BDH into table lt_ BDH for all entries in lt_ BDI where BHD_GUID = lt_ BDI-BHD_GUID .
loop at c_t_data into l_t_data.
lv_tabix = sy-tabix.
read table lt_ BDI into ls_ BDI with key SRC_HEADNO = l_t_data - SRC_HEADNO .
if sy-subrc eq 0.
read table lt_ BDH into ls_ BDH with key BHD_GUID = ls_ BDI -BHD_GUID .
if sy-subrc eq 0.
l_t_data- HEADNO_EXT = BHD_GUID- HEADNO_EXT.
modify c_t_data from l_t_data index lv_tabix.
endif.
endif.
clear l_t_data.
end loop.
end case.