Skip to Content
0
Former Member
Nov 06, 2006 at 06:00 AM

sap script doubt

35 Views

hi all,

i have problem with the print program.in this it is printing the from in pre printed format.

but as comapny's pre printed format has been changed so

they are not willing to carry it on.

so they have given me a format to design the form .

i have designed the form and assined my from name in the

print program but i was not able to see output ie my form

which i have designed.

my form name is zinv.

so for this i am sending my print prog so what changes i have to make in it so that i can see my form after executing it.

plz give me the solution.

REPORT ZSI-01 LINE-SIZE 132.

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

  • PROGRAM NAME : ZINVOICE AUTHOR : SATYA *

  • START DATE : 11-04-98 END DATE : *

  • REQUEST NO : REQUESTED BY : SELVAM *

  • CHANGE DATE : 12.05.98 CHANGED BY : *

  • OBJECTIVE :INVOICE PRINTING ON LAYOUT SET. *

  • LAYOUT SET ZINVOICE *

  • PF-STATUS 100. *

  • changed and transfered on 16.04.99 REQUESTED BY SELVAM. *

  • THIS IS THE LATEST VERSION OF INVOICE PROG CHANGES MADE BY raghu *

  • ON 16/04/99 *

  • RECENT COPY WITH SECOND SALES & TAX EMPTED REQ SELVAM 24/6/98 *

  • copy with form sale req by selvam 27/07/98 *

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

PRINT-CONTROL FUNCTION 'CI015'.

*TRANSPARETN TABLES

TABLES : KOMK.

TABLES : KOMV.

TABLES : KOMP.

TABLES : KNVK.

TABLES : OBJK.

TABLES : SER01.

TABLES : T001W.

TABLES : MKPF.

TABLES : KONV .

TABLES : LIKP.

TABLES : VBFA . "

TABLES : VBAK . "Header table for the invoice document

TABLES : VBAP . "Line item table for the invoice document

TABLES : KNA1 . "Customer master table for the customer details

TABLES : MARA . "Material master table

TABLES : ITCPO. "SYSTEM TABLE FOR LAYOUT SETS COMMUNICATION

TABLES : ITCPP. "SYSTEM TABLE FOR LAYOUT SETS COMMUNICATION

TABLES : VBRK. "HEADER TABLE FOR BILLING DOCUMENT

TABLES : VBRP. "LINE ITEM FOR BILLING DOCUMENT

TABLES : VBPA. "PARTNER FOR SALES DOCUMENT

TABLES : KNB1.

TABLES : LIPS.

TABLES : TVM1T.

TABLES : SADR.

*INTERNAL TABLES

DATA : BEGIN OF INV_TAB OCCURS 0.

DATA : BILLNO LIKE VBRP-VBELN.

DATA : END OF INV_TAB.

DATA : BEGIN OF I_TAB OCCURS 0.

DATA : SDNO LIKE LIKP-VBELN.

DATA : INVO LIKE VBRK-VBELN.

DATA : ORNO LIKE VBAK-VBELN.

DATA : END OF I_TAB.

*FOR READ PRICE

DATA: BEGIN OF TKOMV OCCURS 0.

INCLUDE STRUCTURE KOMV.

DATA: END OF TKOMV.

DATA: BEGIN OF TKOMVD OCCURS 0.

INCLUDE STRUCTURE KOMVD.

DATA: END OF TKOMVD.

DATA : BEGIN OF CTYPE OCCURS 0.

DATA :SIGN(1).

DATA :OPTIONS(2).

DATA :LOW(4).

DATA :HIGH(4).

DATA : END OF CTYPE.

*header data

DATA : BEGIN OF HEAD_TAB.

DATA : DOCNO LIKE VBRK-VBELN.

DATA : SALOF LIKE VBRK-VKORG.

DATA : DOCDT LIKE VBRK-FKDAT.

DATA : PLANT LIKE LIKP-WERKS.

DATA : PNAM1 LIKE T001W-NAME1.

DATA : PNAM2 LIKE T001W-NAME2.

DATA : PNAM3 LIKE T001W-NAME1.

DATA : PNAM4 LIKE T001W-NAME2.

DATA : PNAM5 LIKE T001W-PSTLZ.

DATA : PCSTNO(35).

DATA : PLSTNO(35).

*DATA : POREF LIKE VBAK-BSTNK.

DATA : POREF(30).

DATA : PODAT LIKE VBAK-BSTDK.

DATA : CCODE LIKE KNA1-KUNNR.

DATA : CPERSON LIKE KNVK-NAME1.

DATA : TPHONE LIKE VBPA-PARNR.

DATA : SALESOR LIKE VBAK-AUFNR.

DATA : BILLCUR LIKE VBAK-WAERK.

DATA : CARNAME(35).

DATA : SPSHIPI(40).

DATA : SPCARIN(40).

DATA : LRNO(20).

DATA : LRDT(20).

DATA : MODEPAY(20).

DATA : CSTNO(30).

DATA : LSTNO(30).

DATA : STAMT TYPE P DECIMALS 2. "SUB TOTAL

DATA : STAXAMT TYPE P DECIMALS 2. "SALES TAX AMOUNT

DATA : FCHRG TYPE P DECIMALS 2.

DATA : OCHRG LIKE VBRP-NETWR.

DATA : AMOUNTINWORDS(150).

DATA : GTOTAL TYPE P DECIMALS 2.

DATA : FROMDATE(10).

DATA : ENDDATE(10).

DATA : END OF HEAD_TAB.

DATA : B_PRNCTR TYPE I VALUE 0 .

*sold to party

DATA : BEGIN OF SOLDP_TAB.

DATA : NAME LIKE KNA1-NAME1.

DATA : ADD1 LIKE KNA1-NAME2.

DATA : ADD2 LIKE KNA1-NAME3.

DATA : ADD3 LIKE KNA1-ORT01.

DATA : ADD4 LIKE KNA1-PSTLZ.

DATA : ADD5 LIKE KNA1-REGIO.

DATA : ADD6 LIKE KNA1-NAME4.

DATA : END OF SOLDP_TAB.

DATA : B_SURCHARG VALUE 'N'.

  • ship to party

DATA : BEGIN OF SHIPP_TAB.

DATA : NAME LIKE KNA1-NAME1.

DATA : ADD1 LIKE KNA1-NAME2.

DATA : ADD2 LIKE KNA1-NAME3.

DATA : ADD3 LIKE KNA1-ORT01.

DATA : ADD4 LIKE KNA1-PSTLZ.

DATA : ADD5 LIKE KNA1-REGIO.

DATA : ADD6 LIKE KNA1-NAME4.

DATA : END OF SHIPP_TAB.

  • LINE ITEMS

DATA : BEGIN OF LINE_TAB OCCURS 0.

DATA : B_LONO(4).

DATA : CFAMOUNT LIKE VBRK-NETWR.

DATA : SLNO(4).

DATA : PRODCODE(6).

DATA : SERNO(20).

DATA : DESC(40).

DATA : UOM(4).

DATA : QTY(5).

DATA : RATE TYPE P DECIMALS 2.

DATA : AMOUNT TYPE P DECIMALS 2.

DATA : STAX(5).

DATA : OTAX(5).

DATA : B_TAXAMOUNT_LINE LIKE VBRP-NETWR.

DATA : POSNR LIKE VBRP-POSNR . " ADDED BY ANIL

DATA : END OF LINE_TAB.

*serial Nos

DATA : BEGIN OF SER_TAB OCCURS 0.

DATA : SERNO(20).

DATA : SLNO(4).

DATA : END OF SER_TAB.

*structure for carried forward.

DATA : BEGIN OF SUBTOT.

DATA : B_SUBTOTAL LIKE VBRK-NETWR.

DATA : END OF SUBTOT.

*STRUCTURE for layout set

DATA : BEGIN OF SERALIGN.

DATA : TEXT(10).

DATA : B_SL1 LIKE SER_TAB-SERNO.

DATA : B_SL2 LIKE SER_TAB-SERNO.

DATA : B_SL3 LIKE SER_TAB-SERNO.

DATA : END OF SERALIGN.

*VARIABLES

DATA : B_DIVIDE LIKE VBRP-NETWR.

DATA : B_PRNUCOMM LIKE SY-UCOMM.

DATA : B_NEWPAGE.

DATA : B_INVRATE LIKE VBRP-NETWR.

DATA : B_INVSTAX LIKE VBRP-NETWR.

DATA : B_TAX(4),B_TOT(4).

DATA : B_DIFFCOUNT TYPE I.

DATA : B_COUNTOFRECORDS TYPE I.

DATA : B_TOTALINDICATOR(256).

DATA : B_TEMP(25).

DATA : B_TEMP1(25).

DATA : B_AMOUNTSTRING1(36).

DATA : B_AMOUNTSTRING2(35).

DATA : B_AMOUNTSTRING3(35).

DATA : B_ORDERREFNO LIKE VBRK-XBLNR.

DATA : B_RATEFORITEM LIKE VBRK-NETWR.

DATA : B_TOTALAMOUNT TYPE P DECIMALS 2 VALUE 0. "TOTAL INVOICE AMOUNT

DATA : B_CUSTOMERNO LIKE VBAK-KUNNR. "CUSTOMER NO FROM VBAK TABLE

DATA : B_RECORDCOUNTER TYPE I. "RECORD COUNTER

DATA : B_AMOUNTINWORDS(200). "AMOUNT STORED IN WORDS

DATA : B_DECIMALAMOUNTINWORDS(40). "DEC PART OF THE AMOUNT WORD

DATA : B_AMOUNTINWORDSFINAL(256). "TOTAL AMOUNT IN WORDS

DATA : B_CUSTOMERCODE LIKE VBAK-KUNNR. "CUSTOMER CODE

DATA : B_STRINGLENGTH TYPE I.

DATA : B_INVFORCHARGE LIKE VBRP-NETWR.

DATA : B_INVOCTROI LIKE VBRP-NETWR.

DATA : B_INVTOT LIKE VBRP-NETWR.

DATA : B_INVNO LIKE VBAK-VBELN.

DATA : B_RECCOUNT TYPE I VALUE 0 , START TYPE I VALUE 0.

DATA : IFSELECTED TYPE C VALUE 'X'.

DATA : B_TOTAL_TAX LIKE VBRK-NETWR.

DATA : B_IFSERVICEORDER(1) VALUE 'T'.

DATA : ANS(1).

DATA : B_SHIP_TO_PARTY LIKE KNA1-KUNNR.

DATA : B_SOLDTOPARTYCODE LIKE KNA1-KUNNR.

DATA B_STR(35).

DATA : RECNO LIKE SY-INDEX VALUE 1.

DATA : B_SPCFLAG VALUE 'F'.

DATA : B_TAX_INFO1(80) .

DATA : B_SECOND_SALE(250) .

DATA : B_EXEMPTED(250) .

DATA : B_HEXEMPTED(250) .

DATA : B_TAX_STR(250).

DATA : B_FORM_TEXT(250) .

DATA : B_FORM_TYPE(25) .

DATA : TXT(60).

DATA : BEGIN OF FORM_TAB OCCURS 0 ,

MVGR1 LIKE VBRP-MVGR1 ,

SLNO(5) ,

END OF FORM_TAB .

DATA : OLD_MVGR1 LIKE TVM1T-MVGR1 , B_FORM_IND LIKE SY-TABIX .

DATA : B_TAX_LEN TYPE I .

DATA : FKART LIKE VBRK-FKART.

SET PF-STATUS '100'.

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

SELECT-OPTIONS SEL1 FOR VBRK-VBELN MATCHCODE OBJECT VMCF MEMORY ID VF.

SELECT-OPTIONS SEL2 FOR LIKP-VBELN MATCHCODE OBJECT VMVL MEMORY ID VL.

SELECT-OPTIONS SEL4 FOR VBAK-KUNNR MEMORY ID VAG.

SELECTION-SCREEN END OF BLOCK B_1.

SELECTION-SCREEN BEGIN OF BLOCK B_2 WITH FRAME TITLE TEXT-005.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(3) TEXT-002.

PARAMETERS : PRINTSL RADIOBUTTON GROUP GRP1.

SELECTION-SCREEN COMMENT 7(2) TEXT-003.

PARAMETERS : NPRINTSL RADIOBUTTON GROUP GRP1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B_2.

PERFORM INIT.

CLEAR HEAD_TAB.

IF SEL2 EQ SPACE AND SEL1 EQ SPACE.

IF SEL4 EQ SPACE.

PERFORM WIN_INFO(ZURL) USING 'Error' 'Enter atleast one' 'Value'.

EXIT.

ENDIF.

ENDIF.

PERFORM WRITEITEMS. "Selection Screen

----


  • FORM MAIN *

----


  • ........ *

----


FORM MAIN.

B_PRNCTR = 0 .

LOOP AT I_TAB.

CLEAR : B_SECOND_SALE , B_EXEMPTED , B_TAX_LEN .

  • read table i_tab index recno.

PERFORM SOLD_TO_PARTY_CHANGE USING I_TAB-INVO.

  • if sy-subrc eq 0.

B_INVNO = I_TAB-SDNO.

PERFORM FILL_CHAR(ZURL) USING 10 '0' I_TAB-SDNO CHANGING B_INVNO.

PERFORM FILL_CHAR(ZURL) USING 10 '0' I_TAB-INVO

CHANGING I_TAB-INVO.

CLEAR HEAD_TAB-GTOTAL.

PERFORM ASSIGN.

  • perform alignwrite.

PERFORM OPENFORM USING 'ZINVOICEDUMMY'.

PERFORM LAYOUTSETWRITE.

DATA : B_SRLNO(4) VALUE 0.

DATA : B_CTR TYPE I VALUE 0.

DATA : B_LOOPCTR TYPE I VALUE 0.

DATA : B_AMT1 LIKE VBRK-NETWR.

DATA : B_TEXTELEMENT(3).

SUBTOT-B_SUBTOTAL = 0.

B_SRLNO = 0.

LOOP AT LINE_TAB.

ADD 1 TO B_SRLNO.

MOVE B_SRLNO TO LINE_TAB-B_LONO.

PERFORM TAX_INFO_DETERMINE USING B_SRLNO.

  • " ADDED BY ANIL

SUBTOT-B_SUBTOTAL = B_AMT1 + LINE_TAB-AMOUNT.

"add line_tab-amount to subtot-b_subtotal.

MOVE SUBTOT-B_SUBTOTAL TO B_AMT1.

PERFORM LAYOUTSETMAIN USING '100'.

MOVE '101' TO B_TEXTELEMENT.

IF PRINTSL EQ 'X'.

MOVE 'Serial No:' TO SERALIGN-TEXT.

LOOP AT SER_TAB WHERE SLNO EQ LINE_TAB-SLNO.

IF B_LOOPCTR EQ B_CTR.

MOVE SER_TAB-SERNO TO SERALIGN-B_SL1.

ADD 1 TO B_CTR.

PERFORM LAYOUTSETMAIN USING B_TEXTELEMENT.

ENDIF.

IF B_LOOPCTR EQ B_CTR.

MOVE SER_TAB-SERNO TO SERALIGN-B_SL2.

ADD 1 TO B_CTR.

PERFORM LAYOUTSETMAIN USING B_TEXTELEMENT.

ENDIF.

IF B_LOOPCTR EQ B_CTR.

MOVE SER_TAB-SERNO TO SERALIGN-B_SL3.

ADD 1 TO B_CTR.

PERFORM LAYOUTSETMAIN USING B_TEXTELEMENT.

ENDIF.

B_LOOPCTR = B_LOOPCTR + 1.

MOVE '103' TO B_TEXTELEMENT.

MOVE ' ' TO SERALIGN-TEXT.

ENDLOOP.

ENDIF.

ENDLOOP.

HEAD_TAB-GTOTAL = B_INVRATE + B_INVSTAX + B_INVTOT +

B_INVOCTROI + B_INVFORCHARGE.

HEAD_TAB-OCHRG = B_INVTOT.

IF HEAD_TAB-PLANT EQ '0020'.

PERFORM LAYOUTSETMAIN USING '104'.

ENDIF.

IF B_SURCHARG = 'Y'.

PERFORM LAYOUTSETMAIN USING '105'.

ENDIF.

DESCRIBE TABLE FORM_TAB LINES SY-TABIX .

IF SY-TABIX > 0 .

SORT FORM_TAB BY MVGR1 .

CLEAR : OLD_MVGR1 , B_FORM_IND .

LOOP AT FORM_TAB .

IF FORM_TAB-MVGR1 <> OLD_MVGR1 AND B_FORM_IND > 1 .

SELECT SINGLE * FROM TVM1T WHERE MVGR1 = OLD_MVGR1 .

CONCATENATE '. :' TVM1T-BEZEI INTO B_FORM_TYPE

SEPARATED BY SPACE .

PERFORM PRINT_TAX_INFO USING B_FORM_TEXT B_FORM_TYPE .

CLEAR B_FORM_TEXT .

ENDIF .

ADD 1 TO B_FORM_IND .

OLD_MVGR1 = FORM_TAB-MVGR1 .

CONCATENATE B_FORM_TEXT ',' FORM_TAB-SLNO INTO B_FORM_TEXT

SEPARATED BY SPACE .

ENDLOOP .

SELECT SINGLE * FROM TVM1T WHERE MVGR1 = OLD_MVGR1 .

CONCATENATE '. :' TVM1T-BEZEI INTO B_FORM_TYPE

SEPARATED BY SPACE .

PERFORM PRINT_TAX_INFO USING B_FORM_TEXT B_FORM_TYPE .

CLEAR B_FORM_TEXT .

ENDIF .

PERFORM LAYOUTSETMAIN USING '109'.

B_TAX_LEN = STRLEN( B_SECOND_SALE ) .

IF B_TAX_LEN > 0 .

PERFORM PRINT_TAX_INFO USING B_SECOND_SALE

'. : Second Sales - No Tax' .

ENDIF .

B_TAX_LEN = STRLEN( B_EXEMPTED ) .

IF B_TAX_LEN > 0 .

PERFORM PRINT_TAX_INFO USING B_EXEMPTED

'. : Software Exempted From Tax' .

ENDIF .

B_TAX_LEN = STRLEN( B_HEXEMPTED ) .

IF B_TAX_LEN > 0 .

PERFORM PRINT_TAX_INFO USING B_HEXEMPTED

'. : Exempted From Tax' .

ENDIF .

MOVE 'Sales Tax Shown is inclusive of surcharge @ 10%'

TO B_TAX_STR.

REFRESH : FORM_TAB .

