‎2010 Nov 17 12:00 AM
Hello Abap experts,
i am bw consultant and a beginer in abap programing. i have written an abap routine but it is not giving me desired result .please suggest me changes in my program.
below code to post the documents whose crd date are not equal (different) but iam getting all the documents in my dso. please suggest what changes do i need to make to get desired result.
data: ls_monitor type rstmonitor.
data: ls_buffer type _ty_s_sc_1.
data: lt_buffer type standard table of _ty_s_sc_1.
data: lu_buffer type _ty_s_sc_1.
data: lv_buffer type standard table of _ty_s_sc_1.
lt_buffer] = source_package[.
call function 'ZBW_FILTER'
exporting
i_info_object = 'DOC_TYPE'
i_source = 'EISDSO02'
i_target = 'ESSDO114'
i_sequence = '0001'
tables
t_inclusion = i_inc_doc_type
t_exclusion = i_exc_doc_type.
loop at lt_buffer into ls_buffer
.
*DELETE BY CRD_DATE
if ls_buffer-doc_type not in i_inc_doc_type.
delete lt_buffer.
continue.
endif.
datchange = 'N'.
* BEFORE IMAGE
if ls_buffer-recordmode = 'X'.
next_record = ls_buffer-record + 1.
*MODIFY LT_BUFFER FROM LS_BUFFER .
read table lt_buffer into lu_buffer
with key record = next_record.
if lu_buffer-recordmode = ' ' and
lu_buffer-doc_number = ls_buffer-doc_number and
lu_buffer-/bic/crd_date ls_buffer-/bic/crd_date.
datchange = 'Y'.
endif.
elseif ls_buffer-recordmode = 'N'.
datchange = 'Y'.
if datchange 'Y'.
delete lt_buffer.
continue.
endif.
endif.
*ENDLOOP.
*LOOP AT LT_BUFFER INTO LU_BUFFER.
if lu_buffer-recordmode = 'X'.
lu_buffer-recordmode = ' '.
modify lt_buffer from lu_buffer
transporting recordmode.
endif.
endloop.
Thanks
Jacko
Moderator message: please use more descriptive subject lines from now on, and code tags.
Edited by: Thomas Zloch on Nov 17, 2010 9:54 AM
‎2010 Nov 17 3:19 AM
Hi,
Change the prog as ... Move the endif.
BEFORE IMAGE
if ls_buffer-recordmode = 'X'.
next_record = ls_buffer-record + 1.
*MODIFY LT_BUFFER FROM LS_BUFFER .
read table lt_buffer into lu_buffer
with key record = next_record.
if lu_buffer-recordmode = ' ' and
lu_buffer-doc_number = ls_buffer-doc_number and
lu_buffer-/bic/crd_date ls_buffer-/bic/crd_date.
datchange = 'Y'.
endif.
elseif ls_buffer-recordmode = 'N'.
datchange = 'Y'.
*endif.* <-- close the If ...
if datchange 'Y'.
delete lt_buffer.
continue.
endif.
endif. <--remove this
Regards,
Srini.