Skip to Content
0
Dec 11, 2009 at 11:03 AM

Reg:Combining two display list into one

12 Views

&----


*

*& Form F_006_DISPLAY_LIST

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM F_006_DISPLAY_LIST.

  • TABLES : LFA1 .

DATA : V_DEBIT_TOTAL TYPE P DECIMALS 2 ,

V_CREDIT_TOTAL TYPE P DECIMALS 2 ,

V_CLOSE_BAL TYPE P DECIMALS 2 .

DATA : V_CNT TYPE I .

SORT ITAB_OPG BY LIFNR.

LOOP AT ITAB_OPG.

NEW-PAGE.

  • Displaying Vendor Name

SELECT SINGLE NAME1 FROM LFA1 INTO LFA1-NAME1 WHERE

LIFNR EQ ITAB_OPG-LIFNR .

FORMAT COLOR COL_POSITIVE INTENSIFIED ON.

WRITE:/2 'Vendor Code:' ,

ITAB_OPG-LIFNR ,

40 LFA1-NAME1 .

CLEAR : LFA1 .

WRITE :/(190) SY-ULINE .

  • Displaying Opening Balance

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .

READ TABLE ITAB_OPG WITH KEY LIFNR = ITAB_OPG-LIFNR .

IF ITAB_OPG-BAL LE 0 .

WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,

171(18) ITAB_OPG-BAL .

ELSE.

WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,

151(18) ITAB_OPG-BAL .

ENDIF.

WRITE :/(190) SY-ULINE .

  • Displaying Line Items

LOOP AT ITAB_DISPLAY WHERE LIFNR EQ ITAB_OPG-LIFNR.

V_CNT = SY-TABIX MOD 2.

IF V_CNT EQ 0.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

ELSE.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

ENDIF.

  • Selecting Bank Name and Cheque Number

SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)

FROM PAYR WHERE

ZBUKR EQ P_BUKRS AND

VBLNR EQ ITAB_DISPLAY-BELNR AND

LIFNR EQ ITAB_DISPLAY-LIFNR .

SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM

T012 WHERE BUKRS EQ P_BUKRS AND

HBKID EQ PAYR-HBKID.

SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE

BANKS EQ T012-BANKS AND

BANKL EQ T012-BANKL .

WRITE :/2 ITAB_DISPLAY-BUDAT ,

14 ITAB_DISPLAY-BELNR ,

26 ITAB_DISPLAY-BLDAT ,

40 ITAB_DISPLAY-XBLNR ,

58(16) PAYR-CHECT ,

75 BNKA-BANKA ,

105(40) ITAB_DISPLAY-SGTXT ,

146(4) ITAB_DISPLAY-BLART .

  • Determinig Debit or Credit

IF ITAB_DISPLAY-SHKZG EQ 'S'.

V_DEBIT_TOTAL = V_DEBIT_TOTAL + ITAB_DISPLAY-DMBTR.

WRITE:151(18) ITAB_DISPLAY-DMBTR ,

171(18) SPACE .

ELSEIF ITAB_DISPLAY-SHKZG EQ 'H'.

V_CREDIT_TOTAL = V_CREDIT_TOTAL + ITAB_DISPLAY-DMBTR.

WRITE:151(18) SPACE ,

171(18) ITAB_DISPLAY-DMBTR .

ENDIF.

CLEAR : T012 , BNKA , PAYR .

ENDLOOP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/(190) SY-ULINE.

  • Displaying Debit and Credit Totals

WRITE:/125 TEXT-001 ,

151(18) V_DEBIT_TOTAL ,

171(18) V_CREDIT_TOTAL .

WRITE:/(190) SY-ULINE.

  • Displaying the Closing Balance

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

V_CLOSE_BAL = ITAB_OPG-BAL + V_DEBIT_TOTAL - V_CREDIT_TOTAL .

IF V_CLOSE_BAL GT 0.

WRITE:/122 TEXT-002 ,

151(18) V_CLOSE_BAL NO-SIGN. " D00K909674

ELSEIF V_CLOSE_BAL LE 0.

WRITE:/122 TEXT-002 ,

171(18) V_CLOSE_BAL NO-SIGN. " D00K909674

ENDIF.

CLEAR : V_CLOSE_BAL.