CLEAR : B_SECOND_SALE , B_EXEMPTED , B_TAX_LEN ,B_FORM_TEXT,

FORM_TAB , B_HEXEMPTED .

PERFORM CONVERT.

PERFORM LAYOUTFOOTER USING '102'.

PERFORM CLOSEFORM(ZURL).

PERFORM INIT.

  • endif.

ENDLOOP.

ENDFORM.

----


  • FORM ASSIGN *

----


  • ........ *

----


FORM ASSIGN.

B_INVSTAX = 0.

B_INVRATE = 0.

REFRESH SER_TAB.

  • perform gettax using i_tab-invo.

HEAD_TAB-DOCNO = I_TAB-INVO.

SELECT SINGLE * FROM VBRK WHERE VBELN EQ HEAD_TAB-DOCNO.

HEAD_TAB-DOCDT = VBRK-FKDAT.

FKART = VBRK-FKART.

CLEAR HEAD_TAB-SALESOR.

SELECT SINGLE * FROM VBAK WHERE VBELN = I_TAB-ORNO.

MOVE VBAK-VKBUR TO HEAD_TAB-SALOF.

MOVE VBAK-BSTNK TO HEAD_TAB-POREF.

MOVE VBAK-BSTDK TO HEAD_TAB-PODAT.

MOVE HEAD_TAB-PODAT TO B_STR.

CONCATENATE B_STR6(2) '.' B_STR4(2) '.' B_STR+2(2) INTO B_STR.

CONCATENATE HEAD_TAB-POREF '/' B_STR INTO B_STR.

MOVE B_STR TO HEAD_TAB-POREF.

SELECT SINGLE * FROM VBPA WHERE VBELN EQ I_TAB-INVO AND PARVW EQ 'RE'.

IF B_SPCFLAG EQ 'T'.

SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ B_SOLDTOPARTYCODE.

SELECT SINGLE * FROM KNB1 WHERE KUNNR EQ B_SOLDTOPARTYCODE.

SELECT SINGLE * FROM KNVK WHERE KUNNR EQ B_SOLDTOPARTYCODE.

  • move knvk-name1 to head_tab-cperson.

  • move knvk-telf1 to head_tab-tphone.

MOVE KNA1-NAME1 TO SOLDP_TAB-NAME. "SOLD TO PARTY

MOVE KNA1-NAME2 TO SOLDP_TAB-ADD1. "SOLD TO PARTY

MOVE KNA1-NAME3 TO SOLDP_TAB-ADD2. "SOLD TO PARTY

MOVE KNA1-NAME4 TO SOLDP_TAB-ADD6. "added By deepak 26/11/98

MOVE KNA1-ORT01 TO SOLDP_TAB-ADD3. "SOLD TO PARTY

MOVE KNA1-PSTLZ TO SOLDP_TAB-ADD4. "SOLD TO PARTY

MOVE KNA1-REGIO TO SOLDP_TAB-ADD5. "SOLD TO PARTY

ELSE.

SELECT SINGLE * FROM KNB1 WHERE KUNNR EQ VBPA-KUNNR.

IF VBPA-ADRNR EQ SPACE.

SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBPA-KUNNR.

MOVE KNA1-NAME1 TO SOLDP_TAB-NAME. "SOLD TO PARTY

MOVE KNA1-NAME2 TO SOLDP_TAB-ADD1. "SOLD TO PARTY

MOVE KNA1-NAME3 TO SOLDP_TAB-ADD2. "SOLD TO PARTY

MOVE KNA1-NAME4 TO SOLDP_TAB-ADD6. "added By deepak 26/11/98

MOVE KNA1-ORT01 TO SOLDP_TAB-ADD3. "SOLD TO PARTY

MOVE KNA1-PSTLZ TO SOLDP_TAB-ADD4. "SOLD TO PARTY

MOVE KNA1-REGIO TO SOLDP_TAB-ADD5. "SOLD TO PARTY

ELSE.

SELECT SINGLE * FROM SADR WHERE ADRNR EQ VBPA-ADRNR.

MOVE SADR-NAME1 TO SOLDP_TAB-NAME. "SOLD TO PARTY

MOVE SADR-NAME2 TO SOLDP_TAB-ADD1. "SOLD TO PARTY

MOVE SADR-NAME3 TO SOLDP_TAB-ADD2. "SOLD TO PARTY

MOVE SADR-NAME4 TO SOLDP_TAB-ADD6.

MOVE SADR-ORT01 TO SOLDP_TAB-ADD3. "SOLD TO PARTY

MOVE SADR-PSTLZ TO SOLDP_TAB-ADD4. "SOLD TO PARTY

MOVE SADR-REGIO TO SOLDP_TAB-ADD5. "SOLD TO PARTY

ENDIF.

