Skip to Content
author's profile photo Former Member
Former Member

SAP Report that displays both Vendor Invoice and PO info

I have been told that there is no Standard SAP Report in AP that displays both the Vendor Invoice and the Purchase Order Quantity and Price. This would be similar to how you Display an Individual PO with ME23N (History Tab and Status Tab) but it would be a report with several PO's listed.

I have been told I could build a report which some companies have down all ready.

Thanks for any help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 15, 2012 at 06:49 AM

    Dear Joan

    For your requirement you have to develop a Z* report and have to put the loop on RBKP and then with the help of that RBKP move to BSEG and then with the help of BSEG you move to EKKO, EKPO and hence you will be able get all the desire details.

    Here is the details of report which we have developed with the help of our ABPER

    ************************************************************************************************************

    *&---------------------------------------------------------------------*

    *& Report ZMM_PUTCHASE

    *&

    *&---------------------------------------------------------------------*

    *&

    *&

    *&---------------------------------------------------------------------*

    REPORT ZMM_PURCHASE_TAX.

    TABLES: RBKP,RSEG,BKPF,BSEG,J_1IMOVEND,BSET,MAKT,T005S.

    TYPE-POOLS: SLIS.

    DATA ZPTC.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    SELECT-OPTIONS : SO_PDATE FOR RBKP-BUDAT OBLIGATORY,

    SO_PLANT FOR RSEG-WERKS ,

    SO_PRCTR FOR BSEG-PRCTR,

    SO_GSBER FOR BSEG-GSBER.

    SELECTION-SCREEN END OF BLOCK B1.

    *SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

    *PARAMETERS : P_FORM TYPE ZPTC-FORM.

    *SELECTION-SCREEN END OF BLOCK B2.

    *SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003. "state or central removed

    *PARAMETERS : P_STATE RADIOBUTTON GROUP RAD,

    * P_CENTR RADIOBUTTON GROUP RAD.

    *SELECTION-SCREEN END OF BLOCK B3.

    *SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-004. " REGISTRATION CHECK BOX NOT REQUIRED

    *PARAMETERS : P_REG AS CHECKBOX,

    * P_NONREG AS CHECKBOX.

    *SELECTION-SCREEN END OF BLOCK B4.

    TYPES: BEGIN OF X_RBKP,

    BELNR TYPE RBKP-BELNR, " Document Number of an Invoice Document

    GJAHR TYPE RBKP-GJAHR, " Fiscal Year

    LIFNR TYPE RBKP-LIFNR, " Vendor account number

    BUDAT TYPE RBKP-BUDAT, " Posting Date in the Document

    BLDAT TYPE RBKP-BLDAT, " Document Date in Document

    XBLNR TYPE RBKP-XBLNR, " Reference Document Number

    RMWWR TYPE RBKP-RMWWR, " Gross invoice amount in document currency

    WMWST1 TYPE RBKP-WMWST1, " Gross tax

    SGTXT TYPE RBKP-SGTXT, " Item Text

    AWKEY TYPE BKPF-AWKEY, " Reference Key

    BUZEI TYPE RSEG-BUZEI, " Document Item in Invoice Document

    MATNR TYPE RSEG-MATNR, " Material Number

    SHKZG TYPE RSEG-SHKZG, " Debit/Credit Indicator

    MENGE TYPE RSEG-MENGE, " Quantity

    KSCHL TYPE RSEG-KSCHL, " Condition Type

    WRBTR TYPE RSEG-WRBTR, " Amount in Document Currency

    END OF X_RBKP.

    TYPES: BEGIN OF X_LFA1,

    LIFNR TYPE LFA1-LIFNR, "Vendor Account Number

    ADRNR TYPE LFA1-ADRNR, "vendor Address Number

    REGIO TYPE LFA1-REGIO, "reGION NUMBER

    END OF X_LFA1.

    TYPES: BEGIN OF X_ADRC,

    ADDRNUMBER TYPE ADRC-ADDRNUMBER,

    NAME1 TYPE ADRC-NAME1,

    NAME2 TYPE ADRC-NAME2,

    STREET TYPE ADRC-STREET,

    CITY2 TYPE ADRC-CITY2,

    CITY1 TYPE ADRC-CITY1,

    POST_CODE1 TYPE ADRC-POST_CODE1,

    REGION TYPE ADRC-REGION,

    END OF X_ADRC.

    TYPES: BEGIN OF X_T005U,

    BLAND TYPE T005U-BLAND,

    BEZEI TYPE T005U-BEZEI,

    END OF X_T005U.

    TYPES: BEGIN OF X_MAKT,

    MAKTX TYPE MAKT-MAKTX,

    END OF X_MAKT.

    TYPES: BEGIN OF X_T005T,

    LAND1 TYPE T005T-LAND1,

    LANDX TYPE T005T-LANDX,

    END OF X_T005T.

    TYPES: BEGIN OF X_BKPF,

    BUKRS TYPE BKPF-BUKRS,

    BELNR TYPE BKPF-BELNR,

    GJAHR TYPE BKPF-GJAHR,

    AWKEY TYPE BKPF-AWKEY,

    END OF X_BKPF.

    TYPES: BEGIN OF X_BKPF1,

    BELNR TYPE BKPF-BELNR,

    GJAHR TYPE BKPF-GJAHR,

    END OF X_BKPF1.

    TYPES: BEGIN OF X_BSEG,

    BUKRS TYPE BSEG-BUKRS,

    BELNR TYPE BSEG-BELNR,

    GJAHR TYPE BSEG-GJAHR,

    BUZEI TYPE BSEG-BUZEI,

    MATNR TYPE BSEG-MATNR,

    AWKEY TYPE BKPF-AWKEY,

    END OF X_BSEG.

    TYPES: BEGIN OF X_BSET,

    BUKRS TYPE BSET-BUKRS,

    BELNR TYPE BSET-BELNR,

    GJAHR TYPE BSET-GJAHR,

    BUZEI TYPE BSET-BUZEI,

    KSCHL TYPE BSET-KSCHL,

    HWSTE TYPE BSET-HWSTE,

    MWSKZ TYPE BSET-MWSKZ,

    END OF X_BSET.

    TYPES: BEGIN OF X_J_1IMOVEND,

    LIFNR TYPE J_1IMOVEND-LIFNR,

    J_1ILSTNO TYPE J_1IMOVEND-J_1ILSTNO,

    END OF X_J_1IMOVEND.

    TYPES: BEGIN OF X_AWKEY,

    AWKEY TYPE BKPF-AWKEY,

    END OF X_AWKEY.

    TYPES: BEGIN OF X_ZPTC,

    COND TYPE ZPTC-COND,

    TAXN TYPE ZPTC-TAXN,

    TAXC TYPE ZPTC-TAXC,

    FORM TYPE ZPTC-FORM,

    END OF X_ZPTC.

    TYPES: BEGIN OF X_FINAL,

    SNO(3) TYPE C, "Serial Number

    BELNR TYPE BSET-BELNR, "Accounting Document Number

    INVOICE TYPE RBKP-BELNR, "Document Number of an Invoice Document

    GJAHR TYPE RBKP-GJAHR, "Fiscal year

    BUDAT TYPE RBKP-BUDAT, "Posting Date in the Billing Document

    BLDAT TYPE RBKP-BLDAT, "Document Date in Document

    XBLNR TYPE RBKP-XBLNR, "Reference Bill Number

    SGTXT TYPE RBKP-SGTXT, "Item Text

    J_1ILSTNO TYPE J_1IMOVEND-J_1ILSTNO, "TIN Number

    VENDOR_NAME(50) TYPE C, "Vendor Name

    LIFNR TYPE RBKP-LIFNR, "Vendor Account Number

    VENDOR_ADDRESS(50) TYPE C, "Vendor Address

    COUNTRY TYPE T005T-LANDX, "Country Name

    MATNR TYPE RSEG-MATNR, "Material Code

    MAKTX TYPE MAKT-MAKTX, "Material Description

    LOCATION(15) TYPE C, "For Location Detail 'within state' or 'outside state'

    MENGE TYPE RSEG-MENGE, "Quantity

    AMOUNT TYPE RBMA-WRBTR, "Amount in Document Currency

    SALESTAX TYPE BSET-HWSTE, "VAT in Local Currency

    CST TYPE BSET-HWSTE, "Central Sales Tax

    EXCISE TYPE BSET-HWSTE, "Excise Tax

    EDUTAX TYPE BSET-HWSTE, "Education Tax

    SEDUTAX TYPE BSET-HWSTE, "Secondary higher education Tax

    OTHERTAXES TYPE BSET-HWSTE, "Other Tax

    ENTRYTAX TYPE RSEG-WRBTR, "Entry TAx

    TOTALVALUE TYPE RBKP-RMWWR, "Total Amount

    TOTALTAX type bset-hwste, "Total Tax

    END OF X_FINAL.

    TYPES: BEGIN OF TY_T001W,

    WERKS TYPE T001W-WERKS,

    NAME1 TYPE T001W-NAME1,

    NAME2 TYPE T001W-NAME2,

    END OF TY_T001W.

    DATA: IT_RBKP TYPE STANDARD TABLE OF X_RBKP,

    WA_RBKP TYPE X_RBKP,

    IT_RBMA TYPE STANDARD TABLE OF X_RBKP,

    WA_RBMA TYPE X_RBKP,

    IT_LFA1 TYPE STANDARD TABLE OF X_LFA1,

    WA_LFA1 TYPE X_LFA1,

    IT_ADRC TYPE STANDARD TABLE OF X_ADRC,

    WA_ADRC TYPE X_ADRC,

    IT_BKPF TYPE STANDARD TABLE OF X_BKPF,

    WA_BKPF TYPE X_BKPF,

    IT_BKPF1 TYPE STANDARD TABLE OF X_BKPF1,

    WA_BKPF1 TYPE X_BKPF1,

    IT_BSEG TYPE STANDARD TABLE OF X_BSEG,

    WA_BSEG TYPE X_BSEG,

    IT_BSET TYPE STANDARD TABLE OF X_BSET,

    WA_BSET TYPE X_BSET,

    IT_J_1IMOVEND TYPE STANDARD TABLE OF X_J_1IMOVEND,

    WA_J_1IMOVEND TYPE X_J_1IMOVEND,

    IT_ZPTC TYPE STANDARD TABLE OF X_ZPTC,

    WA_ZPTC TYPE X_ZPTC,

    IT_FINAL TYPE STANDARD TABLE OF X_FINAL,

    WA_FINAL TYPE X_FINAL,

    IT_AWKEY TYPE STANDARD TABLE OF X_AWKEY,

    WA_AWKEY TYPE X_AWKEY,

    IT_T005U TYPE STANDARD TABLE OF X_T005U,

    WA_T005U TYPE X_T005U,

    IT_T001W TYPE TABLE OF TY_T001W,

    WA_T001W LIKE LINE OF IT_T001W,

    WA_T005T TYPE X_T005T,

    WA_MAKT TYPE X_MAKT,

    WA_T005S TYPE T005S.

    DATA: FLAG1 TYPE SY-TABIX,

    FLAG TYPE SY-TABIX,

    NAME(50) TYPE C, " Vendor Name

    ADDRESS(50) TYPE C, " Vendor Address

    COUNTER TYPE I VALUE 1,

    AMOUNT1 TYPE RBMA-WRBTR,

    AMOUNT2 TYPE RBMA-WRBTR,

    WA_FCAT TYPE SLIS_FIELDCAT_ALV,

    GT_FIELDCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,

    GS_LAYOUT TYPE SLIS_LAYOUT_ALV,

    IT_HEADER TYPE SLIS_T_LISTHEADER,

    WA_HEADER TYPE SLIS_LISTHEADER,

    L_DATE(30) TYPE C ,

    MONTH(15) TYPE C,

    LOC TYPE SY-TABIX.

    START-OF-SELECTION.

    PERFORM FETCH_DATA.

    PERFORM DATA_PROCESSING.

    PERFORM PREPARE_ALV_FIELDCAT.

    PERFORM PREPARE_ALV_LAYOUT.

    PERFORM HEADER_ALVD.

    PERFORM PRINT_ALV.

    *&---------------------------------------------------------------------*

    *& Form FETCH_DATA

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    * --> p1 text

    * <-- p2 text

    *----------------------------------------------------------------------*

    FORM FETCH_DATA .

    SELECT RBKP~BELNR RBKP~GJAHR RBKP~LIFNR RBKP~BUDAT RBKP~BLDAT RBKP~XBLNR RBKP~RMWWR RBKP~WMWST1 RBKP~SGTXT" Invoice Receipt related details.

    RSEG~BUZEI RSEG~MATNR RSEG~WERKS RSEG~SHKZG RSEG~MENGE RSEG~KSCHL RSEG~WRBTR

    FROM RBKP INNER JOIN RSEG

    ON RBKP~BELNR = RSEG~BELNR

    AND RBKP~GJAHR = RSEG~GJAHR

    INTO CORRESPONDING FIELDS OF TABLE IT_RBKP

    WHERE BUDAT IN SO_PDATE

    AND STBLG = ' ' "Check to avoid Reversed entries

    AND RSEG~WERKS IN SO_PLANT

    AND RSEG~MATNR NE ' '.

    IF SY-SUBRC NE 0.

    MESSAGE 'NO DATA FOUND FOR SELECTIONS PROVIDED' TYPE 'I'.

    LEAVE LIST-PROCESSING.

    ENDIF.

    CLEAR : WA_RBKP.

    LOOP AT IT_RBKP INTO WA_RBKP.

    CONCATENATE WA_RBKP-BELNR WA_RBKP-GJAHR INTO WA_RBKP-AWKEY.

    MODIFY IT_RBKP FROM WA_RBKP TRANSPORTING AWKEY WHERE BELNR = WA_RBKP-BELNR.

    CLEAR: WA_RBKP.

    ENDLOOP.

    SORT IT_RBKP BY BELNR MATNR.

    SELECT BUKRS BELNR GJAHR AWKEY " Fetching of Account Details

    FROM BKPF

    INTO CORRESPONDING FIELDS OF TABLE IT_BKPF

    FOR ALL ENTRIES IN IT_RBKP

    WHERE AWKEY = IT_RBKP-AWKEY.

    IF SY-SUBRC EQ 0.

    SORT IT_BKPF BY BUKRS BELNR GJAHR.

    ENDIF.

    SELECT BUKRS BELNR GJAHR BUZEI MATNR "Fetching Account related Line item details

    FROM BSEG

    INTO CORRESPONDING FIELDS OF TABLE IT_BSEG

    FOR ALL ENTRIES IN IT_BKPF

    WHERE BUKRS = IT_BKPF-BUKRS

    AND BELNR = IT_BKPF-BELNR

    AND GJAHR = IT_BKPF-GJAHR

    AND GSBER IN SO_GSBER

    AND PRCTR IN SO_PRCTR.

    SORT IT_BSEG BY BUKRS BELNR GJAHR.

    LOOP AT IT_BKPF INTO WA_BKPF.

    READ TABLE IT_BSEG INTO WA_BSEG WITH KEY BELNR = WA_BKPF-BELNR.

    WA_BSEG-AWKEY = WA_BKPF-AWKEY.

    MODIFY IT_BSEG FROM WA_BSEG TRANSPORTING AWKEY WHERE BELNR = WA_BKPF-BELNR.

    CLEAR: WA_BSEG, WA_BKPF.

    ENDLOOP.

    SORT IT_BSEG BY AWKEY MATNR.

    CLEAR: WA_RBKP, WA_BSEG.

    LOOP AT IT_BSEG INTO WA_BSEG.

    LOC = SY-TABIX.

    READ TABLE IT_RBKP INTO WA_RBKP WITH KEY BELNR = WA_BSEG-AWKEY+0(10).

    * MATNR = WA_BSEG-MATNR. " Check on Belnr as well as Matnr

    IF SY-SUBRC NE 0.

    DELETE IT_BSEG INDEX LOC.

    ENDIF.

    CLEAR: WA_RBKP, WA_BSEG.

    ENDLOOP.

    CLEAR: LOC.

    IF IT_BSEG[] IS NOT INITIAL.

    SELECT BUKRS BELNR GJAHR BUZEI MWSKZ HWSTE KSCHL "Fetching Tax Related Datas

    FROM BSET

    INTO CORRESPONDING FIELDS OF TABLE IT_BSET

    FOR ALL ENTRIES IN IT_BSEG

    WHERE BUKRS = IT_BSEG-BUKRS

    AND BELNR = IT_BSEG-BELNR

    AND GJAHR = IT_BSEG-GJAHR.

    * AND BUZEI = IT_BSEG-BUZEI. "removed coz complete datas not been fetched (BUZEI mismatch )

    ENDIF.

    SORT IT_BSET BY BELNR BUZEI.

    SORT IT_BSEG BY BELNR BUZEI.

    LOOP AT IT_BSEG INTO WA_BSEG.

    LOC = SY-TABIX.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    BUZEI = WA_BSEG-BUZEI.

    IF SY-SUBRC NE 0.

    DELETE IT_BSEG INDEX LOC.

    ENDIF.

    CLEAR: WA_BSET, WA_BSEG.

    ENDLOOP.

    IF IT_RBKP[] IS NOT INITIAL. " for fetching vendor related details

    SELECT LIFNR ADRNR REGIO

    FROM LFA1

    INTO CORRESPONDING FIELDS OF TABLE IT_LFA1

    FOR ALL ENTRIES IN IT_RBKP

    WHERE LIFNR = IT_RBKP-LIFNR.

    IF SY-SUBRC EQ 0.

    SELECT ADDRNUMBER NAME1 NAME2 STREET CITY2 CITY1 POST_CODE1 REGION "address

    FROM ADRC

    INTO CORRESPONDING FIELDS OF TABLE IT_ADRC

    FOR ALL ENTRIES IN IT_LFA1

    WHERE ADDRNUMBER = IT_LFA1-ADRNR.

    IF SY-SUBRC EQ 0.

    SELECT BLAND BEZEI

    FROM T005U

    INTO CORRESPONDING FIELDS OF TABLE IT_T005U

    FOR ALL ENTRIES IN IT_ADRC

    WHERE BLAND = IT_ADRC-REGION

    AND LAND1 = 'IN'

    AND SPRAS = 'EN'.

    ENDIF.

    ENDIF.

    ENDIF.

    IF IT_RBKP[] IS NOT INITIAL.

    SELECT BELNR WRBTR SHKZG MATNR

    FROM RBMA

    INTO CORRESPONDING FIELDS OF TABLE IT_RBMA

    FOR ALL ENTRIES IN IT_RBKP

    WHERE BELNR = IT_RBKP-BELNR

    AND GJAHR = IT_RBKP-GJAHR

    AND BUZEI = IT_RBKP-BUZEI

    AND MATNR = IT_RBKP-MATNR.

    SELECT LIFNR J_1ILSTNO

    FROM J_1IMOVEND

    INTO CORRESPONDING FIELDS OF TABLE IT_J_1IMOVEND

    FOR ALL ENTRIES IN IT_RBKP

    WHERE LIFNR = IT_RBKP-LIFNR.

    * IF P_REG = 'X' AND P_NONREG =' '. " fetching of TIN number.

    *

    * SELECT LIFNR J_1ILSTNO

    * FROM J_1IMOVEND

    * INTO CORRESPONDING FIELDS OF TABLE IT_J_1IMOVEND

    * FOR ALL ENTRIES IN IT_RBKP

    * WHERE LIFNR = IT_RBKP-LIFNR

    * AND J_1ILSTNO NE ' '.

    *

    *

    *

    *

    * ELSEIF P_NONREG = 'X' AND P_REG = ' '.

    *

    * SELECT LIFNR J_1ILSTNO

    * FROM J_1IMOVEND

    * INTO CORRESPONDING FIELDS OF TABLE IT_J_1IMOVEND

    * FOR ALL ENTRIES IN IT_RBKP

    * WHERE LIFNR = IT_RBKP-LIFNR

    * AND J_1ILSTNO EQ ' '.

    *

    *

    *

    * ELSE.

    * SELECT LIFNR J_1ILSTNO

    * FROM J_1IMOVEND

    * INTO CORRESPONDING FIELDS OF TABLE IT_J_1IMOVEND

    * FOR ALL ENTRIES IN IT_RBKP

    * WHERE LIFNR = IT_RBKP-LIFNR.

    *

    * ENDIF.

    ENDIF.

    * IF P_STATE = 'X'. "checkbox for state or central removed

    SELECT * "Data selection for STATE only

    FROM ZPTC

    INTO CORRESPONDING FIELDS OF TABLE IT_ZPTC.

    * WHERE TAXN NE 'CT'.

    * ELSE.

    * SELECT * "Data selection for CENTRAL only

    * FROM ZPTC

    * INTO CORRESPONDING FIELDS OF TABLE IT_ZPTC

    * WHERE TAXN NE 'ST'.

    * ENDIF.

    ENDFORM. " FETCH_DATA

    **&---------------------------------------------------------------------*

    **& Form DATA_PROCESSING

    **&---------------------------------------------------------------------*

    ** text

    **----------------------------------------------------------------------*

    ** --> p1 text

    ** <-- p2 text

    **----------------------------------------------------------------------*

    FORM DATA_PROCESSING .

    SORT IT_ZPTC BY COND TAXC.

    SORT IT_BSEG BY BELNR BUZEI.

    SORT IT_BSET BY BELNR BUZEI.

    SORT IT_BKPF BY BELNR.

    SORT IT_RBKP BY BELNR BUZEI.

    SORT IT_J_1IMOVEND BY LIFNR.

    SORT IT_LFA1 BY LIFNR.

    SORT IT_ADRC BY ADDRNUMBER.

    SORT IT_T005U BY BLAND.

    SORT IT_RBMA BY MATNR.

    LOOP AT IT_RBKP INTO WA_RBKP.

    WA_FINAL-BUDAT = WA_RBKP-BUDAT. " Posting Date

    WA_FINAL-BLDAT = WA_RBKP-BLDAT. " Billing Date

    WA_FINAL-XBLNR = WA_RBKP-XBLNR. " Reference Bill Number

    WA_FINAL-SGTXT = WA_RBKP-SGTXT. " Item Text

    WA_FINAL-LIFNR = WA_RBKP-LIFNR. " Vendor Account Number

    * WA_FINAL-TOTALVALUE = WA_RBKP-RMWWR. " Gross invoice amount in document currency

    WA_FINAL-INVOICE = WA_RBKP-BELNR. " Invoice Number

    WA_FINAL-MATNR = WA_RBKP-MATNR. " Material Number

    WA_FINAL-MENGE = WA_RBKP-MENGE. " Bill Quantity

    WA_FINAL-AMOUNT = WA_RBKP-WRBTR. " Amount

    WA_FINAL-GJAHR = WA_RBKP-GJAHR. " Fiscal Year

    READ TABLE IT_J_1IMOVEND INTO WA_J_1IMOVEND WITH KEY LIFNR = WA_RBKP-LIFNR .

    IF SY-SUBRC EQ 0.

    WA_FINAL-J_1ILSTNO = WA_J_1IMOVEND-J_1ILSTNO. " Tin Number

    ENDIF.

    READ TABLE IT_LFA1 INTO WA_LFA1 WITH KEY LIFNR = WA_RBKP-LIFNR .

    READ TABLE IT_ADRC INTO WA_ADRC WITH KEY ADDRNUMBER = WA_LFA1-ADRNR.

    IF SY-SUBRC EQ 0.

    READ TABLE IT_T005U INTO WA_T005U WITH KEY BLAND = WA_ADRC-REGION.

    IF SY-SUBRC EQ 0.

    WA_FINAL-LOCATION = WA_T005U-BEZEI.

    ENDIF.

    CONCATENATE WA_ADRC-NAME1 WA_ADRC-NAME2 INTO NAME SEPARATED BY SPACE.

    WA_FINAL-VENDOR_NAME = NAME. " Vendor Name

    CONCATENATE WA_ADRC-STREET WA_ADRC-CITY2 WA_ADRC-CITY1 WA_ADRC-POST_CODE1 WA_T005U-BEZEI INTO ADDRESS SEPARATED BY SPACE.

    WA_FINAL-VENDOR_ADDRESS = ADDRESS. " Vendor Address

    ENDIF.

    SELECT SINGLE MAKTX FROM MAKT INTO WA_MAKT-MAKTX WHERE MATNR = WA_RBKP-MATNR.

    IF SY-SUBRC EQ 0. " Material Text

    WA_FINAL-MAKTX = WA_MAKT-MAKTX.

    ENDIF.

    read table IT_BSEG INTO WA_BSEG with key AWKEY+0(10) = WA_RBKP-BELNR.

    if sy-subrc eq 0.

    WA_FINAL-BELNR = WA_BSEG-BELNR. " Account Document Number

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JIPL'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-SALESTAX = WA_BSET-HWSTE. " Sales Tax (VAT)

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE. " Base Amount + Sales Tax

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JMOP'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-EXCISE = WA_BSET-HWSTE. " Excise Duty.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JMX1'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-EXCISE = WA_BSET-HWSTE. " Excise Duty.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JAOP'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-EXCISE = WA_BSET-HWSTE. " Excise Duty.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JAX1'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-EXCISE = WA_BSET-HWSTE. "Excise Duty.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JIPC'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-CST = WA_BSET-HWSTE. "Central Duty

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JMIP'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-EXCISE = WA_BSET-HWSTE. "Excise Duty.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JMX2'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-EXCISE = WA_BSET-HWSTE. "Excise Duty.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JECP'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-OTHERTAXES = WA_FINAL-OTHERTAXES + WA_BSET-HWSTE. "Other Taxes

    WA_FINAL-TOTALTAX = wa_final-TOTALTAX + wa_bset-hwste.

    delete table it_bset from wa_bset.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    KSCHL = 'JEX1'.

    if sy-subrc eq 0.

    WA_FINAL-OTHERTAXES = WA_FINAL-OTHERTAXES + WA_BSET-HWSTE. "Other Taxes

    wa_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    endif.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    KSCHL = 'JHX1'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-OTHERTAXES = WA_FINAL-OTHERTAXES + WA_BSET-HWSTE. "Other Taxes

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    KSCHL = 'JSEP'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-OTHERTAXES = WA_FINAL-OTHERTAXES + WA_BSET-HWSTE. "Other Taxes

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    KSCHL = 'JECI'. "Education tax

    IF SY-SUBRC EQ 0.

    WA_FINAL-EDUTAX = WA_BSET-HWSTE.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    KSCHL = 'JSEI'. "Secondary Higher Education tax

    IF SY-SUBRC EQ 0.

    WA_FINAL-SEDUTAX = WA_BSET-HWSTE.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    READ TABLE IT_BSET INTO WA_BSET WITH KEY BELNR = WA_BSEG-BELNR

    * BUZEI = WA_BSEG-BUZEI

    KSCHL = 'JMIQ'. "Excise Duty

    IF SY-SUBRC EQ 0.

    WA_FINAL-EXCISE = WA_BSET-HWSTE. " Excise Duty.

    WA_FINAL-TOTALTAX = WA_FINAL-TOTALTAX + WA_BSET-HWSTE.

    DELETE TABLE IT_BSET FROM WA_BSET.

    ENDIF.

    ENDif.

    SELECT SINGLE LAND1 LANDX FROM T005T INTO CORRESPONDING FIELDS OF WA_T005T WHERE SPRAS = 'EN' AND LAND1 = 'IN'.

    IF SY-SUBRC EQ 0.

    WA_FINAL-COUNTRY = WA_T005T-LANDX.

    ENDIF.

    WA_FINAL-SNO = COUNTER.

    * WA_FINAL-TOTALVALUE = WA_FINAL-AMOUNT + WA_FINAL-SALESTAX + WA_FINAL-CST + WA_FINAL-EXCISE + WA_FINAL-ENTRYTAX.

    WA_FINAL-TOTALVALUE = WA_FINAL-AMOUNT + WA_FINAL-TOTALTAX.

    APPEND WA_FINAL TO IT_FINAL.

    CLEAR: WA_BSEG, WA_RBKP, WA_J_1IMOVEND, WA_LFA1, WA_ADRC , WA_T005U, WA_ZPTC, WA_FINAL.

    COUNTER = COUNTER + 1.

    ENDLOOP.

    ENDFORM. " DATA_PROCESSING

    **&---------------------------------------------------------------------*

    **& Form PREPARE_ALV_FIELDCAT

    **&---------------------------------------------------------------------*

    ** text

    **----------------------------------------------------------------------*

    ** --> p1 text

    ** <-- p2 text

    **----------------------------------------------------------------------*

    FORM PREPARE_ALV_FIELDCAT .

    PERFORM CATALOG USING 'SNO' 'IT_FINAL' 'Serial Number' '1' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'INVOICE' 'IT_FINAL' 'Invoice Number' '2' '18' ' ' 'C110' 'X' 'L'.

    PERFORM CATALOG USING 'BELNR' 'IT_FINAL' 'Voucher Number' '3' '18' ' ' 'C100' ' ' 'L'.

    PERFORM CATALOG USING 'GJAHR' 'IT_FINAL' 'Fiscal Year' '4' '18' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'BUDAT' 'IT_FINAL' 'Posting Date' '5' '18' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'BLDAT' 'IT_FINAL' 'Billing Date' '6' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'XBLNR' 'IT_FINAL' 'Reference Bill Number' '7' '20' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'SGTXT' 'IT_FINAL' 'Item Text' '8' '17' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'J_1ILSTNO' 'IT_FINAL' 'TIN Number' '9' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'VENDOR_NAME' 'IT_FINAL' 'Vendor Name' '10' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'LIFNR' 'IT_FINAL' 'Vendor Account Number' '11' '20' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'VENDOR_ADDRESS' 'IT_FINAL' 'Vendor Address' '12' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'COUNTRY' 'IT_FINAL' 'Country' '13' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'MATNR' 'IT_FINAL' 'Material Code' '14' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'MAKTX' 'IT_FINAL' 'Material Description' '15' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'LOCATION' 'IT_FINAL' 'Location' '16' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'MENGE' 'IT_FINAL' 'Quantity' '17' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'AMOUNT' 'IT_FINAL' 'Amount' '18' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'SALESTAX' 'IT_FINAL' 'Sales Tax' '19' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'CST' 'IT_FINAL' 'Central Sales Tax' '20' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'EXCISE' 'IT_FINAL' 'Excise Duty' '21' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'EDUTAX' 'IT_FINAL' 'Education Cess' '22' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'SEDUTAX' 'IT_FINAL' 'Sec Hr.Education Cess' '23' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'ENTRYTAX' 'IT_FINAL' 'Entry Tax' '24' '10' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'TOTALTAX' 'IT_FINAL' 'Total Tax' '25' '15' ' ' ' ' ' ' 'L'.

    PERFORM CATALOG USING 'TOTALVALUE' 'IT_FINAL' 'Grand Total' '26' '15' ' ' ' ' ' ' 'L'.

    ENDFORM. " PREPARE_ALV_FIELDCAT

    **&---------------------------------------------------------------------*

    **& Form CATALOG

    **&---------------------------------------------------------------------*

    ** text

    **----------------------------------------------------------------------*

    ** -->P_2031 text

    ** -->P_2032 text

    ** -->P_2033 text

    ** -->P_2034 text

    ** -->P_2035 text

    **----------------------------------------------------------------------*

    FORM CATALOG USING FNAM

    TNAM

    FVAL

    COLPOS

    FLEN

    SUM

    EMPHASIZE

    HOTSPOT

    JUST.

    CLEAR WA_FCAT.

    WA_FCAT-FIELDNAME = FNAM.

    WA_FCAT-TABNAME = TNAM.

    WA_FCAT-SELTEXT_S = FVAL.

    WA_FCAT-SELTEXT_M = FVAL.

    WA_FCAT-SELTEXT_L = FVAL.

    WA_FCAT-COL_POS = COLPOS.

    WA_FCAT-OUTPUTLEN = FLEN.

    WA_FCAT-DO_SUM = SUM.

    WA_FCAT-EMPHASIZE = EMPHASIZE.

    WA_FCAT-HOTSPOT = HOTSPOT.

    APPEND WA_FCAT TO GT_FIELDCAT.

    ENDFORM. " CATALOG

    **&---------------------------------------------------------------------*

    **& Form PREPARE_ALV_LAYOUT

    **&---------------------------------------------------------------------*

    ** text

    **----------------------------------------------------------------------*

    ** --> p1 text

    ** <-- p2 text

    **----------------------------------------------------------------------*

    FORM PREPARE_ALV_LAYOUT .

    GS_LAYOUT-DETAIL_INITIAL_LINES = 'X'.

    GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

    GS_LAYOUT-NO_COLHEAD = SPACE.

    GS_LAYOUT-INFO_FIELDNAME = 'COLO'.

    GS_LAYOUT-NUMC_SUM = 'X'.

    ENDFORM. " PREPARE_ALV_LAYOUT

    **&---------------------------------------------------------------------*

    **& Form HEADER_ALVD

    **&---------------------------------------------------------------------*

    ** text

    **----------------------------------------------------------------------*

    ** --> p1 text

    ** <-- p2 text

    **----------------------------------------------------------------------*

    FORM HEADER_ALVD .

    WA_HEADER-TYP = 'H'.

    WA_HEADER-INFO = 'Report on Purchase '.

    APPEND WA_HEADER TO IT_HEADER.

    CLEAR: WA_HEADER.

    WA_HEADER-TYP = 'S'. " NOT

    WA_HEADER-KEY = 'Plant Name :'.

    SELECT SINGLE WERKS NAME1 NAME2 FROM T001W INTO WA_T001W WHERE WERKS IN SO_PLANT.

    WA_HEADER-INFO = WA_T001W-NAME1.

    APPEND WA_HEADER TO IT_HEADER.

    CASE SY-DATUM+4(2).

    WHEN '01'.

    MONTH = 'JANUARY'.

    WHEN '02'.

    MONTH = 'FEBRUARY'.

    WHEN '03'.

    MONTH = 'MARCH'.

    WHEN '04'.

    MONTH = 'APRIL'.

    WHEN '05'.

    MONTH = 'MAY'.

    WHEN '06'.

    MONTH = 'JUNE'.

    WHEN '07'.

    MONTH = 'JULY'.

    WHEN '08'.

    MONTH = 'AUGUST'.

    WHEN '09'.

    MONTH = 'SEPTEMBER'.

    WHEN '10'.

    MONTH = 'OCTOBER'.

    WHEN '11'.

    MONTH = 'NOVEMBER'.

    WHEN '12'.

    MONTH = 'DECEMBER'.

    ENDCASE.

    CONCATENATE SY-DATUM+6(2) MONTH SY-DATUM+0(4) INTO L_DATE SEPARATED BY SPACE.

    WA_HEADER-TYP = 'S'.

    WA_HEADER-KEY = 'Current Date :'.

    WA_HEADER-INFO = L_DATE.

    APPEND WA_HEADER TO IT_HEADER.

    ENDFORM. " HEADER_ALVD

    *

    **&---------------------------------------------------------------------*

    **& Form HEADER

    **&---------------------------------------------------------------------*

    ** text

    **----------------------------------------------------------------------*

    FORM HEADER.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    IT_LIST_COMMENTARY = IT_HEADER

    I_LOGO = 'SISL_LOGO'

    * I_END_OF_LIST_GRID =

    * I_ALV_FORM =

    .

    ENDFORM . "HEADER

    *

    **&---------------------------------------------------------------------*

    **& Form PRINT_ALV

    **&---------------------------------------------------------------------*

    ** text

    **----------------------------------------------------------------------*

    ** --> p1 text

    ** <-- p2 text

    **----------------------------------------------------------------------*

    FORM PRINT_ALV .

    DATA: LOC_PROGRAM TYPE SY-REPID.

    LOC_PROGRAM = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = LOC_PROGRAM

    * I_CALLBACK_PF_STATUS_SET = ' '

    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

    I_CALLBACK_TOP_OF_PAGE = 'HEADER'

    * I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    * I_CALLBACK_HTML_END_OF_LIST = ' '

    * I_STRUCTURE_NAME =

    I_BACKGROUND_ID = 'ALV_BACKGROUND'

    * I_GRID_TITLE =

    * I_GRID_SETTINGS =

    IS_LAYOUT = GS_LAYOUT

    IT_FIELDCAT = GT_FIELDCAT[]

    TABLES

    T_OUTTAB = IT_FINAL.

    IF SY-SUBRC <> 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " PRINT_ALV

    *&---------------------------------------------------------------------*

    *& Form USER_COMMAND

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    * -->V_UCOMM text

    * -->WA_SELROW text

    *----------------------------------------------------------------------*

    FORM USER_COMMAND USING V_UCOMM LIKE SY-UCOMM

    WA_SELROW TYPE SLIS_SELFIELD.

    CASE V_UCOMM.

    WHEN '&IC1'.

    IF WA_SELROW-FIELDNAME = 'INVOICE'.

    READ TABLE IT_FINAL INTO WA_FINAL INDEX WA_SELROW-TABINDEX.

    SET PARAMETER ID 'RBN' FIELD WA_FINAL-INVOICE.

    SET PARAMETER ID 'GJR' FIELD WA_FINAL-GJAHR.

    CALL TRANSACTION 'MIR4'.

    ENDIF.

    ENDCASE.

    ENDFORM. "USER_COMMAND

    **********************************************************************************************************

    Regards

    Ashish Mishra

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 14, 2012 at 10:04 PM

    dear,

    as far as i know there is no such exact report😢

    but,

    there are some options for you

    please look here:

    http://scn.sap.com/thread/2044261

    http://scn.sap.com/thread/1078543

    http://scn.sap.com/thread/2039048

    good luck!🤣

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.