Hi ,
I want to display all content of CDHDR & CDPOS by custom BAPI.I didnt get the output. Can you please check my coding & correct it. its Urgent.
Tables: cdhdr,cdpos.
ranges : r_udate for cdhdr-udate. " Creation date of change document
data: ir_objectid like cdhdr-objectid.
Data: msgv1 like sy-msgv1,
msgv2 like sy-msgv2,
msgv3 like sy-msgv3,
msgv4 like sy-msgv4.
select distinct objectid into ir_objectid from cdhdr
where objectclas = 'KOSTL'
and udate in r_udate
and tcode eq transactioncode.
if sy-subrc <> 0.
delete it_cdhdr.
msgv1 = transactioncode.
msgv2 = datasize.
msgv3 = no_of_days_from.
msgv4 = no_of_days_to.
perform set_bapireturn
tables return
using 'I' 'E!' '024' msgv1 msgv2 msgv3 msgv4 '1'.
endif.
.
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
OBJECTCLASS = 'KOSTL'
OBJECTID = ir_objectid
TABLES
I_CDHDR = it_cdhdr
EXCEPTIONS
NO_POSITION_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Endselect.
Loop at it_cdhdr.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
CHANGENUMBER = it_cdhdr-CHANGENR
IMPORTING
HEADER = cdhdr
TABLES
EDITPOS = it_cdpos
EDITPOS_WITH_HEADER = it_cdhdr
EXCEPTIONS
NO_POSITION_FOUND = 4
OTHERS = 8.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endloop.
ENDFUNCTION.