ENDIF.

  • insereted by anil on request by raghu 4/7/98

  • select single * from knvk where kunnr eq vbpa-kunnr.

  • CLEAR VBPA .

    SELECT * FROM VBPA WHERE VBELN EQ VBAK-VBELN AND PARVW = 'AP' AND

    ( PARNR NE SPACE OR ADRNR NE SPACE ) .

    IF NOT VBPA-ADRNR IS INITIAL .

    SELECT SINGLE * FROM SADR WHERE ADRNR = VBPA-ADRNR .

    MOVE SADR-NAME3 TO HEAD_TAB-CPERSON.

    MOVE SADR-TELF1 TO HEAD_TAB-TPHONE.

    ELSE .

    SELECT SINGLE * FROM KNVK WHERE PARNR = VBPA-PARNR .

    MOVE KNVK-NAME1 TO HEAD_TAB-CPERSON.

    MOVE KNVK-TELF1 TO HEAD_TAB-TPHONE.

    ENDIF .

    EXIT .

    ENDSELECT .

    MOVE VBAK-VKBUR TO HEAD_TAB-SALOF.

    MOVE VBAK-VBELN TO HEAD_TAB-SALESOR.

    MOVE VBAK-WAERK TO HEAD_TAB-BILLCUR.

    MOVE KNA1-KUNNR TO HEAD_TAB-CCODE.

    • END OF INSERTION

    SELECT SINGLE * FROM VBPA WHERE VBELN EQ I_TAB-INVO AND PARVW EQ 'WE'.

    IF VBPA-ADRNR EQ SPACE.

    SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBPA-KUNNR.

    MOVE KNA1-KUNNR TO B_SHIP_TO_PARTY."SHIP TO PARTY

    MOVE KNA1-NAME1 TO SHIPP_TAB-NAME. "SHIP TO PARTY

    MOVE KNA1-NAME2 TO SHIPP_TAB-ADD1. "SHIP TO PARTY

    MOVE KNA1-NAME3 TO SHIPP_TAB-ADD2. "SHIP TO PARTY

    MOVE KNA1-NAME4 TO SHIPP_TAB-ADD6. " add by deepak on 26/11/98

    MOVE KNA1-ORT01 TO SHIPP_TAB-ADD3. "SHIP TO PARTY

    MOVE KNA1-PSTLZ TO SHIPP_TAB-ADD4. "SHIP TO PARTY

    MOVE KNA1-REGIO TO SHIPP_TAB-ADD5. "SHIP TO PARTY

    ELSE.

    SELECT SINGLE * FROM SADR WHERE ADRNR EQ VBPA-ADRNR.

    • move kna1-kunnr to b_ship_to_party. "SHIP TO PARTY

    MOVE SADR-NAME1 TO SHIPP_TAB-NAME. "SHIP TO PARTY

    MOVE SADR-NAME2 TO SHIPP_TAB-ADD1. "SHIP TO PARTY

    MOVE SADR-NAME3 TO SHIPP_TAB-ADD2. "SHIP TO PARTY

    MOVE SADR-NAME4 TO SHIPP_TAB-ADD6.

    MOVE SADR-ORT01 TO SHIPP_TAB-ADD3. "SHIP TO PARTY

    MOVE SADR-PSTLZ TO SHIPP_TAB-ADD4. "SHIP TO PARTY

    MOVE SADR-REGIO TO SHIPP_TAB-ADD5. "SHIP TO PARTY

    ENDIF.

    • IF B_IFSERVICEORDER EQ 'F'.

    • SELECT SINGLE * FROM LIPS WHERE VBELN EQ B_INVNO.

    • MOVE LIPS-WERKS TO HEAD_TAB-PLANT.

    • ELSE.

    SELECT SINGLE * FROM VBRP WHERE VBELN EQ I_TAB-INVO

    AND FKIMG NE 0.

    MOVE VBRP-WERKS TO HEAD_TAB-PLANT.

    • endif.

    SELECT SINGLE * FROM T001W WHERE WERKS EQ HEAD_TAB-PLANT.

    SELECT SINGLE * FROM SADR WHERE ADRNR EQ T001W-ADRNR.

    MOVE SADR-NAME1 TO HEAD_TAB-PNAM1.

    MOVE SADR-NAME2 TO HEAD_TAB-PNAM2.

    MOVE SADR-NAME3 TO HEAD_TAB-PNAM3.

    MOVE SADR-NAME4 TO HEAD_TAB-PNAM4.

    MOVE SADR-PSTLZ TO HEAD_TAB-PNAM5.

    PERFORM GETCST-LST USING T001W-ADRNR.

    DATA : B_AMOUNT_ITEM LIKE VBRP-NETWR .

    PERFORM GETTAXFORLINEITEMS USING I_TAB-INVO.

    B_INVOCTROI = 0.

    B_INVFORCHARGE = 0.

    B_INVTOT = 0.

    SELECT * FROM VBRP WHERE VBELN = I_TAB-INVO "changed on 15/4

    AND FKIMG NE 0.

    B_AMOUNT_ITEM = 0.

    MOVE VBRP-POSNR+2(4) TO LINE_TAB-SLNO.

    MOVE VBRP-POSNR TO LINE_TAB-POSNR.

    MOVE VBRP-MATNR+13(5) TO LINE_TAB-PRODCODE.

    MOVE VBRP-ARKTX TO LINE_TAB-DESC.

    SELECT SINGLE * FROM LIPS WHERE VBELN EQ B_INVNO

    AND VGPOS EQ VBRP-POSNR.

    SELECT SINGLE * FROM SER01 WHERE LIEF_NR EQ LIPS-VBELN

    AND POSNR EQ LIPS-POSNR.

    IF SY-SUBRC EQ 0.

    SELECT * FROM OBJK WHERE OBKNR EQ SER01-OBKNR.

    MOVE OBJK-SERNR TO SER_TAB-SERNO.

    MOVE VBRP-POSNR+2(4) TO SER_TAB-SLNO.

    WRITE SER_TAB-SERNO NO-ZERO TO SER_TAB-SERNO.

    CONDENSE SER_TAB-SERNO NO-GAPS.

    APPEND SER_TAB.

    ENDSELECT.

    ENDIF.

    MOVE VBRP-FKIMG TO B_TEMP.

    SPLIT B_TEMP AT '.' INTO B_TEMP1 B_TEMP.

    CONDENSE B_TEMP1 NO-GAPS.

    MOVE B_TEMP1 TO LINE_TAB-QTY.

    IF VBRP-KZWI2 GT 0.

    B_DIVIDE = VBRP-KZWI2 / VBRP-FKIMG.

    MOVE B_DIVIDE TO LINE_TAB-RATE.

    B_DIVIDE = 0.

    ELSE.

    B_DIVIDE = VBRP-KZWI1 / VBRP-FKIMG.

    MOVE B_DIVIDE TO LINE_TAB-RATE.

    B_DIVIDE = 0.

    ENDIF.

    B_AMOUNT_ITEM = LINE_TAB-RATE * VBRP-FKIMG.

    • add line_tab-rate to b_invrate.

    ADD B_AMOUNT_ITEM TO B_INVRATE.

    MOVE B_AMOUNT_ITEM TO LINE_TAB-AMOUNT.

    MOVE VBRP-VRKME TO LINE_TAB-UOM.

    B_TOTAL_TAX = 0.

    • write : / 'before loop' , vbrp-posnr.

    LOOP AT TKOMV WHERE KPOSN EQ VBRP-POSNR AND KNUMV = VBRK-KNUMV.

    • write : / vbrp-posnr , tkomv-kposn.

    IF TKOMV-KSCHL IN CTYPE.

    B_TOTAL_TAX = B_TOTAL_TAX +

    ( ( ( TKOMV-KBETR * TKOMV-KAWRT ) * 100 ) / 100000 ).

    • b_total_tax = b_total_tax + tkomv-kwert.

    ADD TKOMV-KWERT TO B_INVSTAX.

    ENDIF.

    IF TKOMV-KSCHL EQ 'ZOCT'.

    ADD TKOMV-KWERT TO B_INVOCTROI.

    ENDIF.

    IF TKOMV-KSCHL EQ 'ZF00' OR TKOMV-KSCHL EQ 'ZF01'.

    ADD TKOMV-KWERT TO B_INVFORCHARGE.

    ENDIF.

    IF TKOMV-KSCHL EQ 'ZIN6'.

    ADD TKOMV-KWERT TO B_INVTOT.

    ENDIF.

    ENDLOOP.

    B_SURCHARG = 'N'.

    B_TOT = 0.

    SORT TKOMV BY KSCHL.

    LOOP AT TKOMV WHERE KPOSN EQ VBRP-POSNR AND KNUMV = VBRK-KNUMV AND

    KSCHL IN CTYPE.

    IF TKOMV-KSCHL = 'ZIN1' OR TKOMV-KSCHL = 'ZIN2'.

    B_TAX = TKOMV-KBETR / 10.

    ENDIF.

    IF TKOMV-KSCHL = 'ZIN3'.

    B_TAX = B_TAX + ( B_TAX * ( TKOMV-KBETR / 10 ) / 100 ).

    ENDIF.

    IF TKOMV-KSCHL = 'ZIN4'.

    B_TAX = B_TAX + ( B_TAX * ( TKOMV-KBETR / 10 ) / 100 ).

    B_SURCHARG = 'Y'.

    ENDIF.

    ENDLOOP.

    LOOP AT TKOMV WHERE KSCHL = 'ZIN6'.

    B_TOT = TKOMV-KBETR / 10.

    ENDLOOP.

    MOVE B_TOTAL_TAX TO LINE_TAB-B_TAXAMOUNT_LINE.

    " b_tax = ( line_tab-b_taxamount_line / line_tab-amount ) * 100.

    MOVE B_TAX TO LINE_TAB-STAX .

    MOVE B_TOT TO LINE_TAB-OTAX.

    **Recently added**

    B_AMOUNT_ITEM = 0.

    B_TOTAL_TAX = 0.

    B_TAX = 0.

    B_TOT = 0.

    • b_invrate = 0.

    ***till here

    APPEND LINE_TAB.

    ENDSELECT.

    PERFORM PRINTTEXT.

    ENDFORM.

    END-OF-SELECTION .

    ----


    • FORM WRITEITEMS *

    ----


    • ........ *

    ----


    FORM WRITEITEMS.

    DATA : POPULATE TYPE I.

    PERFORM SELECTDATA.

    DESCRIBE TABLE INV_TAB LINES POPULATE.

    IF POPULATE NE 0.

    LOOP AT INV_TAB.

    ULINE AT 5(83).

    AT FIRST.

    WRITE : /5 '|' ,10 '|SALES DOCUMENT NO' COLOR 3,

    30 '|DELIVERY DOCUMENT NO' COLOR 3,

    52 '|PAYER.. ' COLOR 3 ,

    87 '|'.

    ULINE AT /5(83).

    ENDAT.

    SELECT * FROM VBRK WHERE VBELN EQ INV_TAB-BILLNO.

    CLEAR LIKP-VBELN.

    IF VBRK-RFBSK = 'C'.

    MOVE VBRK-VBELN TO HEAD_TAB-DOCNO.

    MOVE VBRK-FKDAT TO HEAD_TAB-DOCDT.

    SELECT * FROM VBFA WHERE VBELN EQ VBRK-VBELN.

    " and vbtyp_v ca 'JBGC'.

    IF VBFA-VBTYP_V EQ 'G' OR VBFA-VBTYP_V EQ 'C'.

    B_IFSERVICEORDER = 'F'.

    ENDIF.

    IF VBFA-VBTYP_V = 'J'.

    B_IFSERVICEORDER = 'T'.

    ENDIF.

    ENDSELECT.

    IF B_IFSERVICEORDER EQ 'T'.

    SELECT SINGLE * FROM VBFA WHERE VBELN EQ VBRK-VBELN

    AND VBTYP_V EQ 'J'.

    SELECT * FROM LIKP WHERE VBELN EQ VBFA-VBELV.

    IF SY-SUBRC NE 4.

    SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBRK-KUNRG.

    IFSELECTED = 'X'.

    WRITE : /5 '|' ,8 IFSELECTED AS CHECKBOX ,10 '|',

    11 VBRK-VBELN ,30 '|' ,31 LIKP-VBELN ,52 '|',

    53 KNA1-NAME1 ,87 '|', LIKP-WERKS.

    ULINE AT /5(83).

    B_RECCOUNT = B_RECCOUNT + 1.

    ENDIF.

    ENDSELECT.

    ELSE.

    SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBRK-KUNRG.

    IFSELECTED = 'X'.

    WRITE : /5 '|' ,8 IFSELECTED AS CHECKBOX ,10 '|',

    11 VBRK-VBELN ,30 '|' ,31 LIKP-VBELN ,52 '|',

    53 KNA1-NAME1 ,87 '|', LIKP-WERKS.

    ULINE AT /5(83).

    B_RECCOUNT = B_RECCOUNT + 1.

    ENDIF.

    ELSE.

    IFSELECTED = ' '.

    CASE VBRK-RFBSK.

    WHEN 'A'.

    TXT = 'Billing document blocked for forwarding to FI'.

    WHEN 'B'.

    TXT = 'Posting document not created (account determ.error)'.

    WHEN 'D'.

    TXT = 'Billing document is not relevant for accounting'.

    WHEN 'E'.

    TXT = 'Billing document has been completed by cancellation'.

    WHEN 'F'.

    TXT = 'Posting document not created (pricing error)'.

    WHEN 'G'.

    TXT = 'Posting document not created (export data missing)'.

    WHEN 'H'.

    TXT = 'Posting using invoice list'.

    WHEN 'I'.

    TXT = 'Posting using invoice list (account determination error)'.

    WHEN 'J'.

    TXT = 'Accounting document created, accrual still incomplete'.

    ENDCASE.

    ULINE AT /5(83).

    WRITE : /5 '|' ,8 IFSELECTED AS CHECKBOX INPUT OFF ,10 '|',

    11 VBRK-VBELN ,30 '|' ,52 '|',

    53 KNA1-NAME1 ,87 '|', LIKP-WERKS.

    ULINE AT /5(83).

    WRITE :/5 '|' , 8 TXT , 87 '|'.

    ULINE AT /5(83).

    ENDIF.

    ENDSELECT.

    ENDLOOP.

    ENDIF.

    ENDFORM.

    AT USER-COMMAND.

    DATA : CHECK(1).

    DATA : TOTALLINES LIKE SY-INDEX.

    START = 4.

    REFRESH LINE_TAB.

    REFRESH SER_TAB.

    B_PRNUCOMM = SY-UCOMM.

    DESCRIBE TABLE I_TAB LINES TOTALLINES.

    IF SY-UCOMM NE 'NEXT' AND SY-UCOMM NE 'LAST'.

    • do b_reccount times.

    REFRESH I_TAB.

    DO.

    READ LINE START FIELD VALUE IFSELECTED INTO CHECK.

    IF SY-SUBRC EQ 0.

    IF CHECK EQ 'X'.

    READ LINE START FIELD VALUE LIKP-VBELN INTO I_TAB-SDNO.

    READ LINE START FIELD VALUE VBRK-VBELN INTO I_TAB-INVO.

    SELECT SINGLE * FROM VBFA WHERE VBELN EQ I_TAB-INVO

    AND VBTYP_V EQ 'C'.

    SELECT SINGLE * FROM VBRK WHERE VBELN EQ I_TAB-INVO.

    I_TAB-ORNO = VBRK-ZUONR.

    APPEND I_TAB.

    CLEAR I_TAB.

    CHECK = ' '.

    ENDIF.

    START = START + 2.

    ELSE.

    EXIT.

    ENDIF.

    ENDDO.

    ENDIF.

    DATA : B_UCOMM LIKE SY-UCOMM.

    MOVE SY-UCOMM TO B_UCOMM.

    CASE B_UCOMM.

    WHEN 'NEXT'.

    RECNO = RECNO + 1.

    IF RECNO GT TOTALLINES.

    RECNO = 1.

    ENDIF.

    • read table i_tab index recno.

    • perform sold_to_party_change using i_tab-invo.

    PERFORM MAIN.

    WHEN 'LAST'.

    RECNO = RECNO - 1.

    IF RECNO LT 1.

    RECNO = 1.

    ENDIF.

    • read table i_tab index recno.

    • perform sold_to_party_change using i_tab-invo.

    PERFORM MAIN.

    WHEN 'PRIN'.

    • read table i_tab index recno.

    • set pf-status '101'.

    • perform sold_to_party_change using i_tab-invo.

    PRINT-CONTROL FUNCTION 'CI015'.

    PERFORM MAIN.

    WHEN 'PREV'.

    READ TABLE I_TAB INDEX RECNO.

    NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • set pf-status '102'.

    • perform sold_to_party_change using i_tab-invo.

    PRINT-CONTROL FUNCTION 'CI015'.

    PERFORM MAIN.

    WHEN 'QUIT'.

    LEAVE SCREEN .

    EXIT.

    ENDCASE.

    ----


    • FORM PRINTTEXT *

    ----


    • ........ *

    ----


    FORM PRINTTEXT.

    PERFORM READTEXT USING '0002' 'VBBK'.

    PERFORM READTEXT USING '0003' 'VBBK'.

    PERFORM READTEXT USING '0004' 'VBBK'.

    PERFORM READTEXT USING '0012' 'VBBK'.

    PERFORM READTEXT USING '0013' 'VBBK'.

    PERFORM READTEXT USING '0022' 'VBBK'.

    PERFORM READTEXT USING 'Z103' 'VBBP' .

    PERFORM READTEXT USING 'Z104' 'VBBP' .

    • added by praveen as per selvam's request.

    IF FKART = 'FV'.

    PERFORM READTEXT USING 'ZIS1' 'VBBK'.

    PERFORM READTEXT USING 'ZIS2' 'VBBK'.

    ENDIF.

    ENDFORM.

    ----


    • FORM READTEXT *

    ----


    • ........ *

    ----


    • --> B_ID *

    ----


    FORM READTEXT USING B_ID B_OBJECT.

    DATA : BEGIN OF HEADER1 OCCURS 0.

    INCLUDE STRUCTURE THEAD.

    DATA : END OF HEADER1.

    DATA : BEGIN OF LINE1 OCCURS 0.

    INCLUDE STRUCTURE TLINE.

    DATA : END OF LINE1.

    DATA : B_NAME LIKE THEAD-TDNAME.

    B_NAME = I_TAB-SDNO.

    PERFORM FILL_CHAR(ZURL) USING 10 '0' I_TAB-SDNO CHANGING B_NAME.

    • added by praveen to pick up from and to date for invoice.

    IF B_ID = 'ZIS1' OR B_ID = 'ZIS2'.

    B_NAME = I_TAB-INVO.

    ENDIF.

    IF B_OBJECT = 'VBBP'.

    CONCATENATE I_TAB-ORNO VBRP-POSNR INTO B_NAME.

    ENDIF.

    CALL FUNCTION 'READ_TEXT'

    EXPORTING

    ID = B_ID

    LANGUAGE = 'E'

    NAME = B_NAME

    OBJECT = B_OBJECT

    • header = header1

    • IMPORTING

    HEADER = HEADER1

    TABLES

    LINES = LINE1

    EXCEPTIONS

    ID = 1

    LANGUAGE = 2

    NAME = 3

    NOT_FOUND = 4

    OBJECT = 5

    REFERENCE_CHECK = 6

    WRONG_ACCESS_TO_ARCHIVE = 7

    OTHERS = 8.

    DATA : LINE(40).

    LOOP AT LINE1.

    LINE = LINE1-TDLINE.

    ENDLOOP.

    CASE B_ID.

    WHEN '0002'.

    HEAD_TAB-CARNAME = LINE.

    WHEN '0012'.

    HEAD_TAB-SPSHIPI = LINE.

    WHEN '0013'.

    HEAD_TAB-SPCARIN = LINE.

    WHEN '0003'.

    HEAD_TAB-LRNO = LINE.

    WHEN '0004'.

    HEAD_TAB-LRDT = LINE.

    WHEN '0022'.

    HEAD_TAB-MODEPAY = LINE.

    WHEN 'Z103'.

    HEAD_TAB-CSTNO = LINE.

    WHEN 'Z104'.

    HEAD_TAB-LSTNO = LINE.

    WHEN 'ZIS1'.

    HEAD_TAB-FROMDATE = LINE.

    CONDENSE HEAD_TAB-FROMDATE NO-GAPS.

    WHEN 'ZIS2'.

    HEAD_TAB-ENDDATE = LINE.

    CONDENSE HEAD_TAB-ENDDATE NO-GAPS.

    ENDCASE.

    ENDFORM.

    ----


    • FORM INIT *

    ----


    • ........ *

    ----


    FORM INIT.

    CLEAR HEAD_TAB.

    REFRESH LINE_TAB.

    CLEAR LINE_TAB.

    REFRESH SER_TAB.

    CLEAR SER_TAB.

    B_DIFFCOUNT = 0.

    B_COUNTOFRECORDS = 0.

    B_ORDERREFNO = ' '.

    B_RATEFORITEM = ' '.

    B_TOTALAMOUNT = 0.

    B_CUSTOMERNO = ' '.

    B_RECORDCOUNTER = 0.

    B_AMOUNTINWORDS = ' '.

    B_DECIMALAMOUNTINWORDS = ' '.

    B_AMOUNTINWORDSFINAL = ' '.

    B_CUSTOMERCODE = ' '.

    B_STRINGLENGTH = 0.

    B_INVNO = ' '.

    B_RECCOUNT = 0 .

    START = 0.

    IFSELECTED = ' '.

    ANS = ' '.

    ENDFORM.

    ----


    • FORM GETTAX *

    ----


    • ........ *

    ----


    • --> INVO *

    ----


    FORM GETTAX USING INVO.

    DATA: BEGIN OF TKOMVD OCCURS 0.

    INCLUDE STRUCTURE KOMVD.

    DATA: END OF TKOMVD.

    DATA: BEGIN OF COMM_ITEM_E OCCURS 0.

    INCLUDE STRUCTURE KOMP .

    DATA: END OF COMM_ITEM_E.

    REFRESH TKOMV.

    MOVE 'I' TO CTYPE-SIGN.

    MOVE 'BT' TO CTYPE-OPTIONS.

    MOVE 'ZIN4' TO CTYPE-HIGH.

    MOVE 'ZIN1' TO CTYPE-LOW.

    APPEND CTYPE.

    SELECT SINGLE * FROM VBRK WHERE VBELN = INVO.

    MOVE-CORRESPONDING VBRK TO KOMK.

    CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

    EXPORTING

    COMM_HEAD_I = KOMK

    COMM_ITEM_I = KOMP

    TABLES

    TKOMV = TKOMV

    TKOMVD = TKOMVD

    EXCEPTIONS

    OTHERS = 1.

    • SUB TOTAL AMOUNT

    LOOP AT TKOMV .

    IF TKOMV-KSCHL EQ 'ZSRP'.

    HEAD_TAB-STAMT = HEAD_TAB-STAMT + TKOMV-KWERT.

    ENDIF.

    ENDLOOP.

    *SALES TAX AMOUNT

    SELECT * FROM VBRP WHERE VBELN EQ INVO AND FKIMG NE 0. "changed on 15/4

    LOOP AT TKOMV WHERE KPOSN EQ VBRP-POSNR.

    IF TKOMV-KSCHL IN CTYPE.

    HEAD_TAB-STAXAMT = HEAD_TAB-STAXAMT + TKOMV-KWERT.

    ENDIF.

    ENDLOOP.

    ENDSELECT.

    • FORWARDING CHARGES

    LOOP AT TKOMV.

    IF TKOMV-KSCHL EQ 'ZF00'.

    HEAD_TAB-FCHRG = HEAD_TAB-FCHRG + TKOMV-KWERT.

    ENDIF.

    IF TKOMV-KSCHL EQ 'ZIN6'.

    HEAD_TAB-OCHRG = HEAD_TAB-OCHRG + TKOMV-KWERT.

    ENDIF.

    ENDLOOP.

    *grand total

    CLEAR HEAD_TAB-GTOTAL.

    HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-FCHRG.

    HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-STAXAMT.

    HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-STAMT.

    HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-OCHRG.

    PERFORM CONVERT.

    ENDFORM.

    *& Form GETCST-LST

    FORM GETCST-LST USING B_REGION.

    SELECT SINGLE * FROM SADR WHERE ADRNR EQ B_REGION.

    MOVE SADR-TELTX TO HEAD_TAB-PLSTNO.

    MOVE SADR-TELX1 TO HEAD_TAB-PCSTNO.

    ENDFORM. " GETCST-LST

    *& Form ALIGNWRITE

    FORM ALIGNWRITE.

    *set pf-status '102'.

    PERFORM HEADER.

    DATA : LINECTR TYPE I VALUE 0.

    DATA : B_RATE(12),B_AMOUNT(13).

    DATA : B_SCOUNT TYPE I VALUE 0.

    DATA B_SRLNO TYPE I VALUE 0.

    DATA : B_FLAG TYPE I VALUE 0.

    DATA : B_SUBTOTAL LIKE VBRP-NETWR VALUE 0.

    LOOP AT LINE_TAB.

    ADD 1 TO LINECTR.

    ADD 1 TO B_SRLNO.

    B_RATE = LINE_TAB-RATE.

    B_AMOUNT = LINE_TAB-AMOUNT.

    WRITE : / ' ',7(4) B_SRLNO.

    WRITE :14 LINE_TAB-PRODCODE.

    WRITE :23 LINE_TAB-DESC.

    WRITE :67(3) LINE_TAB-UOM.

    WRITE :73(5) LINE_TAB-QTY RIGHT-JUSTIFIED.

    WRITE :80(14) LINE_TAB-RATE RIGHT-JUSTIFIED.

    B_SUBTOTAL = B_SUBTOTAL + LINE_TAB-AMOUNT.

    WRITE :95(12) LINE_TAB-AMOUNT RIGHT-JUSTIFIED.

    CONDENSE LINE_TAB-STAX NO-GAPS.

    LINE_TAB-STAX =

    ( LINE_TAB-B_TAXAMOUNT_LINE / LINE_TAB-AMOUNT ) * 100.

    WRITE :110 LINE_TAB-STAX(5).

    PERFORM IFENDOFPAGE USING LINECTR B_SUBTOTAL.

    " write :95 line_tab-otax.

    B_SCOUNT = 0.

    IF PRINTSL EQ 'X'.

    DESCRIBE TABLE SER_TAB LINES B_FLAG.

    IF B_FLAG NE 0.

    WRITE : / ' ',12 'Serial Nos :'.

    ADD 1 TO LINECTR.

    ENDIF.

    LOOP AT SER_TAB WHERE SLNO EQ LINE_TAB-SLNO.

    B_SCOUNT = B_SCOUNT + 1.

    WRITE : (18)SER_TAB-SERNO NO-GAP,' '.

    IF B_SCOUNT EQ 3.

    WRITE : /23 ' '.

    ADD 1 TO LINECTR.

    B_SCOUNT = 0.

    ENDIF.

    PERFORM IFENDOFPAGE USING LINECTR B_SUBTOTAL.

    ENDLOOP.

    B_SCOUNT = 0.

    ENDIF.

    ENDLOOP.

    DATA : B_EXTRA TYPE I.

    B_EXTRA = 23 - LINECTR.

    DO B_EXTRA TIMES.

    WRITE : ' ' ,/.

    ENDDO.

    PERFORM FOOTER.

    ENDFORM. " ALIGNWRITE

    **form footer **

    FORM FOOTER.

    WRITE :/ ' '.

    WRITE :/ ' ',24 HEAD_TAB-BILLCUR,58 B_INVRATE,

    101 HEAD_TAB-CARNAME+0(15).

    WRITE :/58 B_INVSTAX ,79 HEAD_TAB-CARNAME+15(20).

    WRITE :/54 'TOT:', HEAD_TAB-OCHRG ,95 HEAD_TAB-LRNO.

    WRITE :/58 B_INVFORCHARGE , 89 HEAD_TAB-LRDT.

    WRITE :/17 HEAD_TAB-LSTNO,58 B_INVOCTROI , 99 HEAD_TAB-MODEPAY.

    HEAD_TAB-GTOTAL = B_INVRATE + B_INVSTAX + B_INVOCTROI + B_INVFORCHARGE.

    WRITE :/17 HEAD_TAB-CSTNO,61 HEAD_TAB-GTOTAL.

    PERFORM CONVERT.

    WRITE :/ ' ',/,/.

    WRITE :/17 HEAD_TAB-PLSTNO4(31),44 B_AMOUNTINWORDS0(100).

    WRITE :/17 HEAD_TAB-PCSTNO4(31),44 B_AMOUNTINWORDS100(100).

    WRITE : /.

    ENDFORM.

    *HEADER INFO PRINTING*

    FORM HEADER.

    DATA : B_POREF(35).

    *concatenate head_tab-poref '/' head_tab-podat into b_poref.

    CONDENSE HEAD_TAB-PODAT.

    CONDENSE HEAD_TAB-POREF.

    FORMAT INTENSIFIED OFF.

    WRITE : / ' ',/,/. "a line feed is removed

    WRITE : / ' ',83 HEAD_TAB-PNAM1.

    WRITE : / ' ',83 HEAD_TAB-PNAM2.

    WRITE : / ' ',83 HEAD_TAB-PNAM3.

    PRINT-CONTROL FUNCTION 'CI010'.

    WRITE : /13 HEAD_TAB-DOCNO,61 HEAD_TAB-DOCDT.

    PRINT-CONTROL FUNCTION 'CI015'.

    WRITE : ' ',86 HEAD_TAB-PNAM5.

    WRITE :/83 HEAD_TAB-PNAM4.

    WRITE : / ' ',/, 90 HEAD_TAB-SPSHIPI+0(30).

    WRITE : /8 SOLDP_TAB-NAME ,47 SHIPP_TAB-NAME,

    90 HEAD_TAB-SPSHIPI+30(10).

    WRITE : / ' ',8 SOLDP_TAB-ADD1 , 47 SHIPP_TAB-ADD1.

    WRITE : / ' ',8 SOLDP_TAB-ADD2 , 47 SHIPP_TAB-ADD2.

    WRITE : / ' ',8 SOLDP_TAB-ADD6 , 47 SHIPP_TAB-ADD6,

    90 HEAD_TAB-SPCARIN+0(30).

    WRITE : / ' ',8 SOLDP_TAB-ADD3 , 47 SHIPP_TAB-ADD3,

    90 HEAD_TAB-SPCARIN+30(10).

    WRITE : / ' ',8 SOLDP_TAB-ADD4 , 47 SHIPP_TAB-ADD4.

    WRITE : / ' ',25 HEAD_TAB-CCODE ,68 HEAD_TAB-CPERSON ,

    109 HEAD_TAB-SALESOR,/.

    MOVE HEAD_TAB-PODAT TO B_STR.

    CONCATENATE B_STR6(2) '.' B_STR4(2) '.' B_STR+2(2) INTO B_STR.

    CONCATENATE HEAD_TAB-POREF '/' B_STR INTO B_STR.

    MOVE B_STR TO HEAD_TAB-POREF.

    WRITE : / ' ',25 B_STR.

    WRITE : ' ',64 HEAD_TAB-TPHONE NO-ZERO,109 HEAD_TAB-SALOF.

    WRITE : / ' ',/,/,/,/.

    ENDFORM.

    ----


    • FORM CONVERT *

    ----


    • ........ *

    ----


    FORM CONVERT.

    DATA : B_WORDS(100).

    DATA : B_DECIS(100).

    DATA : TEMP1(40).

    DATA : TEMP2(40).

    CALL FUNCTION 'Z_CONVERSION_TO_WORDS'

    EXPORTING

    AMOUNT = HEAD_TAB-GTOTAL

    IMPORTING

    IN_WORDS = B_WORDS

    IN_DECMS = B_DECIS

    EXCEPTIONS

    TOO_LARGE = 1

    OTHERS = 2.

    MOVE HEAD_TAB-GTOTAL TO TEMP1.

    SPLIT TEMP1 AT '.' INTO TEMP1 TEMP2.

    IF HEAD_TAB-BILLCUR EQ 'INR'.

    IF TEMP2 NE '00'.

    CONCATENATE 'Rupees' B_WORDS 'and paise' B_DECIS

    INTO B_AMOUNTINWORDS SEPARATED BY SPACE.

    ELSE.

    CONCATENATE 'Rupees' B_WORDS B_DECIS

    INTO B_AMOUNTINWORDS SEPARATED BY SPACE.

    ENDIF.

    ELSE.

    CONCATENATE HEAD_TAB-BILLCUR B_WORDS B_DECIS

    INTO B_AMOUNTINWORDS SEPARATED BY SPACE.

    ENDIF.

    ENDFORM.

    ----


    • FORM GETTAXFORLINEITEMS *

    ----


    • ........ *

    ----


    • --> INVO *

    ----


    FORM GETTAXFORLINEITEMS USING INVO.

    DATA: BEGIN OF TKOMVD OCCURS 0.

    INCLUDE STRUCTURE KOMVD.

    DATA: END OF TKOMVD.

    CLEAR CTYPE.

    CLEAR KOMK.

    SELECT SINGLE * FROM VBRK WHERE VBELN = INVO.

    MOVE-CORRESPONDING VBRK TO KOMK.

    CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

    EXPORTING

    COMM_HEAD_I = KOMK

    COMM_ITEM_I = KOMP

    TABLES

    TKOMV = TKOMV

    TKOMVD = TKOMVD

    EXCEPTIONS

    OTHERS = 1.

    DATA : B_TAX TYPE I.

    *SALES TAX pervcentage for line items.

    MOVE 'I' TO CTYPE-SIGN.

    MOVE 'BT' TO CTYPE-OPTIONS.

    MOVE 'ZIN4' TO CTYPE-HIGH.

    MOVE 'ZIN1' TO CTYPE-LOW.

    APPEND CTYPE.

    ENDFORM.

    ----


    • FORM IFENDOFPAGE *

    ----


    • ........ *

    ----


    • --> LINECTR *

    • --> B_SUBTOTAL *

    ----


    FORM IFENDOFPAGE USING LINECTR B_SUBTOTAL.

    IF LINECTR EQ 19.

    WRITE : / ' ',/,10 'Carried forward '.

    PERFORM PUTALINE.

    WRITE :83 B_SUBTOTAL.

    ADD 1 TO LINECTR.

    "do 37 times.

    DO 24 TIMES.

    WRITE : ' ',/.

    ENDDO.

    PERFORM HEADER.

    WRITE : /10 'Brought forward'.

    PERFORM PUTALINE.

    WRITE : 83 B_SUBTOTAL.

    LINECTR = 1.

    ENDIF.

    ENDFORM.

    ----


    • FORM PUTALINE *

    ----


    • ........ *

    ----


    FORM PUTALINE.

    DO 27 TIMES.

    WRITE : '-'.

    ENDDO.

    WRITE '>'.

    ENDFORM.

    ----


    • FORM ERRORCHECK *

    ----


    • ........ *

    ----


    • --> SY-SUBRC *

    ----


    FORM ERRORCHECK USING SY-SUBRC.

    IF SY-SUBRC NE 0.

    PERFORM WIN_INFO(ZURL) USING 'Error' 'Document does not exists'

    'Please re-enter the doc #'.

    SET SCREEN 1000.

    LEAVE SCREEN.

    EXIT.

    ENDIF.

    ENDFORM.

    ----


    • FORM SOLD_TO_PARTY_CHANGE *

    ----


    • ........ *

    ----


    • --> B_INVNO *

    ----


    FORM SOLD_TO_PARTY_CHANGE USING B_INVNO.

    *TO CHANGE THE SOLD TO PARTY FOR THE BILLING DOCUMENT.

    DATA : BEGIN OF NEW_SHIP_TAB OCCURS 0.

    DATA : DESC(20).

    DATA : CUSTCODE LIKE KNA1-KUNNR.

    DATA : DUMMY(5).

    DATA : CUSTNAME LIKE KNA1-NAME1.

    DATA : END OF NEW_SHIP_TAB.

    DATA : B_TABIX LIKE SY-TABIX.

    DATA : B_SOLDCODE LIKE KNA1-KUNNR.

    DATA : B_PAYCODE LIKE KNA1-KUNNR.

    SELECT * FROM VBPA WHERE VBELN EQ B_INVNO

    AND PARVW IN ('RE','WE','AG').

    SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBPA-KUNNR.

    MOVE KNA1-NAME1 TO NEW_SHIP_TAB-CUSTNAME.

    MOVE KNA1-KUNNR TO NEW_SHIP_TAB-CUSTCODE.

    MOVE ' ' TO NEW_SHIP_TAB-DUMMY.

    CASE VBPA-PARVW.

    WHEN 'WE'.

    MOVE 'SHIP TO PARTY' TO NEW_SHIP_TAB-DESC.

    MOVE KNA1-KUNNR TO B_PAYCODE.

    WHEN 'RE'.

    MOVE KNA1-KUNNR TO B_SOLDTOPARTYCODE.

    MOVE 'PAYER ' TO NEW_SHIP_TAB-DESC.

    WHEN 'AG'.

    MOVE KNA1-KUNNR TO B_SOLDCODE.

    MOVE 'SOLD TO PARTY' TO NEW_SHIP_TAB-DESC.

    ENDCASE.

    APPEND NEW_SHIP_TAB.

    ENDSELECT.

    B_SPCFLAG = 'F'.

    IF B_SOLDCODE NE B_SOLDTOPARTYCODE.

    B_SPCFLAG = 'T'.

    ELSE.

    IF B_SOLDTOPARTYCODE NE B_PAYCODE.

    B_SPCFLAG = 'T'.

    ELSE.

    IF B_PAYCODE NE B_SOLDCODE.

    B_SPCFLAG = 'T'.

    ENDIF.

    ENDIF.

    ENDIF.

    B_SPCFLAG = 'F'. "added by raghu.

    IF B_SPCFLAG EQ 'T'.

    DATA : B_TITLE(40) .

    CONCATENATE 'INVOICE' B_INVNO 'IN THE NAME OF......' INTO B_TITLE

    SEPARATED BY SPACE .

    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

    EXPORTING

    ENDPOS_COL = 70

    ENDPOS_ROW = 20

    STARTPOS_COL = 10

    STARTPOS_ROW = 10

    TITLETEXT = B_TITLE

    IMPORTING

    CHOISE = B_TABIX

    TABLES

    VALUETAB = NEW_SHIP_TAB

    EXCEPTIONS

    BREAK_OFF = 1

    OTHERS = 2.

    READ TABLE NEW_SHIP_TAB INDEX B_TABIX.

    IF SY-SUBRC EQ 0.

    B_SOLDTOPARTYCODE = NEW_SHIP_TAB-CUSTCODE.

    IF B_PRNUCOMM EQ 'PRIN'.

    • NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

    ENDIF.

    IF B_PRNUCOMM EQ 'PREV'.

    • NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

    ENDIF.

    ENDIF.

    ENDIF.

    IF B_SPCFLAG NE 'T'.

    IF B_PRNUCOMM EQ 'PRIN'.

    • new-page print on no-title no-heading line-size 132 line-count 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

    ENDIF.

    IF B_PRNUCOMM EQ 'PREV'.

    • NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

    ENDIF.

    ENDIF.

    ENDFORM.

    ----


    • FORM SELECTDATA *

    ----


    • ........ *

    ----


    FORM SELECTDATA.

    DATA : TABLELINES1 TYPE I.

    DATA : TABLELINES2 TYPE I.

    DATA : TABLELINES3 TYPE I.

    DATA : TABLELINES4 TYPE I.

    DATA : TABLELINES5 TYPE I.

    DATA : FLAG VALUE 'F'.

    DESCRIBE TABLE SEL1 LINES TABLELINES1.

    DESCRIBE TABLE SEL2 LINES TABLELINES2.

    DESCRIBE TABLE SEL4 LINES TABLELINES4.

    IF TABLELINES1 NE 0.

    FLAG = 'T'.

    SELECT * FROM VBRK WHERE VBELN IN SEL1.

    IF SY-SUBRC EQ 0.

    MOVE VBRK-VBELN TO INV_TAB-BILLNO.

    APPEND INV_TAB.

    CLEAR INV_TAB.

    ENDIF.

    ENDSELECT.

    ELSE.

    IF TABLELINES2 NE 0.

    FLAG = 'T'.

    SELECT * FROM LIKP WHERE VBELN IN SEL2.

    IF SY-SUBRC EQ 0.

    SELECT SINGLE * FROM VBFA WHERE VBELN EQ LIKP-VBELN

    AND VBTYP_V EQ 'C'.

    IF SY-SUBRC EQ 0.

    SELECT SINGLE * FROM VBFA WHERE VBELV EQ LIKP-VBELN

    AND VBTYP_N EQ 'M'.

    IF SY-SUBRC EQ 0.

    MOVE VBFA-VBELN TO INV_TAB-BILLNO.

    APPEND INV_TAB.

    CLEAR INV_TAB.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDSELECT.

    ENDIF.

    ENDIF.

    IF FLAG = 'F'.

    SELECT * FROM VBRK.

    SELECT SINGLE * FROM VBFA WHERE VBELN EQ VBRK-VBELN

    AND VBTYP_V EQ 'C'.

    SELECT SINGLE * FROM VBAK WHERE VBELN EQ VBFA-VBELV.

    IF VBAK-KUNNR IN SEL4.

    IF SY-SUBRC EQ 0.

    MOVE VBRK-VBELN TO INV_TAB.

    APPEND INV_TAB.

    CLEAR INV_TAB.

    ENDIF.

    ENDIF.

    ENDSELECT.

    ENDIF.

    ENDFORM.

    &----


    *& Form LAYOUTSETWRITE

    &----


    FORM LAYOUTSETWRITE.

    DATA : BEGIN OF WINLIST OCCURS 0.

    DATA : WINNAME(15).

    DATA : END OF WINLIST.

    MOVE 'INVNO' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'INDATE' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'PLANTADD' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'BILLTO' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'SHIPTO' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'SPLSHIP' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'SPLCARR' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'CUSCODE' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'CPERSON' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'SORDERNO' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'SOFFCODE' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'POREFDT' TO WINLIST-WINNAME.

    APPEND WINLIST.

    MOVE 'TELPHONE' TO WINLIST-WINNAME.

    APPEND WINLIST.

    LOOP AT WINLIST.

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    WINDOW = WINLIST-WINNAME

    EXCEPTIONS

    ELEMENT = 1

    FUNCTION = 2

    TYPE = 3

    UNOPENED = 4

    UNSTARTED = 5

    WINDOWS = 6

    OTHERS = 7.

    ENDLOOP.

    ENDFORM. " LAYOUTSETWRITE

    ----


    • FORM LAYOUTFOOTER *

    ----


    • ........ *

    ----


    • --> B_ELEMENT *

    ----


    FORM LAYOUTFOOTER USING B_ELEMENT.

    DATA : BEGIN OF WINLISTFOOTER OCCURS 0.

    DATA : WINNAME(15).

    DATA : END OF WINLISTFOOTER.

    MOVE 'BILLCUR' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'AMTWORDS' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'CARRNAME' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'LRNO' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'LRDATE' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'MOFDESP' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'SUBTOTAL' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'MLCSTLST' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    MOVE 'LSTCSTNO' TO WINLISTFOOTER-WINNAME.

    APPEND WINLISTFOOTER.

    LOOP AT WINLISTFOOTER .

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    WINDOW = WINLISTFOOTER-WINNAME

    ELEMENT = B_ELEMENT

    EXCEPTIONS

    ELEMENT = 1

    FUNCTION = 2

    TYPE = 3

    UNOPENED = 4

    UNSTARTED = 5

    WINDOWS = 6

    OTHERS = 7.

    ENDLOOP.

    ENDFORM.

    *& Form LAYOUTSETMAIN

    FORM LAYOUTSETMAIN USING B_ELEMENT.

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    WINDOW = 'MAIN'

    ELEMENT = B_ELEMENT

    EXCEPTIONS

    ELEMENT = 1

    FUNCTION = 2

    TYPE = 3

    UNOPENED = 4

    UNSTARTED = 5

    WINDOWS = 6

    OTHERS = 7.

    ENDFORM. " LAYOUTSETMAIN

    ----


    • FORM OPENFORM *

    ----


    • ........ *

    ----


    • --> B_FORMNAME *

    ----


    FORM OPENFORM USING B_FORMNAME.

    DATA : B_ELEMENT(10) VALUE 'ABAP'.

    IF B_UCOMM EQ 'PRIN'.

    B_ELEMENT = 'PRINTER'.

    ITCPO-TDNOPREV = 'X'.

    ENDIF .

    *ELSE.

    • ITCPO-TDNOPRINT = 'X'.

    • ITCPO-TDPREVIEW = 'X'.

    • B_ELEMENT = 'PRINTER'.

    *ENDIF.

    IF B_PRNCTR = 0 .

    B_PRNCTR = 1 .

    MOVE : 'X' TO ITCPO-TDIMMED ,

    'X' TO ITCPO-TDDELETE ,

    'X' TO ITCPO-TDPREVIEW ,

    'X' TO ITCPO-TDNEWID .

    CALL FUNCTION 'OPEN_FORM'

    EXPORTING

    FORM = B_FORMNAME

    OPTIONS = ITCPO

    DEVICE = B_ELEMENT

    IMPORTING

    RESULT = ITCPP

    EXCEPTIONS

    CANCELLED = 1

    DEVICE = 2

    FORM = 3

    OPTIONS = 4

    UNCLOSED = 5

    OTHERS = 6.

    ELSE .

    MOVE : ITCPP-TDDEST TO ITCPO-TDDEST ,

    ITCPP-TDIMMED TO ITCPO-TDIMMED ,

    ITCPP-TDDELETE TO ITCPO-TDDELETE ,

    ITCPP-TDNEWID TO ITCPO-TDNEWID ,

    ITCPP-TDPREVIEW TO ITCPO-TDPREVIEW ,

    ITCPP-TDCOPIES TO ITCPO-TDCOPIES .

    CALL FUNCTION 'OPEN_FORM'

    EXPORTING

    FORM = B_FORMNAME

    OPTIONS = ITCPO

    DEVICE = B_ELEMENT

    DIALOG = ' '

    IMPORTING

    RESULT = ITCPP

    EXCEPTIONS

    CANCELLED = 1

    DEVICE = 2

    FORM = 3

    OPTIONS = 4

    UNCLOSED = 5

    OTHERS = 6.

    ENDIF .

    ENDFORM.

    &----


    *& Form TAX_INFO_DETERMINE ADDED BY ANIL

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM TAX_INFO_DETERMINE USING B_SLRNO .

    SELECT SINGLE * FROM VBRK WHERE VBELN = I_TAB-INVO.

    SELECT SINGLE * FROM VBRP WHERE VBELN = VBRK-VBELN AND

    POSNR = LINE_TAB-POSNR .

    *refresh tkomv . clear : tkomv , komk.

    MOVE-CORRESPONDING VBRK TO KOMK.

    MOVE-CORRESPONDING VBRP TO KOMP.

    • CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

    • EXPORTING

    • COMM_HEAD_I = KOMK

    • COMM_ITEM_I = KOMP

    • TABLES

    • TKOMV = TKOMV

    • TKOMVD = TKOMVD

    • EXCEPTIONS

    • OTHERS = 1.

    • SORT TKOMV BY KSCHL.

    CLEAR KONV .

    SELECT * FROM KONV WHERE KNUMV = VBRK-KNUMV AND KPOSN = VBRP-POSNR AND

    KAPPL = 'TX' AND ( KSCHL EQ 'ZIN2' OR

    KSCHL = 'ZIN1' ).

    • loop at tkomv where kposn eq vbrp-posnr and ( kschl eq 'ZIN2' or

    • kschl = 'ZIN1' ).

    • if tkomv-kbetr = 0 .

    IF KONV-KBETR = 0 .

    IF NOT VBRP-MVGR1 IS INITIAL .

    FORM_TAB-MVGR1 = VBRP-MVGR1 .

    FORM_TAB-SLNO = B_SLRNO .

    APPEND FORM_TAB . CLEAR FORM_TAB .

    ELSE .

    • if tkomv-mwsk1+1(1) = '2' .

    IF KONV-MWSK1+1(1) = '2' .

    CONCATENATE B_SECOND_SALE ',' B_SLRNO INTO B_SECOND_SALE

    SEPARATED BY SPACE.

    ELSE .

    IF VBRP-KONDM = '07' .

    CONCATENATE B_EXEMPTED ',' B_SLRNO INTO B_EXEMPTED

    SEPARATED BY SPACE.

    ELSE .

    CONCATENATE B_HEXEMPTED ',' B_SLRNO INTO B_HEXEMPTED

    SEPARATED BY SPACE.

    ENDIF .

    ENDIF .

    ENDIF .

    ENDIF .

    • endloop.

    ENDSELECT .

    ENDFORM. " TAX_INFO_DETERMINE

    &----


    *& Form PRINT_TAX_INFO

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM PRINT_TAX_INFO USING B_TAX_STR B_TAX_STR1.

    CLEAR : B_TAX_INFO1 .

    REPLACE ',' WITH ':' INTO B_TAX_STR .

    CONCATENATE 'Item ' B_TAX_STR B_TAX_STR1

    INTO B_TAX_STR SEPARATED BY SPACE .

    PERFORM LAYOUTSETMAIN USING '111'.

    DO .

    B_TAX_INFO1 = B_TAX_STR+0(80) .

    PERFORM LAYOUTSETMAIN USING '110'.

    B_TAX_STR = B_TAX_STR+80() .

    B_TAX_LEN = STRLEN( B_TAX_STR ) .

    IF B_TAX_LEN = 0.

    EXIT .

    ENDIF .

    ENDDO .

    ENDFORM. " PRINT_TAX_INFO

    *PRINT-CONTROL FUNCTION 'CI015'.

    **TRANSPARETN TABLES

    *TABLES : KOMK.

    *TABLES : KOMV.

    *TABLES : KOMP.

    *TABLES : KNVK.

    *TABLES : OBJK.

    *TABLES : SER01.

    *TABLES : T001W.

    *TABLES : MKPF.

    *TABLES : KONV .

    *TABLES : LIKP.

    *TABLES : VBFA . "

    *TABLES : VBAK . "Header table for the invoice document

    *TABLES : VBAP . "Line item table for the invoice document

    *TABLES : KNA1 . "Customer master table for the customer details

    *TABLES : MARA . "Material master table

    *TABLES : ITCPO. "SYSTEM TABLE FOR LAYOUT SETS COMMUNICATION

    *TABLES : ITCPP. "SYSTEM TABLE FOR LAYOUT SETS COMMUNICATION

    *TABLES : VBRK. "HEADER TABLE FOR BILLING DOCUMENT

    *TABLES : VBRP. "LINE ITEM FOR BILLING DOCUMENT

    *TABLES : VBPA. "PARTNER FOR SALES DOCUMENT

    *TABLES : KNB1.

    *TABLES : LIPS.

    *TABLES : TVM1T.

    *TABLES : SADR.

    *

    **INTERNAL TABLES

    *DATA : BEGIN OF INV_TAB OCCURS 0.

    *DATA : BILLNO LIKE VBRP-VBELN.

    *DATA : END OF INV_TAB.

    *

    *DATA : BEGIN OF I_TAB OCCURS 0.

    *DATA : SDNO LIKE LIKP-VBELN.

    *DATA : INVO LIKE VBRK-VBELN.

    *DATA : ORNO LIKE VBAK-VBELN.

    *DATA : END OF I_TAB.

    *

    **FOR READ PRICE

    *DATA: BEGIN OF TKOMV OCCURS 0.

    • INCLUDE STRUCTURE KOMV.

    *DATA: END OF TKOMV.

    *DATA: BEGIN OF TKOMVD OCCURS 0.

    • INCLUDE STRUCTURE KOMVD.

    *DATA: END OF TKOMVD.

    *

    *DATA : BEGIN OF CTYPE OCCURS 0.

    *DATA :SIGN(1).

    *DATA :OPTIONS(2).

    *DATA :LOW(4).

    *DATA :HIGH(4).

    *DATA : END OF CTYPE.

    *

    **header data

    *DATA : BEGIN OF HEAD_TAB.

    *DATA : DOCNO LIKE VBRK-VBELN.

    *DATA : SALOF LIKE VBRK-VKORG.

    *DATA : DOCDT LIKE VBRK-FKDAT.

    *DATA : PLANT LIKE LIKP-WERKS.

    *DATA : PNAM1 LIKE T001W-NAME1.

    *DATA : PNAM2 LIKE T001W-NAME2.

    *DATA : PNAM3 LIKE T001W-NAME1.

    *DATA : PNAM4 LIKE T001W-NAME2.

    *DATA : PNAM5 LIKE T001W-PSTLZ.

    *DATA : PCSTNO(35).

    *DATA : PLSTNO(35).

    *DATA : POREF LIKE VBAK-BSTNK.

    *DATA : PODAT LIKE VBAK-BSTDK.

    *DATA : CCODE LIKE KNA1-KUNNR.

    *DATA : CPERSON LIKE KNVK-NAME1.

    *DATA : TPHONE LIKE VBPA-PARNR.

    *DATA : SALESOR LIKE VBAK-AUFNR.

    *DATA : BILLCUR LIKE VBAK-WAERK.

    *DATA : CARNAME(35).

    *DATA : SPSHIPI(40).

    *DATA : SPCARIN(40).

    *DATA : LRNO(20).

    *DATA : LRDT(20).

    *DATA : MODEPAY(20).

    *

    *DATA : CSTNO(30).

    *DATA : LSTNO(30).

    *DATA : STAMT TYPE P DECIMALS 2. "SUB TOTAL

    *DATA : STAXAMT TYPE P DECIMALS 2. "SALES TAX AMOUNT

    *DATA : FCHRG TYPE P DECIMALS 2.

    *DATA : OCHRG LIKE VBRP-NETWR.

    *DATA : AMOUNTINWORDS(150).

    *DATA : GTOTAL TYPE P DECIMALS 2.

    *DATA : FROMDATE(10).

    *DATA : ENDDATE(10).

    *DATA : END OF HEAD_TAB.

    *DATA : B_PRNCTR TYPE I VALUE 0 .

    **sold to party

    *DATA : BEGIN OF SOLDP_TAB.

    *DATA : NAME LIKE KNA1-NAME1.

    *DATA : ADD1 LIKE KNA1-NAME2.

    *DATA : ADD2 LIKE KNA1-NAME3.

    *DATA : ADD3 LIKE KNA1-ORT01.

    *DATA : ADD4 LIKE KNA1-PSTLZ.

    *DATA : ADD5 LIKE KNA1-REGIO.

    *DATA : ADD6 LIKE KNA1-NAME4.

    *DATA : END OF SOLDP_TAB.

    *DATA : B_SURCHARG VALUE 'N'.

    • ship to party

    *DATA : BEGIN OF SHIPP_TAB.

    *DATA : NAME LIKE KNA1-NAME1.

    *DATA : ADD1 LIKE KNA1-NAME2.

    *DATA : ADD2 LIKE KNA1-NAME3.

    *DATA : ADD3 LIKE KNA1-ORT01.

    *DATA : ADD4 LIKE KNA1-PSTLZ.

    *DATA : ADD5 LIKE KNA1-REGIO.

    *DATA : ADD6 LIKE KNA1-NAME4.

    *DATA : END OF SHIPP_TAB.

    *

    • LINE ITEMS

    *DATA : BEGIN OF LINE_TAB OCCURS 0.

    *DATA : B_LONO(4).

    *DATA : CFAMOUNT LIKE VBRK-NETWR.

    *DATA : SLNO(4).

    *DATA : PRODCODE(6).

    *DATA : SERNO(20).

    *DATA : DESC(40).

    *DATA : UOM(4).

    *DATA : QTY(5).

    *DATA : RATE TYPE P DECIMALS 2.

    *DATA : AMOUNT TYPE P DECIMALS 2.

    *DATA : STAX(5).

    *DATA : OTAX(5).

    *DATA : B_TAXAMOUNT_LINE LIKE VBRP-NETWR.

    *DATA : POSNR LIKE VBRP-POSNR . " ADDED BY ANIL

    *DATA : END OF LINE_TAB.

    **serial Nos

    *DATA : BEGIN OF SER_TAB OCCURS 0.

    *DATA : SERNO(20).

    *DATA : SLNO(4).

    *DATA : END OF SER_TAB.

    **structure for carried forward.

    *DATA : BEGIN OF SUBTOT.

    *DATA : B_SUBTOTAL LIKE VBRK-NETWR.

    *DATA : END OF SUBTOT.

    *

    **STRUCTURE for layout set

    *DATA : BEGIN OF SERALIGN.

    *DATA : TEXT(10).

    *DATA : B_SL1 LIKE SER_TAB-SERNO.

    *DATA : B_SL2 LIKE SER_TAB-SERNO.

    *DATA : B_SL3 LIKE SER_TAB-SERNO.

    *DATA : END OF SERALIGN.

    **VARIABLES

    *DATA : B_DIVIDE LIKE VBRP-NETWR.

    *DATA : B_PRNUCOMM LIKE SY-UCOMM.

    *DATA : B_NEWPAGE.

    *DATA : B_INVRATE LIKE VBRP-NETWR.

    *DATA : B_INVSTAX LIKE VBRP-NETWR.

    *DATA : B_TAX(4),B_TOT(4).

    *DATA : B_DIFFCOUNT TYPE I.

    *DATA : B_COUNTOFRECORDS TYPE I.

    *DATA : B_TOTALINDICATOR(256).

    *DATA : B_TEMP(25).

    *DATA : B_TEMP1(25).

    *DATA : B_AMOUNTSTRING1(36).

    *DATA : B_AMOUNTSTRING2(35).

    *DATA : B_AMOUNTSTRING3(35).

    *DATA : B_ORDERREFNO LIKE VBRK-XBLNR.

    *DATA : B_RATEFORITEM LIKE VBRK-NETWR.

    *DATA : B_TOTALAMOUNT TYPE P DECIMALS 2 VALUE 0. "TOTAL INVOICE AMOUNT

    *DATA : B_CUSTOMERNO LIKE VBAK-KUNNR. "CUSTOMER NO FROM VBAK TABLE

    *DATA : B_RECORDCOUNTER TYPE I. "RECORD COUNTER

    *DATA : B_AMOUNTINWORDS(200). "AMOUNT STORED IN WORDS

    *DATA : B_DECIMALAMOUNTINWORDS(40). "DEC PART OF THE AMOUNT WORD

    *DATA : B_AMOUNTINWORDSFINAL(256). "TOTAL AMOUNT IN WORDS

    *DATA : B_CUSTOMERCODE LIKE VBAK-KUNNR. "CUSTOMER CODE

    *DATA : B_STRINGLENGTH TYPE I.

    *DATA : B_INVFORCHARGE LIKE VBRP-NETWR.

    *DATA : B_INVOCTROI LIKE VBRP-NETWR.

    *DATA : B_INVTOT LIKE VBRP-NETWR.

    *DATA : B_INVNO LIKE VBAK-VBELN.

    *DATA : B_RECCOUNT TYPE I VALUE 0 , START TYPE I VALUE 0.

    *DATA : IFSELECTED TYPE C VALUE 'X'.

    *DATA : B_TOTAL_TAX LIKE VBRK-NETWR.

    *DATA : B_IFSERVICEORDER(1) VALUE 'T'.

    *DATA : ANS(1).

    *DATA : B_SHIP_TO_PARTY LIKE KNA1-KUNNR.

    *DATA : B_SOLDTOPARTYCODE LIKE KNA1-KUNNR.

    *DATA B_STR(30).

    *DATA : RECNO LIKE SY-INDEX VALUE 1.

    *DATA : B_SPCFLAG VALUE 'F'.

    *DATA : B_TAX_INFO1(80) .

    *DATA : B_SECOND_SALE(250) .

    *DATA : B_EXEMPTED(250) .

    *DATA : B_HEXEMPTED(250) .

    *DATA : B_TAX_STR(250).

    *DATA : B_FORM_TEXT(250) .

    *DATA : B_FORM_TYPE(25) .

    *DATA : BEGIN OF FORM_TAB OCCURS 0 ,

    • MVGR1 LIKE VBRP-MVGR1 ,

    • SLNO(5) ,

    • END OF FORM_TAB .

    *DATA : OLD_MVGR1 LIKE TVM1T-MVGR1 , B_FORM_IND LIKE SY-TABIX .

    *DATA : B_TAX_LEN TYPE I .

    *DATA : FKART LIKE VBRK-FKART.

    *SET PF-STATUS '100'.

    *

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

    *

    *SELECT-OPTIONS SEL1 FOR VBRK-VBELN MATCHCODE OBJECT VMCF MEMORY ID VF.

    *SELECT-OPTIONS SEL2 FOR LIKP-VBELN MATCHCODE OBJECT VMVL MEMORY ID VL.

    *SELECT-OPTIONS SEL4 FOR VBAK-KUNNR MEMORY ID VAG.

    *SELECTION-SCREEN END OF BLOCK B_1.

    *

    *SELECTION-SCREEN BEGIN OF BLOCK B_2 WITH FRAME TITLE TEXT-005.

    *SELECTION-SCREEN BEGIN OF LINE.

    *SELECTION-SCREEN COMMENT 1(3) TEXT-002.

    *PARAMETERS : PRINTSL RADIOBUTTON GROUP GRP1.

    *SELECTION-SCREEN COMMENT 7(2) TEXT-003.

    *PARAMETERS : NPRINTSL RADIOBUTTON GROUP GRP1.

    *SELECTION-SCREEN END OF LINE.

    *SELECTION-SCREEN END OF BLOCK B_2.

    *

    *PERFORM INIT.

    *CLEAR HEAD_TAB.

    *IF SEL2 EQ SPACE AND SEL1 EQ SPACE.

    • IF SEL4 EQ SPACE.

    • PERFORM WIN_INFO(ZURL) USING 'Error' 'Enter atleast one' 'Value'.

    • EXIT.

    • ENDIF.

    *ENDIF.

    *

    *PERFORM WRITEITEMS. "Selection Screen

    *----


    • FORM MAIN *

    *----


    • ........ *

    *----


    *FORM MAIN.

    • B_PRNCTR = 0 .

    • LOOP AT I_TAB.

    • CLEAR : B_SECOND_SALE , B_EXEMPTED , B_TAX_LEN .

    • read table i_tab index recno.

  • PERFORM SOLD_TO_PARTY_CHANGE USING I_TAB-INVO.

    • if sy-subrc eq 0.

  • B_INVNO = I_TAB-SDNO.

  • PERFORM FILL_CHAR(ZURL) USING 10 '0' I_TAB-SDNO CHANGING B_INVNO.

  • PERFORM FILL_CHAR(ZURL) USING 10 '0' I_TAB-INVO

  • CHANGING I_TAB-INVO.

  • CLEAR HEAD_TAB-GTOTAL.

  • PERFORM ASSIGN.

    • perform alignwrite.

  • PERFORM OPENFORM USING 'ZINVOICEDUMMY'.

  • PERFORM LAYOUTSETWRITE.

  • DATA : B_SRLNO(4) VALUE 0.

  • DATA : B_CTR TYPE I VALUE 0.

  • DATA : B_LOOPCTR TYPE I VALUE 0.

  • DATA : B_AMT1 LIKE VBRK-NETWR.

  • DATA : B_TEXTELEMENT(3).

  • SUBTOT-B_SUBTOTAL = 0.

  • B_SRLNO = 0.

  • LOOP AT LINE_TAB.

  • ADD 1 TO B_SRLNO.

  • MOVE B_SRLNO TO LINE_TAB-B_LONO.

  • PERFORM TAX_INFO_DETERMINE USING B_SRLNO.

    • " ADDED BY ANIL

  • SUBTOT-B_SUBTOTAL = B_AMT1 + LINE_TAB-AMOUNT.

  • "add line_tab-amount to subtot-b_subtotal.

  • MOVE SUBTOT-B_SUBTOTAL TO B_AMT1.

  • PERFORM LAYOUTSETMAIN USING '100'.

  • MOVE '101' TO B_TEXTELEMENT.

  • IF PRINTSL EQ 'X'.

  • MOVE 'Serial No:' TO SERALIGN-TEXT.

  • LOOP AT SER_TAB WHERE SLNO EQ LINE_TAB-SLNO.

  • IF B_LOOPCTR EQ B_CTR.

  • MOVE SER_TAB-SERNO TO SERALIGN-B_SL1.

  • ADD 1 TO B_CTR.

  • PERFORM LAYOUTSETMAIN USING B_TEXTELEMENT.

  • ENDIF.

  • IF B_LOOPCTR EQ B_CTR.

  • MOVE SER_TAB-SERNO TO SERALIGN-B_SL2.

  • ADD 1 TO B_CTR.

  • PERFORM LAYOUTSETMAIN USING B_TEXTELEMENT.

  • ENDIF.

  • IF B_LOOPCTR EQ B_CTR.

  • MOVE SER_TAB-SERNO TO SERALIGN-B_SL3.

  • ADD 1 TO B_CTR.

  • PERFORM LAYOUTSETMAIN USING B_TEXTELEMENT.

  • ENDIF.

  • B_LOOPCTR = B_LOOPCTR + 1.

  • MOVE '103' TO B_TEXTELEMENT.

  • MOVE ' ' TO SERALIGN-TEXT.

  • ENDLOOP.

  • ENDIF.

  • ENDLOOP.

  • HEAD_TAB-GTOTAL = B_INVRATE + B_INVSTAX + B_INVTOT +

  • B_INVOCTROI + B_INVFORCHARGE.

  • HEAD_TAB-OCHRG = B_INVTOT.

  • IF HEAD_TAB-PLANT EQ '0020'.

  • PERFORM LAYOUTSETMAIN USING '104'.

  • ENDIF.

  • IF B_SURCHARG = 'Y'.

  • PERFORM LAYOUTSETMAIN USING '105'.

  • ENDIF.

  • DESCRIBE TABLE FORM_TAB LINES SY-TABIX .

  • IF SY-TABIX > 0 .

  • SORT FORM_TAB BY MVGR1 .

  • CLEAR : OLD_MVGR1 , B_FORM_IND .

  • LOOP AT FORM_TAB .

  • IF FORM_TAB-MVGR1 <> OLD_MVGR1 AND B_FORM_IND > 1 .

  • SELECT SINGLE * FROM TVM1T WHERE MVGR1 = OLD_MVGR1 .

  • CONCATENATE '. :' TVM1T-BEZEI INTO B_FORM_TYPE

  • SEPARATED BY SPACE .

  • PERFORM PRINT_TAX_INFO USING B_FORM_TEXT B_FORM_TYPE .

  • CLEAR B_FORM_TEXT .

  • ENDIF .

  • ADD 1 TO B_FORM_IND .

  • OLD_MVGR1 = FORM_TAB-MVGR1 .

  • CONCATENATE B_FORM_TEXT ',' FORM_TAB-SLNO INTO B_FORM_TEXT

  • SEPARATED BY SPACE .

  • ENDLOOP .

  • SELECT SINGLE * FROM TVM1T WHERE MVGR1 = OLD_MVGR1 .

  • CONCATENATE '. :' TVM1T-BEZEI INTO B_FORM_TYPE

  • SEPARATED BY SPACE .

  • PERFORM PRINT_TAX_INFO USING B_FORM_TEXT B_FORM_TYPE .

  • CLEAR B_FORM_TEXT .

  • ENDIF .

  • PERFORM LAYOUTSETMAIN USING '109'.

  • B_TAX_LEN = STRLEN( B_SECOND_SALE ) .

  • IF B_TAX_LEN > 0 .

  • PERFORM PRINT_TAX_INFO USING B_SECOND_SALE

  • '. : Second Sales - No Tax' .

  • ENDIF .

  • B_TAX_LEN = STRLEN( B_EXEMPTED ) .

  • IF B_TAX_LEN > 0 .

  • PERFORM PRINT_TAX_INFO USING B_EXEMPTED

  • '. : Software Exempted From Tax' .

  • ENDIF .

  • *

    • B_TAX_LEN = STRLEN( B_HEXEMPTED ) .

    • IF B_TAX_LEN > 0 .

    • PERFORM PRINT_TAX_INFO USING B_HEXEMPTED

    • '. : Exempted From Tax' .

    • ENDIF .

    • MOVE 'Sales Tax Shown is inclusive of surcharge @ 10%'

    • TO B_TAX_STR.

    • REFRESH : FORM_TAB .

    • CLEAR : B_SECOND_SALE , B_EXEMPTED , B_TAX_LEN ,B_FORM_TEXT,

    • FORM_TAB , B_HEXEMPTED .

    • PERFORM CONVERT.

    • PERFORM LAYOUTFOOTER USING '102'.

    • PERFORM CLOSEFORM(ZURL).

    • PERFORM INIT.

    • endif.

  • ENDLOOP.

  • *ENDFORM.

    *

    *----


    • FORM ASSIGN *

    *----


    • ........ *

    *----


    *FORM ASSIGN.

    • B_INVSTAX = 0.

    • B_INVRATE = 0.

    • REFRESH SER_TAB.

    • perform gettax using i_tab-invo.

  • HEAD_TAB-DOCNO = I_TAB-INVO.

  • SELECT SINGLE * FROM VBRK WHERE VBELN EQ HEAD_TAB-DOCNO.

  • HEAD_TAB-DOCDT = VBRK-FKDAT.

  • FKART = VBRK-FKART.

  • SELECT SINGLE * FROM VBAK WHERE VBELN = I_TAB-ORNO.

  • MOVE VBAK-VKBUR TO HEAD_TAB-SALOF.

  • MOVE VBAK-BSTNK TO HEAD_TAB-POREF.

  • MOVE VBAK-BSTDK TO HEAD_TAB-PODAT.

  • SELECT SINGLE * FROM VBPA WHERE VBELN EQ I_TAB-INVO AND PARVW EQ 'RE'.

  • IF B_SPCFLAG EQ 'T'.

  • SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ B_SOLDTOPARTYCODE.

  • SELECT SINGLE * FROM KNB1 WHERE KUNNR EQ B_SOLDTOPARTYCODE.

  • SELECT SINGLE * FROM KNVK WHERE KUNNR EQ B_SOLDTOPARTYCODE.

    • move knvk-name1 to head_tab-cperson.

    • move knvk-telf1 to head_tab-tphone.

  • MOVE KNA1-NAME1 TO SOLDP_TAB-NAME. "SOLD TO PARTY

  • MOVE KNA1-NAME2 TO SOLDP_TAB-ADD1. "SOLD TO PARTY

  • MOVE KNA1-NAME3 TO SOLDP_TAB-ADD2. "SOLD TO PARTY

  • MOVE KNA1-NAME4 TO SOLDP_TAB-ADD6. "added By deepak 26/11/98

  • MOVE KNA1-ORT01 TO SOLDP_TAB-ADD3. "SOLD TO PARTY

  • MOVE KNA1-PSTLZ TO SOLDP_TAB-ADD4. "SOLD TO PARTY

  • MOVE KNA1-REGIO TO SOLDP_TAB-ADD5. "SOLD TO PARTY

  • ELSE.

  • SELECT SINGLE * FROM KNB1 WHERE KUNNR EQ VBPA-KUNNR.

  • IF VBPA-ADRNR EQ SPACE.

  • SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBPA-KUNNR.

  • MOVE KNA1-NAME1 TO SOLDP_TAB-NAME. "SOLD TO PARTY

  • MOVE KNA1-NAME2 TO SOLDP_TAB-ADD1. "SOLD TO PARTY

  • MOVE KNA1-NAME3 TO SOLDP_TAB-ADD2. "SOLD TO PARTY

  • MOVE KNA1-NAME4 TO SOLDP_TAB-ADD6. "added By deepak 26/11/98

  • MOVE KNA1-ORT01 TO SOLDP_TAB-ADD3. "SOLD TO PARTY

  • MOVE KNA1-PSTLZ TO SOLDP_TAB-ADD4. "SOLD TO PARTY

  • MOVE KNA1-REGIO TO SOLDP_TAB-ADD5. "SOLD TO PARTY

  • ELSE.

  • SELECT SINGLE * FROM SADR WHERE ADRNR EQ VBPA-ADRNR.

  • MOVE SADR-NAME1 TO SOLDP_TAB-NAME. "SOLD TO PARTY

  • MOVE SADR-NAME2 TO SOLDP_TAB-ADD1. "SOLD TO PARTY

  • MOVE SADR-NAME3 TO SOLDP_TAB-ADD2. "SOLD TO PARTY

  • MOVE SADR-NAME4 TO SOLDP_TAB-ADD6.

  • MOVE SADR-ORT01 TO SOLDP_TAB-ADD3. "SOLD TO PARTY

  • MOVE SADR-PSTLZ TO SOLDP_TAB-ADD4. "SOLD TO PARTY

  • MOVE SADR-REGIO TO SOLDP_TAB-ADD5. "SOLD TO PARTY

  • ENDIF.

  • ENDIF.

    • insereted by anil on request by raghu 4/7/98

  • select single * from knvk where kunnr eq vbpa-kunnr.

  • CLEAR VBPA .

  • SELECT * FROM VBPA WHERE VBELN EQ VBAK-VBELN AND PARVW = 'AP' AND

  • ( PARNR NE SPACE OR ADRNR NE SPACE ) .

  • IF NOT VBPA-ADRNR IS INITIAL .

  • SELECT SINGLE * FROM SADR WHERE ADRNR = VBPA-ADRNR .

  • MOVE SADR-NAME3 TO HEAD_TAB-CPERSON.

  • MOVE SADR-TELF1 TO HEAD_TAB-TPHONE.

  • ELSE .

  • SELECT SINGLE * FROM KNVK WHERE PARNR = VBPA-PARNR .

  • MOVE KNVK-NAME1 TO HEAD_TAB-CPERSON.

  • MOVE KNVK-TELF1 TO HEAD_TAB-TPHONE.

  • ENDIF .

  • EXIT .

  • ENDSELECT .

  • MOVE VBAK-VKBUR TO HEAD_TAB-SALOF.

  • MOVE VBAK-VBELN TO HEAD_TAB-SALESOR.

  • MOVE VBAK-WAERK TO HEAD_TAB-BILLCUR.

  • MOVE KNA1-KUNNR TO HEAD_TAB-CCODE.

    • END OF INSERTION

  • SELECT SINGLE * FROM VBPA WHERE VBELN EQ I_TAB-INVO AND PARVW EQ 'WE'.

  • IF VBPA-ADRNR EQ SPACE.

  • SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBPA-KUNNR.

  • MOVE KNA1-KUNNR TO B_SHIP_TO_PARTY."SHIP TO PARTY

  • MOVE KNA1-NAME1 TO SHIPP_TAB-NAME. "SHIP TO PARTY

  • MOVE KNA1-NAME2 TO SHIPP_TAB-ADD1. "SHIP TO PARTY

  • MOVE KNA1-NAME3 TO SHIPP_TAB-ADD2. "SHIP TO PARTY

  • MOVE KNA1-NAME4 TO SHIPP_TAB-ADD6. " add by deepak on 26/11/98

  • MOVE KNA1-ORT01 TO SHIPP_TAB-ADD3. "SHIP TO PARTY

  • MOVE KNA1-PSTLZ TO SHIPP_TAB-ADD4. "SHIP TO PARTY

  • MOVE KNA1-REGIO TO SHIPP_TAB-ADD5. "SHIP TO PARTY

  • ELSE.

  • SELECT SINGLE * FROM SADR WHERE ADRNR EQ VBPA-ADRNR.

    • move kna1-kunnr to b_ship_to_party. "SHIP TO PARTY

  • MOVE SADR-NAME1 TO SHIPP_TAB-NAME. "SHIP TO PARTY

  • MOVE SADR-NAME2 TO SHIPP_TAB-ADD1. "SHIP TO PARTY

  • MOVE SADR-NAME3 TO SHIPP_TAB-ADD2. "SHIP TO PARTY

  • MOVE SADR-NAME4 TO SHIPP_TAB-ADD6.

  • MOVE SADR-ORT01 TO SHIPP_TAB-ADD3. "SHIP TO PARTY

  • MOVE SADR-PSTLZ TO SHIPP_TAB-ADD4. "SHIP TO PARTY

  • MOVE SADR-REGIO TO SHIPP_TAB-ADD5. "SHIP TO PARTY

  • ENDIF.

    • IF B_IFSERVICEORDER EQ 'F'.

    • SELECT SINGLE * FROM LIPS WHERE VBELN EQ B_INVNO.

    • MOVE LIPS-WERKS TO HEAD_TAB-PLANT.

    • ELSE.

  • SELECT SINGLE * FROM VBRP WHERE VBELN EQ I_TAB-INVO

  • AND FKIMG NE 0.

  • MOVE VBRP-WERKS TO HEAD_TAB-PLANT.

  • *

    • endif.

  • SELECT SINGLE * FROM T001W WHERE WERKS EQ HEAD_TAB-PLANT.

  • SELECT SINGLE * FROM SADR WHERE ADRNR EQ T001W-ADRNR.

  • MOVE SADR-NAME1 TO HEAD_TAB-PNAM1.

  • MOVE SADR-NAME2 TO HEAD_TAB-PNAM2.

  • MOVE SADR-NAME3 TO HEAD_TAB-PNAM3.

  • MOVE SADR-NAME4 TO HEAD_TAB-PNAM4.

  • MOVE SADR-PSTLZ TO HEAD_TAB-PNAM5.

  • PERFORM GETCST-LST USING T001W-ADRNR.

  • DATA : B_AMOUNT_ITEM LIKE VBRP-NETWR .

  • PERFORM GETTAXFORLINEITEMS USING I_TAB-INVO.

  • B_INVOCTROI = 0.

  • B_INVFORCHARGE = 0.

  • B_INVTOT = 0.

  • SELECT * FROM VBRP WHERE VBELN = I_TAB-INVO "changed on 15/4

  • AND FKIMG NE 0.

  • B_AMOUNT_ITEM = 0.

  • MOVE VBRP-POSNR+2(4) TO LINE_TAB-SLNO.

  • MOVE VBRP-POSNR TO LINE_TAB-POSNR.

  • MOVE VBRP-MATNR+13(5) TO LINE_TAB-PRODCODE.

  • MOVE VBRP-ARKTX TO LINE_TAB-DESC.

  • SELECT SINGLE * FROM LIPS WHERE VBELN EQ B_INVNO

  • AND VGPOS EQ VBRP-POSNR.

  • SELECT SINGLE * FROM SER01 WHERE LIEF_NR EQ LIPS-VBELN

  • AND POSNR EQ LIPS-POSNR.

  • IF SY-SUBRC EQ 0.

  • SELECT * FROM OBJK WHERE OBKNR EQ SER01-OBKNR.

  • MOVE OBJK-SERNR TO SER_TAB-SERNO.

  • MOVE VBRP-POSNR+2(4) TO SER_TAB-SLNO.

  • WRITE SER_TAB-SERNO NO-ZERO TO SER_TAB-SERNO.

  • CONDENSE SER_TAB-SERNO NO-GAPS.

  • APPEND SER_TAB.

  • ENDSELECT.

  • ENDIF.

  • MOVE VBRP-FKIMG TO B_TEMP.

  • SPLIT B_TEMP AT '.' INTO B_TEMP1 B_TEMP.

  • CONDENSE B_TEMP1 NO-GAPS.

  • MOVE B_TEMP1 TO LINE_TAB-QTY.

  • IF VBRP-KZWI2 GT 0.

  • B_DIVIDE = VBRP-KZWI2 / VBRP-FKIMG.

  • MOVE B_DIVIDE TO LINE_TAB-RATE.

  • B_DIVIDE = 0.

  • ELSE.

  • B_DIVIDE = VBRP-KZWI1 / VBRP-FKIMG.

  • MOVE B_DIVIDE TO LINE_TAB-RATE.

  • B_DIVIDE = 0.

  • ENDIF.

  • B_AMOUNT_ITEM = LINE_TAB-RATE * VBRP-FKIMG.

    • add line_tab-rate to b_invrate.

  • ADD B_AMOUNT_ITEM TO B_INVRATE.

  • MOVE B_AMOUNT_ITEM TO LINE_TAB-AMOUNT.

  • MOVE VBRP-VRKME TO LINE_TAB-UOM.

  • B_TOTAL_TAX = 0.

    • write : / 'before loop' , vbrp-posnr.

  • LOOP AT TKOMV WHERE KPOSN EQ VBRP-POSNR AND KNUMV = VBRK-KNUMV.

    • write : / vbrp-posnr , tkomv-kposn.

  • IF TKOMV-KSCHL IN CTYPE.

  • B_TOTAL_TAX = B_TOTAL_TAX +

  • ( ( ( TKOMV-KBETR * TKOMV-KAWRT ) * 100 ) / 100000 ).

    • b_total_tax = b_total_tax + tkomv-kwert.

  • ADD TKOMV-KWERT TO B_INVSTAX.

  • *

    • ENDIF.

    • IF TKOMV-KSCHL EQ 'ZOCT'.

    • ADD TKOMV-KWERT TO B_INVOCTROI.

    • ENDIF.

    • IF TKOMV-KSCHL EQ 'ZF00' OR TKOMV-KSCHL EQ 'ZF01'.

    • ADD TKOMV-KWERT TO B_INVFORCHARGE.

    • ENDIF.

    • IF TKOMV-KSCHL EQ 'ZIN6'.

    • ADD TKOMV-KWERT TO B_INVTOT.

    • ENDIF.

    • ENDLOOP.

    • B_SURCHARG = 'N'.

    • B_TOT = 0.

    • SORT TKOMV BY KSCHL.

    • LOOP AT TKOMV WHERE KPOSN EQ VBRP-POSNR AND KNUMV = VBRK-KNUMV AND

    • KSCHL IN CTYPE.

    • IF TKOMV-KSCHL = 'ZIN1' OR TKOMV-KSCHL = 'ZIN2'.

    • B_TAX = TKOMV-KBETR / 10.

    • ENDIF.

    • IF TKOMV-KSCHL = 'ZIN3'.

    • B_TAX = B_TAX + ( B_TAX * ( TKOMV-KBETR / 10 ) / 100 ).

    • ENDIF.

    • IF TKOMV-KSCHL = 'ZIN4'.

    • B_TAX = B_TAX + ( B_TAX * ( TKOMV-KBETR / 10 ) / 100 ).

    • B_SURCHARG = 'Y'.

    • ENDIF.

    • ENDLOOP.

    • LOOP AT TKOMV WHERE KSCHL = 'ZIN6'.

    • B_TOT = TKOMV-KBETR / 10.

    • ENDLOOP.

    • MOVE B_TOTAL_TAX TO LINE_TAB-B_TAXAMOUNT_LINE.

    • " b_tax = ( line_tab-b_taxamount_line / line_tab-amount ) * 100.

    • MOVE B_TAX TO LINE_TAB-STAX .

    • MOVE B_TOT TO LINE_TAB-OTAX.

    ***Recently added**

    • B_AMOUNT_ITEM = 0.

    • B_TOTAL_TAX = 0.

    • B_TAX = 0.

    • B_TOT = 0.

    • b_invrate = 0.

    ****till here

    • APPEND LINE_TAB.

    • ENDSELECT.

    • PERFORM PRINTTEXT.

    *ENDFORM.

    *

    *END-OF-SELECTION .

    *

    *----


    • FORM WRITEITEMS *

    *----


    • ........ *

    *----


    *FORM WRITEITEMS.

    • DATA : POPULATE TYPE I.

    • PERFORM SELECTDATA.

    • DESCRIBE TABLE INV_TAB LINES POPULATE.

    • IF POPULATE NE 0.

    • LOOP AT INV_TAB.

    • ULINE AT 5(83).

    • AT FIRST.

    • WRITE : /5 '|' ,10 '|SALES DOCUMENT NO' COLOR 3,

    • 30 '|DELIVERY DOCUMENT NO' COLOR 3,

    • 52 '|PAYER.. ' COLOR 3 ,

    • 87 '|'.

    • ULINE AT /5(83).

    • ENDAT.

    • SELECT * FROM VBRK WHERE VBELN EQ INV_TAB-BILLNO.

    • MOVE VBRK-VBELN TO HEAD_TAB-DOCNO.

    • MOVE VBRK-FKDAT TO HEAD_TAB-DOCDT.

    • SELECT * FROM VBFA WHERE VBELN EQ VBRK-VBELN.

    • " and vbtyp_v ca 'JBGC'.

    • IF VBFA-VBTYP_V EQ 'G' OR VBFA-VBTYP_V EQ 'C'.

    • B_IFSERVICEORDER = 'F'.

    • ENDIF.

    • IF VBFA-VBTYP_V = 'J'.

    • B_IFSERVICEORDER = 'T'.

    • ENDIF.

    • ENDSELECT.

    • IF B_IFSERVICEORDER EQ 'T'.

    • SELECT SINGLE * FROM VBFA WHERE VBELN EQ VBRK-VBELN

    • AND VBTYP_V EQ 'J'.

    • SELECT * FROM LIKP WHERE VBELN EQ VBFA-VBELV.

    • IF SY-SUBRC NE 4.

    • SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBRK-KUNRG.

    • IFSELECTED = 'X'.

    • WRITE : /5 '|' ,8 IFSELECTED AS CHECKBOX ,10 '|',

    • 11 VBRK-VBELN ,30 '|' ,31 LIKP-VBELN ,52 '|',

    • 53 KNA1-NAME1 ,87 '|', LIKP-WERKS.

    • ULINE AT /5(83).

    • B_RECCOUNT = B_RECCOUNT + 1.

    • ENDIF.

    • ENDSELECT.

    • ELSE.

    • SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBRK-KUNRG.

    • IFSELECTED = 'X'.

    • WRITE : /5 '|' ,8 IFSELECTED AS CHECKBOX ,10 '|',

    • 11 VBRK-VBELN ,30 '|' ,31 LIKP-VBELN ,52 '|',

    • 53 KNA1-NAME1 ,87 '|', LIKP-WERKS.

    • ULINE AT /5(83).

    • B_RECCOUNT = B_RECCOUNT + 1.

    • ENDIF.

    • ENDSELECT.

    • ENDLOOP.

    • ENDIF.

    *ENDFORM.

    *

    *

    *AT USER-COMMAND.

    • DATA : CHECK(1).

    • DATA : TOTALLINES LIKE SY-INDEX.

    • START = 4.

    • REFRESH LINE_TAB.

    • REFRESH SER_TAB.

    • B_PRNUCOMM = SY-UCOMM.

    • DESCRIBE TABLE I_TAB LINES TOTALLINES.

    • IF SY-UCOMM NE 'NEXT' AND SY-UCOMM NE 'LAST'.

    • do b_reccount times.

  • REFRESH I_TAB.

  • DO.

  • READ LINE START FIELD VALUE IFSELECTED INTO CHECK.

  • IF SY-SUBRC EQ 0.

  • IF CHECK EQ 'X'.

  • READ LINE START FIELD VALUE LIKP-VBELN INTO I_TAB-SDNO.

  • READ LINE START FIELD VALUE VBRK-VBELN INTO I_TAB-INVO.

  • SELECT SINGLE * FROM VBFA WHERE VBELN EQ I_TAB-INVO

  • AND VBTYP_V EQ 'C'.

  • I_TAB-ORNO = VBFA-VBELV.

  • APPEND I_TAB.

  • CHECK = ' '.

  • ENDIF.

  • START = START + 2.

  • ELSE.

  • EXIT.

  • ENDIF.

  • ENDDO.

  • ENDIF.

  • DATA : B_UCOMM LIKE SY-UCOMM.

  • MOVE SY-UCOMM TO B_UCOMM.

  • CASE B_UCOMM.

  • WHEN 'NEXT'.

  • RECNO = RECNO + 1.

  • IF RECNO GT TOTALLINES.

  • RECNO = 1.

  • ENDIF.

    • read table i_tab index recno.

    • perform sold_to_party_change using i_tab-invo.

  • PERFORM MAIN.

  • WHEN 'LAST'.

  • RECNO = RECNO - 1.

  • IF RECNO LT 1.

  • RECNO = 1.

  • ENDIF.

    • read table i_tab index recno.

    • perform sold_to_party_change using i_tab-invo.

  • PERFORM MAIN.

  • WHEN 'PRIN'.

    • read table i_tab index recno.

    • set pf-status '101'.

    • perform sold_to_party_change using i_tab-invo.

  • PRINT-CONTROL FUNCTION 'CI015'.

  • PERFORM MAIN.

  • WHEN 'PREV'.

  • READ TABLE I_TAB INDEX RECNO.

  • NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • set pf-status '102'.

    • perform sold_to_party_change using i_tab-invo.

  • PRINT-CONTROL FUNCTION 'CI015'.

  • PERFORM MAIN.

  • WHEN 'QUIT'.

  • LEAVE SCREEN .

  • EXIT.

  • ENDCASE.

  • *----


    • FORM PRINTTEXT *

    *----


    • ........ *

    *----


    *FORM PRINTTEXT.

    • PERFORM READTEXT USING '0002' 'VBBK'.

    • PERFORM READTEXT USING '0003' 'VBBK'.

    • PERFORM READTEXT USING '0004' 'VBBK'.

    • PERFORM READTEXT USING '0012' 'VBBK'.

    • PERFORM READTEXT USING '0013' 'VBBK'.

    • PERFORM READTEXT USING '0022' 'VBBK'.

    • PERFORM READTEXT USING 'Z103' 'VBBP' .

    • PERFORM READTEXT USING 'Z104' 'VBBP' .

    • added by praveen as per selvam's request.

  • IF FKART = 'FV'.

  • PERFORM READTEXT USING 'ZIS1' 'VBBK'.

  • PERFORM READTEXT USING 'ZIS2' 'VBBK'.

  • ENDIF.

  • *ENDFORM.

    *

    *----


    • FORM READTEXT *

    *----


    • ........ *

    *----


    • --> B_ID *

    *----


    *FORM READTEXT USING B_ID B_OBJECT.

    • DATA : BEGIN OF HEADER1 OCCURS 0.

    • INCLUDE STRUCTURE THEAD.

    • DATA : END OF HEADER1.

    • DATA : BEGIN OF LINE1 OCCURS 0.

    • INCLUDE STRUCTURE TLINE.

    • DATA : END OF LINE1.

    • DATA : B_NAME LIKE THEAD-TDNAME.

    • B_NAME = I_TAB-SDNO.

    • PERFORM FILL_CHAR(ZURL) USING 10 '0' I_TAB-SDNO CHANGING B_NAME.

    • added by praveen to pick up from and to date for invoice.

  • IF B_ID = 'ZIS1' OR B_ID = 'ZIS2'.

  • B_NAME = I_TAB-INVO.

  • ENDIF.

  • IF B_OBJECT = 'VBBP'.

  • CONCATENATE I_TAB-ORNO VBRP-POSNR INTO B_NAME.

  • ENDIF.

  • *

    • CALL FUNCTION 'READ_TEXT'

    • EXPORTING

    • ID = B_ID

    • LANGUAGE = 'E'

    • NAME = B_NAME

    • OBJECT = B_OBJECT

    • header = header1

    • IMPORTING

  • HEADER = HEADER1

  • TABLES

  • LINES = LINE1

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8.

  • DATA : LINE(40).

  • LOOP AT LINE1.

  • LINE = LINE1-TDLINE.

  • ENDLOOP.

  • CASE B_ID.

  • WHEN '0002'.

  • HEAD_TAB-CARNAME = LINE.

  • WHEN '0012'.

  • HEAD_TAB-SPSHIPI = LINE.

  • WHEN '0013'.

  • HEAD_TAB-SPCARIN = LINE.

  • WHEN '0003'.

  • HEAD_TAB-LRNO = LINE.

  • WHEN '0004'.

  • HEAD_TAB-LRDT = LINE.

  • WHEN '0022'.

  • HEAD_TAB-MODEPAY = LINE.

  • WHEN 'Z103'.

  • HEAD_TAB-CSTNO = LINE.

  • WHEN 'Z104'.

  • HEAD_TAB-LSTNO = LINE.

  • WHEN 'ZIS1'.

  • HEAD_TAB-FROMDATE = LINE.

  • CONDENSE HEAD_TAB-FROMDATE NO-GAPS.

  • WHEN 'ZIS2'.

  • HEAD_TAB-ENDDATE = LINE.

  • CONDENSE HEAD_TAB-ENDDATE NO-GAPS.

  • ENDCASE.

  • *ENDFORM.

    *----


    • FORM INIT *

    *----


    • ........ *

    *----


    *FORM INIT.

    • CLEAR HEAD_TAB.

    • REFRESH LINE_TAB.

    • CLEAR LINE_TAB.

    • REFRESH SER_TAB.

    • CLEAR SER_TAB.

    • B_DIFFCOUNT = 0.

    • B_COUNTOFRECORDS = 0.

    • B_ORDERREFNO = ' '.

    • B_RATEFORITEM = ' '.

    • B_TOTALAMOUNT = 0.

    • B_CUSTOMERNO = ' '.

    • B_RECORDCOUNTER = 0.

    • B_AMOUNTINWORDS = ' '.

    • B_DECIMALAMOUNTINWORDS = ' '.

    • B_AMOUNTINWORDSFINAL = ' '.

    • B_CUSTOMERCODE = ' '.

    • B_STRINGLENGTH = 0.

    • B_INVNO = ' '.

    • B_RECCOUNT = 0 .

    • START = 0.

    • IFSELECTED = ' '.

    • ANS = ' '.

    *ENDFORM.

    *

    *----


    • FORM GETTAX *

    *----


    • ........ *

    *----


    • --> INVO *

    *----


    *FORM GETTAX USING INVO.

    • DATA: BEGIN OF TKOMVD OCCURS 0.

    • INCLUDE STRUCTURE KOMVD.

    • DATA: END OF TKOMVD.

    • DATA: BEGIN OF COMM_ITEM_E OCCURS 0.

    • INCLUDE STRUCTURE KOMP .

    • DATA: END OF COMM_ITEM_E.

    • REFRESH TKOMV.

    • MOVE 'I' TO CTYPE-SIGN.

    • MOVE 'BT' TO CTYPE-OPTIONS.

    • MOVE 'ZIN4' TO CTYPE-HIGH.

    • MOVE 'ZIN1' TO CTYPE-LOW.

    • APPEND CTYPE.

    *

    • SELECT SINGLE * FROM VBRK WHERE VBELN = INVO.

    • MOVE-CORRESPONDING VBRK TO KOMK.

    • CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

    • EXPORTING

    • COMM_HEAD_I = KOMK

    • COMM_ITEM_I = KOMP

    • TABLES

    • TKOMV = TKOMV

    • TKOMVD = TKOMVD

    • EXCEPTIONS

    • OTHERS = 1.

    • SUB TOTAL AMOUNT

  • LOOP AT TKOMV .

  • IF TKOMV-KSCHL EQ 'ZSRP'.

  • HEAD_TAB-STAMT = HEAD_TAB-STAMT + TKOMV-KWERT.

  • ENDIF.

  • ENDLOOP.

  • **SALES TAX AMOUNT

    • ELECT * FROM VBRP WHERE VBELN EQ INVO AND FKIMG NE 0. "changed on 15/4

    • LOOP AT TKOMV WHERE KPOSN EQ VBRP-POSNR.

    • IF TKOMV-KSCHL IN CTYPE.

    • HEAD_TAB-STAXAMT = HEAD_TAB-STAXAMT + TKOMV-KWERT.

    • ENDIF.

    • ENDLOOP.

    • ENDSELECT.

    • FORWARDING CHARGES

  • LOOP AT TKOMV.

  • IF TKOMV-KSCHL EQ 'ZF00'.

  • HEAD_TAB-FCHRG = HEAD_TAB-FCHRG + TKOMV-KWERT.

  • ENDIF.

  • IF TKOMV-KSCHL EQ 'ZIN6'.

  • HEAD_TAB-OCHRG = HEAD_TAB-OCHRG + TKOMV-KWERT.

  • ENDIF.

  • ENDLOOP.

  • **grand total

    • CLEAR HEAD_TAB-GTOTAL.

    • HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-FCHRG.

    • HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-STAXAMT.

    • HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-STAMT.

    • HEAD_TAB-GTOTAL = HEAD_TAB-GTOTAL + HEAD_TAB-OCHRG.

    • PERFORM CONVERT.

    *ENDFORM.

    **& Form GETCST-LST

    *FORM GETCST-LST USING B_REGION.

    • SELECT SINGLE * FROM SADR WHERE ADRNR EQ B_REGION.

    • MOVE SADR-TELTX TO HEAD_TAB-PLSTNO.

    • MOVE SADR-TELX1 TO HEAD_TAB-PCSTNO.

    *ENDFORM. " GETCST-LST

    **& Form ALIGNWRITE

    *FORM ALIGNWRITE.

    **set pf-status '102'.

    • PERFORM HEADER.

    • DATA : LINECTR TYPE I VALUE 0.

    • DATA : B_RATE(12),B_AMOUNT(13).

    • DATA : B_SCOUNT TYPE I VALUE 0.

    • DATA B_SRLNO TYPE I VALUE 0.

    • DATA : B_FLAG TYPE I VALUE 0.

    • DATA : B_SUBTOTAL LIKE VBRP-NETWR VALUE 0.

    • LOOP AT LINE_TAB.

    • ADD 1 TO LINECTR.

    • ADD 1 TO B_SRLNO.

    • B_RATE = LINE_TAB-RATE.

    • B_AMOUNT = LINE_TAB-AMOUNT.

    • WRITE : / ' ',7(4) B_SRLNO.

    • WRITE :14 LINE_TAB-PRODCODE.

    • WRITE :23 LINE_TAB-DESC.

    • WRITE :67(3) LINE_TAB-UOM.

    • WRITE :73(5) LINE_TAB-QTY RIGHT-JUSTIFIED.

    • WRITE :80(14) LINE_TAB-RATE RIGHT-JUSTIFIED.

    • B_SUBTOTAL = B_SUBTOTAL + LINE_TAB-AMOUNT.

    • WRITE :95(12) LINE_TAB-AMOUNT RIGHT-JUSTIFIED.

    • CONDENSE LINE_TAB-STAX NO-GAPS.

    • LINE_TAB-STAX =

    • ( LINE_TAB-B_TAXAMOUNT_LINE / LINE_TAB-AMOUNT ) * 100.

    • WRITE :110 LINE_TAB-STAX(5).

    • PERFORM IFENDOFPAGE USING LINECTR B_SUBTOTAL.

    *

    • " write :95 line_tab-otax.

    • B_SCOUNT = 0.

    • IF PRINTSL EQ 'X'.

    *

    • DESCRIBE TABLE SER_TAB LINES B_FLAG.

    • IF B_FLAG NE 0.

    • WRITE : / ' ',12 'Serial Nos :'.

    • ADD 1 TO LINECTR.

    • ENDIF.

    • LOOP AT SER_TAB WHERE SLNO EQ LINE_TAB-SLNO.

    • B_SCOUNT = B_SCOUNT + 1.

    • WRITE : (18)SER_TAB-SERNO NO-GAP,' '.

    • IF B_SCOUNT EQ 3.

    • WRITE : /23 ' '.

    • ADD 1 TO LINECTR.

    • B_SCOUNT = 0.

    • ENDIF.

    • PERFORM IFENDOFPAGE USING LINECTR B_SUBTOTAL.

    • ENDLOOP.

    • B_SCOUNT = 0.

    • ENDIF.

    • ENDLOOP.

    • DATA : B_EXTRA TYPE I.

    • B_EXTRA = 23 - LINECTR.

    • DO B_EXTRA TIMES.

    • WRITE : ' ' ,/.

    • ENDDO.

    • PERFORM FOOTER.

    *

    *ENDFORM. " ALIGNWRITE

    ***form footer **

    *FORM FOOTER.

    • WRITE :/ ' '.

    • WRITE :/ ' ',24 HEAD_TAB-BILLCUR,58 B_INVRATE,

    • 101 HEAD_TAB-CARNAME+0(15).

    • WRITE :/58 B_INVSTAX ,79 HEAD_TAB-CARNAME+15(20).

    • WRITE :/54 'TOT:', HEAD_TAB-OCHRG ,95 HEAD_TAB-LRNO.

    • WRITE :/58 B_INVFORCHARGE , 89 HEAD_TAB-LRDT.

    • WRITE :/17 HEAD_TAB-LSTNO,58 B_INVOCTROI , 99 HEAD_TAB-MODEPAY.

    • EAD_TAB-GTOTAL = B_INVRATE + B_INVSTAX + B_INVOCTROI + B_INVFORCHARGE.

    • WRITE :/17 HEAD_TAB-CSTNO,61 HEAD_TAB-GTOTAL.

    • PERFORM CONVERT.

    • WRITE :/ ' ',/,/.

    • WRITE :/17 HEAD_TAB-PLSTNO4(31),44 B_AMOUNTINWORDS0(100).

    • WRITE :/17 HEAD_TAB-PCSTNO4(31),44 B_AMOUNTINWORDS100(100).

    • WRITE : /.

    *ENDFORM.

    **HEADER INFO PRINTING*

    *FORM HEADER.

    • DATA : B_POREF(35).

    **concatenate head_tab-poref '/' head_tab-podat into b_poref.

    • CONDENSE HEAD_TAB-PODAT.

    • CONDENSE HEAD_TAB-POREF.

    • FORMAT INTENSIFIED OFF.

    • WRITE : / ' ',/,/. "a line feed is removed

    • WRITE : / ' ',83 HEAD_TAB-PNAM1.

    • WRITE : / ' ',83 HEAD_TAB-PNAM2.

    • WRITE : / ' ',83 HEAD_TAB-PNAM3.

    • PRINT-CONTROL FUNCTION 'CI010'.

    • WRITE : /13 HEAD_TAB-DOCNO,61 HEAD_TAB-DOCDT.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • WRITE : ' ',86 HEAD_TAB-PNAM5.

    • WRITE :/83 HEAD_TAB-PNAM4.

    • WRITE : / ' ',/, 90 HEAD_TAB-SPSHIPI+0(30).

    • WRITE : /8 SOLDP_TAB-NAME ,47 SHIPP_TAB-NAME,

    • 90 HEAD_TAB-SPSHIPI+30(10).

    • WRITE : / ' ',8 SOLDP_TAB-ADD1 , 47 SHIPP_TAB-ADD1.

    • WRITE : / ' ',8 SOLDP_TAB-ADD2 , 47 SHIPP_TAB-ADD2.

    • WRITE : / ' ',8 SOLDP_TAB-ADD6 , 47 SHIPP_TAB-ADD6,

    • 90 HEAD_TAB-SPCARIN+0(30).

    • WRITE : / ' ',8 SOLDP_TAB-ADD3 , 47 SHIPP_TAB-ADD3,

    • 90 HEAD_TAB-SPCARIN+30(10).

    • WRITE : / ' ',8 SOLDP_TAB-ADD4 , 47 SHIPP_TAB-ADD4.

    *

    • WRITE : / ' ',25 HEAD_TAB-CCODE ,68 HEAD_TAB-CPERSON ,

    • 109 HEAD_TAB-SALESOR,/.

    • MOVE HEAD_TAB-PODAT TO B_STR.

    • CONCATENATE B_STR6(2) '.' B_STR4(2) '.' B_STR+2(2) INTO B_STR.

    • CONCATENATE HEAD_TAB-POREF '/' B_STR INTO B_STR.

    • MOVE B_STR TO HEAD_TAB-POREF.

    • WRITE : / ' ',25 B_STR.

    • WRITE : ' ',64 HEAD_TAB-TPHONE NO-ZERO,109 HEAD_TAB-SALOF.

    • WRITE : / ' ',/,/,/,/.

    *ENDFORM.

    *----


    • FORM CONVERT *

    *----


    • ........ *

    *----


    *FORM CONVERT.

    • DATA : B_WORDS(100).

    • DATA : B_DECIS(100).

    • DATA : TEMP1(40).

    • DATA : TEMP2(40).

    *

    • CALL FUNCTION 'Z_CONVERSION_TO_WORDS'

    • EXPORTING

    • AMOUNT = HEAD_TAB-GTOTAL

    • IMPORTING

    • IN_WORDS = B_WORDS

    • IN_DECMS = B_DECIS

    • EXCEPTIONS

    • TOO_LARGE = 1

    • OTHERS = 2.

    • MOVE HEAD_TAB-GTOTAL TO TEMP1.

    • SPLIT TEMP1 AT '.' INTO TEMP1 TEMP2.

    • IF HEAD_TAB-BILLCUR EQ 'INR'.

    • IF TEMP2 NE '00'.

    • CONCATENATE 'Rupees' B_WORDS 'and paise' B_DECIS

    • INTO B_AMOUNTINWORDS SEPARATED BY SPACE.

    • ELSE.

    • CONCATENATE 'Rupees' B_WORDS B_DECIS

    • INTO B_AMOUNTINWORDS SEPARATED BY SPACE.

    • ENDIF.

    • ELSE.

    • CONCATENATE HEAD_TAB-BILLCUR B_WORDS B_DECIS

    • INTO B_AMOUNTINWORDS SEPARATED BY SPACE.

    • ENDIF.

    *ENDFORM.

    *----


    • FORM GETTAXFORLINEITEMS *

    *----


    • ........ *

    *----


    • --> INVO *

    *----


    *FORM GETTAXFORLINEITEMS USING INVO.

    • DATA: BEGIN OF TKOMVD OCCURS 0.

    • INCLUDE STRUCTURE KOMVD.

    • DATA: END OF TKOMVD.

    • CLEAR CTYPE.

    • CLEAR KOMK.

    *

    • SELECT SINGLE * FROM VBRK WHERE VBELN = INVO.

    • MOVE-CORRESPONDING VBRK TO KOMK.

    • CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

    • EXPORTING

    • COMM_HEAD_I = KOMK

    • COMM_ITEM_I = KOMP

    • TABLES

    • TKOMV = TKOMV

    • TKOMVD = TKOMVD

    • EXCEPTIONS

    • OTHERS = 1.

    • DATA : B_TAX TYPE I.

    **SALES TAX pervcentage for line items.

    • MOVE 'I' TO CTYPE-SIGN.

    • MOVE 'BT' TO CTYPE-OPTIONS.

    • MOVE 'ZIN4' TO CTYPE-HIGH.

    • MOVE 'ZIN1' TO CTYPE-LOW.

    • APPEND CTYPE.

    *

    *ENDFORM.

    *----


    • FORM IFENDOFPAGE *

    *----


    • ........ *

    *----


    • --> LINECTR *

    • --> B_SUBTOTAL *

    *----


    *FORM IFENDOFPAGE USING LINECTR B_SUBTOTAL.

    • IF LINECTR EQ 19.

    • WRITE : / ' ',/,10 'Carried forward '.

    • PERFORM PUTALINE.

    • WRITE :83 B_SUBTOTAL.

    • ADD 1 TO LINECTR.

    • "do 37 times.

    • DO 24 TIMES.

    • WRITE : ' ',/.

    • ENDDO.

    • PERFORM HEADER.

    • WRITE : /10 'Brought forward'.

    • PERFORM PUTALINE.

    • WRITE : 83 B_SUBTOTAL.

    • LINECTR = 1.

    • ENDIF.

    *ENDFORM.

    *----


    • FORM PUTALINE *

    *----


    • ........ *

    *----


    *FORM PUTALINE.

    • DO 27 TIMES.

    • WRITE : '-'.

    • ENDDO.

    • WRITE '>'.

    *ENDFORM.

    *----


    • FORM ERRORCHECK *

    *----


    • ........ *

    *----


    • --> SY-SUBRC *

    *----


    *FORM ERRORCHECK USING SY-SUBRC.

    • IF SY-SUBRC NE 0.

    • PERFORM WIN_INFO(ZURL) USING 'Error' 'Document does not exists'

    • 'Please re-enter the doc #'.

    • SET SCREEN 1000.

    • LEAVE SCREEN.

    • EXIT.

    • ENDIF.

    *ENDFORM.

    *----


    • FORM SOLD_TO_PARTY_CHANGE *

    *----


    • ........ *

    *----


    • --> B_INVNO *

    *----


    *FORM SOLD_TO_PARTY_CHANGE USING B_INVNO.

    **TO CHANGE THE SOLD TO PARTY FOR THE BILLING DOCUMENT.

    • DATA : BEGIN OF NEW_SHIP_TAB OCCURS 0.

    • DATA : DESC(20).

    • DATA : CUSTCODE LIKE KNA1-KUNNR.

    • DATA : DUMMY(5).

    • DATA : CUSTNAME LIKE KNA1-NAME1.

    • DATA : END OF NEW_SHIP_TAB.

    • DATA : B_TABIX LIKE SY-TABIX.

    • DATA : B_SOLDCODE LIKE KNA1-KUNNR.

    • DATA : B_PAYCODE LIKE KNA1-KUNNR.

    *

    *

    • SELECT * FROM VBPA WHERE VBELN EQ B_INVNO

    • AND PARVW IN ('RE','WE','AG').

    • SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ VBPA-KUNNR.

    • MOVE KNA1-NAME1 TO NEW_SHIP_TAB-CUSTNAME.

    • MOVE KNA1-KUNNR TO NEW_SHIP_TAB-CUSTCODE.

    • MOVE ' ' TO NEW_SHIP_TAB-DUMMY.

    • CASE VBPA-PARVW.

    • WHEN 'WE'.

    • MOVE 'SHIP TO PARTY' TO NEW_SHIP_TAB-DESC.

    • MOVE KNA1-KUNNR TO B_PAYCODE.

    • WHEN 'RE'.

    • MOVE KNA1-KUNNR TO B_SOLDTOPARTYCODE.

    • MOVE 'PAYER ' TO NEW_SHIP_TAB-DESC.

    • WHEN 'AG'.

    • MOVE KNA1-KUNNR TO B_SOLDCODE.

    • MOVE 'SOLD TO PARTY' TO NEW_SHIP_TAB-DESC.

    • ENDCASE.

    • APPEND NEW_SHIP_TAB.

    • ENDSELECT.

    • B_SPCFLAG = 'F'.

    • IF B_SOLDCODE NE B_SOLDTOPARTYCODE.

    • B_SPCFLAG = 'T'.

    • ELSE.

    • IF B_SOLDTOPARTYCODE NE B_PAYCODE.

    • B_SPCFLAG = 'T'.

    *

    • ELSE.

    • IF B_PAYCODE NE B_SOLDCODE.

    • B_SPCFLAG = 'T'.

    • ENDIF.

    • ENDIF.

    • ENDIF.

    • B_SPCFLAG = 'F'. "added by raghu.

    • IF B_SPCFLAG EQ 'T'.

    • DATA : B_TITLE(40) .

    • CONCATENATE 'INVOICE' B_INVNO 'IN THE NAME OF......' INTO B_TITLE

    • SEPARATED BY SPACE .

    • CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

    • EXPORTING

    • ENDPOS_COL = 70

    • ENDPOS_ROW = 20

    • STARTPOS_COL = 10

    • STARTPOS_ROW = 10

    • TITLETEXT = B_TITLE

    • IMPORTING

    • CHOISE = B_TABIX

    • TABLES

    • VALUETAB = NEW_SHIP_TAB

    • EXCEPTIONS

    • BREAK_OFF = 1

    • OTHERS = 2.

    • READ TABLE NEW_SHIP_TAB INDEX B_TABIX.

    • IF SY-SUBRC EQ 0.

    • B_SOLDTOPARTYCODE = NEW_SHIP_TAB-CUSTCODE.

    • IF B_PRNUCOMM EQ 'PRIN'.

    • NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

  • ENDIF.

  • IF B_PRNUCOMM EQ 'PREV'.

    • NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • IF B_SPCFLAG NE 'T'.

  • IF B_PRNUCOMM EQ 'PRIN'.

    • new-page print on no-title no-heading line-size 132 line-count 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

  • ENDIF.

  • IF B_PRNUCOMM EQ 'PREV'.

    • NEW-PAGE PRINT OFF NO-TITLE NO-HEADING LINE-SIZE 132 LINE-COUNT 65.

    • PRINT-CONTROL FUNCTION 'CI015'.

    • PERFORM MAIN.

  • ENDIF.

  • ENDIF.

  • *ENDFORM.

    *----


    • FORM SELECTDATA *

    *----


    • ........ *

    *----


    *FORM SELECTDATA.

    • DATA : TABLELINES1 TYPE I.

    • DATA : TABLELINES2 TYPE I.

    • DATA : TABLELINES3 TYPE I.

    • DATA : TABLELINES4 TYPE I.

    • DATA : TABLELINES5 TYPE I.

    • DATA : FLAG VALUE 'F'.

    *

    • DESCRIBE TABLE SEL1 LINES TABLELINES1.

    • DESCRIBE TABLE SEL2 LINES TABLELINES2.

    • DESCRIBE TABLE SEL4 LINES TABLELINES4.

    *

    • IF TABLELINES1 NE 0.

    • FLAG = 'T'.

    • SELECT * FROM VBRK WHERE VBELN IN SEL1.

    • IF SY-SUBRC EQ 0.

    • MOVE VBRK-VBELN TO INV_TAB-BILLNO.

    • APPEND INV_TAB.

    • ENDIF.

    • ENDSELECT.

    • ELSE.

    *

    • IF TABLELINES2 NE 0.

    • FLAG = 'T'.

    • SELECT * FROM LIKP WHERE VBELN IN SEL2.

    • IF SY-SUBRC EQ 0.

    • SELECT SINGLE * FROM VBFA WHERE VBELN EQ LIKP-VBELN

    • AND VBTYP_V EQ 'C'.

    • IF SY-SUBRC EQ 0.

    • SELECT SINGLE * FROM VBFA WHERE VBELV EQ LIKP-VBELN

    • AND VBTYP_N EQ 'M'.

    • IF SY-SUBRC EQ 0.

    • MOVE VBFA-VBELN TO INV_TAB-BILLNO.

    • APPEND INV_TAB.

    • ENDIF.

    • ENDIF.

    • ENDIF.

    • ENDSELECT.

    • ENDIF.

    • ENDIF.

    • IF FLAG = 'F'.

    • SELECT * FROM VBRK.

    • SELECT SINGLE * FROM VBFA WHERE VBELN EQ VBRK-VBELN

    • AND VBTYP_V EQ 'C'.

    • SELECT SINGLE * FROM VBAK WHERE VBELN EQ VBFA-VBELV.

    • IF VBAK-KUNNR IN SEL4.

    • IF SY-SUBRC EQ 0.

    • MOVE VBRK-VBELN TO INV_TAB.

    • APPEND INV_TAB.

    • ENDIF.

    • ENDIF.

    • ENDSELECT.

    • ENDIF.

    *

    *ENDFORM.

    **&----


    *----


    **& Form LAYOUTSETWRITE

    **&----


    *----


    *FORM LAYOUTSETWRITE.

    • DATA : BEGIN OF WINLIST OCCURS 0.

    • DATA : WINNAME(15).

    • DATA : END OF WINLIST.

    • MOVE 'INVNO' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'INDATE' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'PLANTADD' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'BILLTO' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'SHIPTO' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'SPLSHIP' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'SPLCARR' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'CUSCODE' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'CPERSON' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'SORDERNO' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'SOFFCODE' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'POREFDT' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • MOVE 'TELPHONE' TO WINLIST-WINNAME.

    • APPEND WINLIST.

    • LOOP AT WINLIST.

    • CALL FUNCTION 'WRITE_FORM'

    • EXPORTING

    • WINDOW = WINLIST-WINNAME

    • EXCEPTIONS

    • ELEMENT = 1

    • FUNCTION = 2

    • TYPE = 3

    • UNOPENED = 4

    • UNSTARTED = 5

    • WINDOWS = 6

    • OTHERS = 7.

    • ENDLOOP.

    *ENDFORM. " LAYOUTSETWRITE

    *

    *----


    • FORM LAYOUTFOOTER *

    *----


    • ........ *

    *----


    • --> B_ELEMENT *

    *----


    *FORM LAYOUTFOOTER USING B_ELEMENT.

    • DATA : BEGIN OF WINLISTFOOTER OCCURS 0.

    • DATA : WINNAME(15).

    • DATA : END OF WINLISTFOOTER.

    • MOVE 'BILLCUR' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'AMTWORDS' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'CARRNAME' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'LRNO' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'LRDATE' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'MOFDESP' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'SUBTOTAL' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'MLCSTLST' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • MOVE 'LSTCSTNO' TO WINLISTFOOTER-WINNAME.

    • APPEND WINLISTFOOTER.

    • LOOP AT WINLISTFOOTER .

    • CALL FUNCTION 'WRITE_FORM'

    • EXPORTING

    • WINDOW = WINLISTFOOTER-WINNAME

    • ELEMENT = B_ELEMENT

    • EXCEPTIONS

    • ELEMENT = 1

    • FUNCTION = 2

    • TYPE = 3

    • UNOPENED = 4

    • UNSTARTED = 5

    • WINDOWS = 6

    • OTHERS = 7.

    • ENDLOOP.

    *

    *ENDFORM.

    **& Form LAYOUTSETMAIN

    *FORM LAYOUTSETMAIN USING B_ELEMENT.

    • CALL FUNCTION 'WRITE_FORM'

    • EXPORTING

    • WINDOW = 'MAIN'

    • ELEMENT = B_ELEMENT

    • EXCEPTIONS

    • ELEMENT = 1

    • FUNCTION = 2

    • TYPE = 3

    • UNOPENED = 4

    • UNSTARTED = 5

    • WINDOWS = 6

    • OTHERS = 7.

    *ENDFORM. " LAYOUTSETMAIN

    *----


    • FORM OPENFORM *

    *----


    • ........ *

    *----


    • --> B_FORMNAME *

    *----


    *FORM OPENFORM USING B_FORMNAME.

    • DATA : B_ELEMENT(10) VALUE 'ABAP'.

    *

    • IF B_UCOMM EQ 'PRIN'.

    • B_ELEMENT = 'PRINTER'.

    • ITCPO-TDNOPREV = 'X'.

    • ENDIF .

    **ELSE.

    • ITCPO-TDNOPRINT = 'X'.

    • ITCPO-TDPREVIEW = 'X'.

    • B_ELEMENT = 'PRINTER'.

    **ENDIF.

    • IF B_PRNCTR = 0 .

    • B_PRNCTR = 1 .

    • MOVE : 'X' TO ITCPO-TDIMMED ,

    • 'X' TO ITCPO-TDDELETE ,

    • 'X' TO ITCPO-TDPREVIEW ,

    • 'X' TO ITCPO-TDNEWID .

    *

    • CALL FUNCTION 'OPEN_FORM'

    • EXPORTING

    • FORM = B_FORMNAME

    • OPTIONS = ITCPO

    • DEVICE = B_ELEMENT

    • IMPORTING

    • RESULT = ITCPP

    • EXCEPTIONS

    • CANCELLED = 1

    • DEVICE = 2

    • FORM = 3

    • OPTIONS = 4

    • UNCLOSED = 5

    • OTHERS = 6.

    • ELSE .

    • MOVE : ITCPP-TDDEST TO ITCPO-TDDEST ,

    • ITCPP-TDIMMED TO ITCPO-TDIMMED ,

    • ITCPP-TDDELETE TO ITCPO-TDDELETE ,

    • ITCPP-TDNEWID TO ITCPO-TDNEWID ,

    • ITCPP-TDPREVIEW TO ITCPO-TDPREVIEW ,

    • ITCPP-TDCOPIES TO ITCPO-TDCOPIES .

    *

    • CALL FUNCTION 'OPEN_FORM'

    • EXPORTING

    • FORM = B_FORMNAME

    • OPTIONS = ITCPO

    • DEVICE = B_ELEMENT

    • DIALOG = ' '

    • IMPORTING

    • RESULT = ITCPP

    • EXCEPTIONS

    • CANCELLED = 1

    • DEVICE = 2

    • FORM = 3

    • OPTIONS = 4

    • UNCLOSED = 5

    • OTHERS = 6.

    • ENDIF .

    *

    *ENDFORM.

    **&----


    *----


    **& Form TAX_INFO_DETERMINE ADDED BY ANIL

    **&----


    *----


    • text

    **----


    *----


    • --> p1 text

    • <-- p2 text

    **----


    *----


    *FORM TAX_INFO_DETERMINE USING B_SLRNO .

    • SELECT SINGLE * FROM VBRK WHERE VBELN = I_TAB-INVO.

    • SELECT SINGLE * FROM VBRP WHERE VBELN = VBRK-VBELN AND

    • POSNR = LINE_TAB-POSNR .

    **refresh tkomv . clear : tkomv , komk.

    • MOVE-CORRESPONDING VBRK TO KOMK.

    • MOVE-CORRESPONDING VBRP TO KOMP.

    • CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

    • EXPORTING

    • COMM_HEAD_I = KOMK

    • COMM_ITEM_I = KOMP

    • TABLES

    • TKOMV = TKOMV

    • TKOMVD = TKOMVD

    • EXCEPTIONS

    • OTHERS = 1.

    • SORT TKOMV BY KSCHL.

  • CLEAR KONV .

  • SELECT * FROM KONV WHERE KNUMV = VBRK-KNUMV AND KPOSN = VBRP-POSNR AND

  • KAPPL = 'TX' AND ( KSCHL EQ 'ZIN2' OR

  • KSCHL = 'ZIN1' ).

    • loop at tkomv where kposn eq vbrp-posnr and ( kschl eq 'ZIN2' or

    • kschl = 'ZIN1' ).

    • if tkomv-kbetr = 0 .

  • IF KONV-KBETR = 0 .

  • IF NOT VBRP-MVGR1 IS INITIAL .

  • FORM_TAB-MVGR1 = VBRP-MVGR1 .

  • FORM_TAB-SLNO = B_SLRNO .

  • APPEND FORM_TAB . CLEAR FORM_TAB .

  • ELSE .

    • if tkomv-mwsk1+1(1) = '2' .

  • IF KONV-MWSK1+1(1) = '2' .

  • CONCATENATE B_SECOND_SALE ',' B_SLRNO INTO B_SECOND_SALE

  • SEPARATED BY SPACE.

  • ELSE .

  • IF VBRP-KONDM = '07' .

  • CONCATENATE B_EXEMPTED ',' B_SLRNO INTO B_EXEMPTED

  • SEPARATED BY SPACE.

  • ELSE .

  • CONCATENATE B_HEXEMPTED ',' B_SLRNO INTO B_HEXEMPTED

  • SEPARATED BY SPACE.

  • ENDIF .

  • ENDIF .

  • ENDIF .

  • ENDIF .

    • endloop.

  • ENDSELECT .

  • *ENDFORM. " TAX_INFO_DETERMINE

    **&----


    *----


    **& Form PRINT_TAX_INFO

    **&----


    *----


    • text

    **----


    *----


    • --> p1 text

    • <-- p2 text

    **----


    *----


    *FORM PRINT_TAX_INFO USING B_TAX_STR B_TAX_STR1.

    • CLEAR : B_TAX_INFO1 .

    • REPLACE ',' WITH ':' INTO B_TAX_STR .

    • CONCATENATE 'Item ' B_TAX_STR B_TAX_STR1

    • INTO B_TAX_STR SEPARATED BY SPACE .

    • PERFORM LAYOUTSETMAIN USING '111'.

    *

    • DO .

    • B_TAX_INFO1 = B_TAX_STR+0(80) .

    • PERFORM LAYOUTSETMAIN USING '110'.

    • B_TAX_STR = B_TAX_STR+80() .

    • B_TAX_LEN = STRLEN( B_TAX_STR ) .

    • IF B_TAX_LEN = 0.

    • EXIT .

    • ENDIF .

    • ENDDO .

    *ENDFORM. " PRINT_TAX_INFO