if i_open_posting[] is not initial.
*Fetching entry data from mkpf.
select mblnr mjahr cpudt from mkpf into table i_cpudt
for all entries in i_open_posting
where mblnr = i_open_posting-mblnr
and mjahr = i_open_posting-mjahr.
if sy-subrc = 0.
endif.
*looping at i_open_posting append the data into i_print_mat.
loop at i_open_posting into wa_open_posting.
move: wa_open_posting-mblnr to wa_print_mat-mblnr,
wa_open_posting-mbpos to wa_print_mat-mbpos,
wa_open_posting-bwart to wa_print_mat-bwart,
wa_open_posting-menge to wa_print_mat-menge,
wa_open_posting-meins to wa_print_mat-meins.
*looping at i_cpudt to append the data into i_print_mat.
read table i_cpudt into wa_cpudt with key mblnr = wa_open_posting-mblnr.
if sy-subrc = 0.
move wa_cpudt-cpudt to wa_print_mat-cpudt.
endif.
*looping at i_t156t to append the data into i_print_mat.
read table i_t156t into wa_t156t with key bwart = wa_open_posting-bwart.
if sy-subrc = 0.
move wa_t156t-btext to wa_print_mat-btext.
endif.
*Appending i_open_posting, i_cpudt, i_t156t into one i_print_mat.
append wa_print_mat to i_print_mat.
endloop.
*If the selection screen print option is 'Y'.
IF p_print EQ c_y.
loop at i_open_posting into wa_open_posting.
read table i_print_mat into wa_print_mat with key
mblnr = wa_open_posting-mblnr
bwart = wa_open_posting-bwart.
endloop.
ELSEIF p_print EQ c_n.
*If the selection screen print option is 'N'.
LOOP AT i_print_mat INTO wa_print_mat.
IF wa_print_mat-bwart EQ c_mt1
OR wa_print_mat-bwart EQ c_mt2
OR wa_print_mat-bwart EQ c_mt3
OR wa_print_mat-bwart EQ c_mt4
OR wa_print_mat-bwart EQ c_mt5
OR wa_print_mat-bwart EQ c_mt6.
DELETE i_print_mat INDEX sy-tabix.
endif.
endloop.
endif.
endif.
ENDFORM. " f_print_doc
FOR THE ABOVE CODE I NEED TO CHECK WHETHER BWART(131 movement type exist )
if so i neeed to delete the records for that movement type.