Skip to Content
0
Former Member
Aug 04, 2014 at 04:50 PM

problem in sales return report

24 Views

Hi experts,

I Face a problem in my report are , in my sales return prog it not fetch the record related tax code 06 eitherly it show 05 or SR taxcode record i see already it in debug mode or check data in table .pls help me to resolve the issue, i post my getdata subroutine i found the 06 entry in table bseg but my sql can't fetch it .


pls help me to resolve the issue


thanks

F.K



FORM GET_DATA_FOR_INPUT.
CLEAR ITAB_SALES_TAX.

SELECT
BILDOC
BILYEAR
INV_NO
INV_DATE
INTO CORRESPONDING FIELDS OF TABLE RTAB
FROM ZSRRET.




SELECT * FROM BKPF
WHERE BUKRS IN BUKRS
AND BSTAT LIKE '%'
AND BUDAT IN BUDAT.
CHECK BKPF-BELNR IN DOCNO.
CHECK BKPF-BLART IN BLART.
CHECK BKPF-GJAHR IN GJAHR.
SELECT * FROM BSEG
WHERE BUKRS = BKPF-BUKRS
AND BELNR = BKPF-BELNR
AND GJAHR = BKPF-GJAHR.
CHECK BSEG-TXJCD IN TXJCD.
CHECK BSEG-MWSKZ IN MWSKZ.

MOVE BKPF-BLART TO ITAB_SALES_TAX-BLART.
MOVE BKPF-BELNR TO ITAB_SALES_TAX-BELNR.
MOVE BKPF-BUKRS TO ITAB_SALES_TAX-BUKRS.
MOVE BKPF-GJAHR TO ITAB_SALES_TAX-GJAHR.
MOVE BKPF-BUDAT TO ITAB_SALES_TAX-BUDAT.
MOVE BKPF-XBLNR TO ITAB_SALES_TAX-XBLNR.
MOVE BKPF-BLDAT TO ITAB_SALES_TAX-BLDAT.
MOVE BSEG-MWSKZ TO ITAB_SALES_TAX-MWSKZ.

* MOVE BSEG-GSBER TO ITAB_SALES_TAX-GSBER.

MOVE BKPF-AWTYP TO ITAB_SALES_TAX-AWTYP.
MOVE BKPF-AWKEY TO ITAB_SALES_TAX-AWKEY.
MOVE BKPF-XBLNR TO ITAB_SALES_TAX-VBELN.
SELECT SINGLE * FROM J_1IEXCHDR WHERE RDOC = BKPF-XBLNR AND
* RYEAR = BKPF-RYEAR AND
RIND = 'N'.
IF SY-SUBRC = '0'.
ITAB_SALES_TAX-EXCINV = J_1IEXCHDR-EXNUM.
ENDIF.
ITAB_SALES_TAX-DISAMT = 0.
IF BSEG-HKONT = '0000073011' AND BSEG-SHKZG = 'S'.
ITAB_SALES_TAX-DISAMT = ITAB_SALES_TAX-DISAMT + BSEG-WRBTR.
ENDIF.
IF BSEG-HKONT = '0000071101' OR BSEG-HKONT = '0000071001'
OR BSEG-HKONT = '0000071301' OR BSEG-HKONT = '0000071501'
OR BSEG-HKONT = '0000071201'
OR BSEG-HKONT = '0000071551' OR BSEG-HKONT = '0000071401'.
IF BSEG-SHKZG = 'H'.
* itab_sales_tax-excamt = bseg-wrbtr.
ENDIF.
ENDIF.
SELECT * FROM *BSEG
WHERE BUKRS = BSEG-BUKRS
AND BELNR = BSEG-BELNR
AND GJAHR = BSEG-GJAHR
AND KOART = 'D'.
ENDSELECT.
CHECK SY-SUBRC EQ 0.

SELECT SINGLE * FROM KNA1
WHERE KUNNR = *BSEG-KUNNR.
CHECK SY-SUBRC EQ 0.
CLEAR : ITAB_SALES_TAX-WRBTR.
SELECT SINGLE * FROM KNVA
WHERE KUNNR = KNA1-KUNNR.
IF SY-SUBRC <> 0.
CLEAR KNVA.
ELSE.
MOVE KNVA-ABLAD TO ITAB_SALES_TAX-ABLAD.
ENDIF.
MOVE *BSEG-KUNNR TO ITAB_SALES_TAX-KUNNR.
MOVE KNA1-NAME1 TO ITAB_SALES_TAX-NAME1.
MOVE KNA1-ORT01 TO ITAB_SALES_TAX-ORT01.
COLLECT ITAB_SALES_TAX.
CLEAR ITAB_SALES_TAX.
ENDSELECT.
ENDSELECT.
ENDFORM. "GET_DATA_FOR_INPUT