Hi Pavan,
The last part can be optimised as below. Using this you can optimise other code.
types: begin of ty_zsc,
ORD_REASON type /BIC/azsc_o0400-ORD_REASON,
DOC_NUMBER TYPE /BIC/azsc_o0400-DOC_NUMBER,
S_ORD_ITEM type /BIC/azsc_o0400-S_ORD_ITEM,
FISCVARNT type /BIC/azsc_o0400-FISCVARNT,
end of ty_zsc.
data: lt_zsc_o0400 type table of ty_zsc,
wa_zsc_o0400 type ty_zsc.
if result_package is not initial.
select ORD_REASON
DOC_NUMBER
S_ORD_ITEM
FISCVARNT
from /BIC/azsc_o0400
into table lt_zsc_o0400
for all entries of result_package
where doc_number = result_package-doc_number
and S_ORD_ITEM = result_package-S_ORD_ITEM
AND FISCVARNT = result_package-FISCVARNT.
endif.
loop at result_package assigning <result_fields>.
................
...............
.....
read table lt_zsc_o0400 into wa_zsc_o0400 with key doc_number = <result_fields>-doc_number
S_ORD_ITEM = <result_fields>-S_ORD_ITEM
FISCVARNT = <result_fields>-FISCVARNT.
if sy-subrc eq 0.
<result_fields>-ORD_REASON = wa_zsc_o0400-ORD_REASON.
endif.
endloop.
Srikanth.