ENDLOOP.

ENDFORM. " F_006_DISPLAY_LIST

&----


*& Form F_006_DISPLAY_LIST1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM F_006_DISPLAY_LIST1 .

TABLES : KNA1 .

DATA : V_DEBIT_TOTAL1 TYPE P DECIMALS 2 ,

V_CREDIT_TOTAL1 TYPE P DECIMALS 2 ,

V_CLOSE_BAL1 TYPE P DECIMALS 2 .

DATA : V_CNT1 TYPE I .

SORT ITAB_OPG1 BY KUNNR.

LOOP AT ITAB_OPG1.

NEW-PAGE.

  • Displaying Vendor Name

SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1 WHERE

KUNNR EQ ITAB_OPG1-KUNNR .

FORMAT COLOR COL_POSITIVE INTENSIFIED ON.

WRITE:/2 'Customer Code:' ,

ITAB_OPG1-KUNNR ,

40 KNA1-NAME1 .

CLEAR : KNA1 .

WRITE :/(190) SY-ULINE .

  • Displaying Opening Balance

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .

READ TABLE ITAB_OPG1 WITH KEY KUNNR = ITAB_OPG1-KUNNR .

IF ITAB_OPG1-BAL1 LE 0 .

WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,

171(18) ITAB_OPG1-BAL1 .

ELSE.

WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,

151(18) ITAB_OPG1-BAL1 .

ENDIF.

WRITE :/(190) SY-ULINE .

  • Displaying Line Items

LOOP AT ITAB_DISPLAY1 WHERE KUNNR EQ ITAB_OPG1-KUNNR.

V_CNT1 = SY-TABIX MOD 2.

IF V_CNT1 EQ 0.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

ELSE.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

ENDIF.

  • Selecting Bank Name and Cheque Number

SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)

FROM PAYR WHERE

ZBUKR EQ P_BUKRS AND

VBLNR EQ ITAB_DISPLAY1-BELNR AND

KUNNR EQ ITAB_DISPLAY1-KUNNR .

SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM

T012 WHERE BUKRS EQ P_BUKRS AND

HBKID EQ PAYR-HBKID.

SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE

BANKS EQ T012-BANKS AND

BANKL EQ T012-BANKL .

WRITE :/2 ITAB_DISPLAY1-BUDAT ,

14 ITAB_DISPLAY1-BELNR ,

26 ITAB_DISPLAY1-BLDAT ,

40 ITAB_DISPLAY1-XBLNR ,

58(16) PAYR-CHECT ,

75 BNKA-BANKA ,

105(40) ITAB_DISPLAY1-SGTXT ,

146(4) ITAB_DISPLAY1-BLART .

  • Determinig Debit or Credit

IF ITAB_DISPLAY1-SHKZG EQ 'S'.

V_DEBIT_TOTAL1 = V_DEBIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.

WRITE:151(18) ITAB_DISPLAY1-DMBTR ,

171(18) SPACE .

ELSEIF ITAB_DISPLAY1-SHKZG EQ 'H'.

V_CREDIT_TOTAL1 = V_CREDIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.

WRITE:151(18) SPACE ,

171(18) ITAB_DISPLAY1-DMBTR .

ENDIF.

CLEAR : T012 , BNKA , PAYR .

ENDLOOP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/(190) SY-ULINE.

  • Displaying Debit and Credit Totals

WRITE:/125 TEXT-001 ,

151(18) V_DEBIT_TOTAL1,

171(18) V_CREDIT_TOTAL1 .

WRITE:/(190) SY-ULINE.

  • Displaying the Closing Balance

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

V_CLOSE_BAL1 = ITAB_OPG1-BAL1 + V_DEBIT_TOTAL1 - V_CREDIT_TOTAL1 .

IF V_CLOSE_BAL1 GT 0.

WRITE:/122 TEXT-002 ,

151(18) V_CLOSE_BAL1 NO-SIGN. " D00K909674

ELSEIF V_CLOSE_BAL1 LE 0.

WRITE:/122 TEXT-002 ,

171(18) V_CLOSE_BAL1 NO-SIGN. " D00K909674

ENDIF.

CLEAR : V_CLOSE_BAL1.

ENDLOOP.

ENDFORM. " F_006_DISPLAY_LIST1