Hi Raj,
I guess your code is going wrong!
- At the time of billing document creation and the excise document also creating internally
- Since RDOC is not a key field in J_1IEXCHDR table. So, Please provide me the screen shot ta for one RDOC how many EXNUM are showing in excise invoice table.
- Your coding is confusing and might me expecting some where wrong!
* If you observe the below select is it one to one relation ( RDOC = VEBELN ) check the table
SELECT SINGLE exnum rdoc exdat cpudt cputm remtime
FROM j_1iexchdr INTO CORRESPONDING FIELDS OF it_add
WHERE rdoc = vbeln
and docyr = '2013'.
* I understand that based on the partner function your selecting the query ( KUNAG, KUNRG) . Have you checked/DEBUG which VBELN is picking from the table.
SELECT SINGLE kunrg
vbeln
fkdat
fkart
regio
land1
kunrg
bukrs
zterm
erdat
erzet
xblnr
FROM vbrk INTO CORRESPONDING FIELDS OF it_add
WHERE vbeln = vbeln and
RFBSK NE 'E'.
IF you see the VBRK table the cancel document should like this, You should not pick the document. In debug check the document number and check the VBRK table.
IT_ADD is your driving table , apart from this I did't find any other issue.