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

Problem in SAP Script

Hi experts,

I have one problem in SAP Script.

I am displaying one purchase order output in sap script.Here i am displaying 5 windows in top of the main window.

That is 1.HEADER 2.TITLE 3.REGS WINDOW in top of the page.(These 3 windows should display in all the pages)

Between these 3 windows and mainwindow i am displaying another 2 windows. that is

1 Address 2.Info window.(These 2 windows should be in first page only, no need in all pages.

Here only i am getting the following problem.

If the number of line items are below 5 in main window it is displaying correctly in a single page. (that is all 5 windows in first page)

If it has 10 line items it is not displaying correctly.

Here in first page Header and Regs window only displayed.(This is the problem.since here i need all the 5 windows)

Header, Title and Regs are displaying in second page(this is correct).

The followin windowsare in my first page.

Heder,Title,Regs,Address, info and main window.

The followin windowsare in my second page.

Heder,Title,Regs and main window.

I hope you understand my problem..

Thanks in advance,

Navaneeth.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2007 at 12:39 PM

    Hi

    Why the Main window size is effecting the Top windows?

    Have you kept any condition for the printing of the windows? check/

    Put a condition for the windows that are to be displayed in first page

    IF &PAGE& EQ 1

    ......script code....

    ENDIF.

    check the page windows are properly assigned to the correct pages or not.

    <b>Reward points for useful Answers</b>

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      <b>SAP SCRIPT AFTER DOWNLODING FROM RSTXSCRP</b>

      <b>PLEASE SEE THE PRINT PROGRAM ALSO BELOW THE SCRIPT</b>

      SFORMZSS_MM_J_1I_57F4

      HFORMZSS_MM_J_1I_57F4

      OLANE

      DFORZSS_MM_J_1I_57F4

      HEADFORM ZSS_MM_J_1I_57F4SAP DEF EExcise Invoice ZSS_MM_J_1I_57F4 00072SAP 30F 19970814115822ABAPPD 620 2007073119272613200059 E1 555

      LINE/:FORM CPI 18; LPI 6; TAB-STOP 0 CH; FONT TIMES; FONT-SIZE 10;

      LINE/:FORM START-PAGE FIRST; PARAGRAPH AS; RDI; RDIDEV;

      LINE/:PARAGRAPH AS LINE-SPACE 1 LN;

      LINE/:PARAGRAPH CS ALIGN CENTER; LINE-SPACE 1 LN;

      LINE/:PARAGRAPH HT LINE-SPACE 1 LN; SPACE-AFTER 1 LN;

      LINE/:PARAGRAPH I1 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH I2 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH I3 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH I4 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH P1 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH P2 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH P3 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH R1 LINE-SPACE 1 LN;

      LINE/:PARAGRAPH RE LINE-SPACE 0.65 LN; FONT TIMES; FONT-SIZE 10;

      LINE/:PARAGRAPH S2 LINE-SPACE 1 LN; LEFT-INDENT 2 CH;

      LINE/:PARAGRAPH SM LINE-SPACE 1 LN; FONT-SIZE 8;

      LINE/:PARAGRAPH SR LINE-SPACE 1 LN;

      LINE/:PARAGRAPH TI LINE-SPACE 1 LN; FONT-SIZE 10; BOLD ON; ITALIC OFF; ULINE OFF;

      LINE/:PARAGRAPH I1 TAB 1 6 CH LEFT; TAB 2 15 CH LEFT; TAB 3 40 CH LEFT;

      LINE/:PARAGRAPH I1 TAB 4 55 CH LEFT; TAB 5 70 CH LEFT; TAB 6 105 CH LEFT;

      LINE/:PARAGRAPH I1 TAB 7 120 CH LEFT;

      LINE/:PARAGRAPH I2 TAB 1 15 CH LEFT; TAB 2 55 CH LEFT; TAB 3 70 CH LEFT;

      LINE/:PARAGRAPH I3 TAB 1 6 CH LEFT; TAB 2 60 CH LEFT; TAB 3 80 CH LEFT;

      LINE/:PARAGRAPH I3 TAB 4 100 CH LEFT;

      LINE/:PARAGRAPH I4 TAB 1 7 CH LEFT; TAB 2 40 CH LEFT;

      LINE/:PARAGRAPH P1 TAB 1 55 CH LEFT; TAB 2 105 CH LEFT;

      LINE/:PARAGRAPH P2 TAB 1 8 CH LEFT; TAB 2 40 CH LEFT; TAB 3 65 CH LEFT;

      LINE/:PARAGRAPH P2 TAB 4 80 CH LEFT; TAB 5 104 CH LEFT;

      LINE/:PARAGRAPH P3 TAB 1 40 CH LEFT; TAB 2 60 CH LEFT; TAB 3 85 CH LEFT;

      LINE/:PARAGRAPH R1 TAB 1 20 CH LEFT;

      LINE/:PARAGRAPH SM TAB 1 12 CH LEFT;

      LINE/:PARAGRAPH SR TAB 1 7 CH LEFT; TAB 2 28 CH LEFT;

      LINE/:STRING B BOLD ON; MARK OFF;

      LINE/:STRING I ITALIC ON;

      LINE/:STRING K FONT HELVE; FONT-SIZE 10;

      LINE/:STRING PR SUBSCRIPT OFF; SUPERSCRIPT OFF; HIDDEN OFF; PROTECT ON; MARK OFF;

      LINE/:STRING S FONT HELVE; FONT-SIZE 8;

      LINE/:STRING U ULINE ON;

      LINE/:WINDOW ADDRESS TYPE CONST;

      LINE/:WINDOW FOOTER TYPE VAR;

      LINE/:WINDOW HEADER TYPE CONST;

      LINE/:WINDOW INFO TYPE CONST;

      LINE/:WINDOW MAIN

      LINE/:WINDOW REGS TYPE CONST;

      LINE/:WINDOW TITLE TYPE CONST;

      LINE/:PAGE FIRST NEXT NEXT; PAGE-COUNT START;

      LINE/:PAGE NEXT NEXT NEXT;

      LINE/:PAGE FIRST MAIN 0 5 CH 27 LN 135 CH 20 LN;

      LINE/:PAGE FIRST WINDOW TITLE 45 CH 4 LN 52 CH 11 LN;

      LINE/:PAGE FIRST WINDOW REGS 95 CH 4 LN 45 CH 11 LN;

      LINE/:PAGE FIRST WINDOW INFO 95 CH 16 LN 45 CH 11 LN;

      LINE/:PAGE FIRST WINDOW HEADER 5 CH 4 LN 50 CH 11 LN;

      LINE/:PAGE FIRST WINDOW FOOTER 5 CH 48 LN 135 CH 20 LN;

      LINE/:PAGE FIRST WINDOW ADDRESS 5 CH 16 LN 93 CH 11 LN;

      LINE/:PAGE NEXT MAIN 0 5 CH 27 LN 135 CH 20 LN;

      LINE/:PAGE NEXT WINDOW HEADER 5 CH 4 LN 50 CH 11 LN;

      LINE/:PAGE NEXT WINDOW TITLE 45 CH 4 LN 52 CH 11 LN;

      LINE/:PAGE NEXT WINDOW REGS 95 CH 4 LN 45 CH 11 LN;

      LINE/:PAGE NEXT WINDOW FOOTER 5 CH 48 LN 135 CH 20 LN;

      END

      HEADFORM ZSS_MM_J_1I_57F4SAP TXT EExcise Invoice ZSS_MM_J_1I_57F4 00072SAP 30F 19970814115822ABAPPD 620 2007073119272613200172 E1 555

      LINE/:FORM TEXT 'Excise Invoice';

      LINE/:PARAGRAPH AS TEXT 'Default paragraph';

      LINE/:PARAGRAPH CS TEXT 'Center aligned';

      LINE/:PARAGRAPH HT TEXT 'Header text';

      LINE/:PARAGRAPH I1 TEXT 'Line item, line 1';

      LINE/:PARAGRAPH I2 TEXT 'Line item, line 2';

      LINE/:PARAGRAPH I3 TEXT 'Line item, line 3';

      LINE/:PARAGRAPH I4 TEXT 'Line item, line 4';

      LINE/:PARAGRAPH P1 TEXT 'Signature';

      LINE/:PARAGRAPH P2 TEXT 'part11';

      LINE/:PARAGRAPH P3 TEXT 'parti';

      LINE/:PARAGRAPH R1 TEXT 'Info tabs';

      LINE/:PARAGRAPH RE TEXT 'res page window paragraph';

      LINE/:PARAGRAPH S2 TEXT 'Like def. para, shifted by 2';

      LINE/:PARAGRAPH SM TEXT 'Small font';

      LINE/:PARAGRAPH SR TEXT 'Serial numbers';

      LINE/:PARAGRAPH TI TEXT 'Description of form';

      LINE/:STRING B TEXT ' .';

      LINE/:STRING I TEXT '';

      LINE/:STRING K TEXT '';

      LINE/:STRING PR TEXT 'Character string protected';

      LINE/:STRING S TEXT '';

      LINE/:STRING U TEXT 'Character string underlined';

      LINE/:WINDOW ADDRESS TEXT 'Adressee';

      LINE/:WINDOW FOOTER TEXT 'Footer';

      LINE/:WINDOW HEADER TEXT 'Header';

      LINE/:WINDOW INFO TEXT 'Information (general data)';

      LINE/:WINDOW MAIN TEXT 'Main window';

      LINE/:WINDOW REGS TEXT 'Plant excise info';

      LINE/:WINDOW TITLE TEXT 'Title of the document';

      LINE/:PAGE FIRST TEXT 'First page';

      LINE/:PAGE NEXT TEXT 'Next page';

      LINE/WREGS

      LINE/*Excise regesteration information of the plant

      LINE/*getting data from J_1movend and t001z table

      LINE/:PERFORM ZF_MM_DC IN PROGRAM ZSB_MM_PO_DC

      LINE/:USING &J_1IEXCHDR-BUKRS&

      LINE/:USING &J_1IEXCHDR-WERKS&

      LINE/:CHANGING &W_RANGE&

      LINE/:CHANGING &DIVISION&

      LINE/:CHANGING &ECCNO&

      LINE/:CHANGING &TNGSTNO&

      LINE/:CHANGING &CSTNO&

      LINE/:CHANGING &TIN&

      LINE/*CHANGING &AREACODE&

      LINE/:ENDPERFORM

      LINEASRANGE: &W_RANGE&

      LINE/ DIVISION: &DIVISION&

      LINE/ ECC NO: &ECCNO&

      LINE/ TNGST NO.: &TNGSTNO&

      LINE/ CST NO.: &CSTNO&

      LINE/*AREA CODE NO. : &AREA_CODE_NO&

      LINE/ TIN: &TIN&

      LINE/*RANGE :&J_1IREGSET-J_1IEXCRG&

      LINE/*Division :&J_1IREGSET-J_1IEXCDI&

      LINE/*ECC NO :&J_1IMOCOMP-J_1IEXCD&

      LINE/*Code No.,,&J_1IREGSET-J_1IEXCCD&

      LINE/*Reg. No.,,&J_1IREGSET-J_1IEXCRN&

      LINE/*Range,,&J_1IREGSET-J_1IEXCRG&

      LINE/*Division,,&J_1IREGSET-J_1IEXCDI&

      LINE/*Collectorate,,&J_1IREGSET-J_1IEXCCO&

      LINE/WTITLE

      LINE/EDOC_TITLE_T

      LINETICHALLAN

      LINE/EDOC_TITLE_EXC_INFO

      LINEASFor movement of inputs or partially Processed

      LINE/ goods from one factory to another factory /

      LINE/ Job worker for further processing / operation

      LINE/ and subsequent return to the parent factory.

      LINE/WMAIN

      LINE/EDASH_LINE

      LINE/ &ULINE(108)&

      LINE/EITEM_HEADER

      LINEI1,,SrNo,,Material Code,,Quantity,,Unit,,Identification marks,,Est.Value,,

      LINE= Reversal rate

      LINEI2,,Description of goods,,Chapter Id,,Nature of Processing

      LINE/EITEM_VALUES

      LINEI1,,&J_1IEXCDTL-ZEILE&,,&J_1IEXCDTL-MATNR&,,&J_1IEXCDTL-MENGE&,,

      LINE &J_1IEXCDTL-MEINS&,,,,&J_1IEXCDTL-EXBAS(16.2R)&,,

      LINE &J_1IINDCUS-J_1ISUBRAT(5.2R)&

      LINEI2,,&J_1IEXCDTL-MAKTX(25)&,,&J_1IEXCDTL-CHAPID(22)&

      LINE* &uline(108)&

      LINE/ERETURN_DATE

      LINEI3Expected Duration of Processing / Manufacturing,,,,&J_1IEXCHDR-RTDAT&,,

      LINE/ESERIAL_NO_HDR

      LINEI3Serial Number of Debit entry in PLA / RG23A and Date,,

      LINE &J_1IEXCDTL-RGPLASER&/,,&J_1IEXCDTL-RG23ASER&/,,&J_1IEXCHDR-EXDAT&

      LINE/EREVERSAL_AMOUNT

      LINEI3Total Amount of Reversal,,,,&J_1IEXCHDR-EXBED(I)&

      LINE/*write include text object statement as the sample given below and give

      LINE/*the id of the text element which should be printed

      LINE/*Text printed before the items are printed

      LINE/ENUM_LINE

      LINE/*Place:

      LINE/*Stores,,Authorised Signature,,Received the goods in good condition

      LINE/*Date:

      LINEAS123456789#123456789#123456789#123456789#123456789#123456789#123456789#12

      LINE= 3456789#123456789#123456789#123456789#123456789#12

      LINE/WHEADER

      LINE/*Plant address

      LINE* &T001W-NAME1&

      LINE* &T001W-STRAS&

      LINE* &T001W-ORT01&

      LINE* &T001W-PSTLZ&

      LINE/WFOOTER

      LINE* Place :

      LINEP3,,Stores,,Authorised Signature,,Received the goods in good condition

      LINE* Date :

      LINE/*&PAGE-BREAK&

      LINE* Part II( TO BE FILED BY THE PROCESSING FACTORY IN ORIGINAL AND DUPLICATE

      LINE= CHALLANS)

      LINEP2S.NO,,SS.NO,,Description,,Desp.Qty.,,Waste Qty.Returned,,Date & Time of

      LINE= Departure

      LINE*

      LINE*

      LINE*

      LINE*

      LINE*

      LINE*

      LINE*

      LINE*

      LINE*

      LINE*

      LINE/*1. Date and time of despatch of finished goods to parent

      LINE/*factory/another manufacturer and entry no. and date of

      LINE/*receipt in the account in the processing factory

      LINE/*2. Quantity despatched (Nos / Weight / Litre / Metre) and

      LINE/*entered in account

      LINE/*3. Nature of processing / manufacturing done,, &j_1iregset-j_1irgdesc&

      LINE/*4. Quantity of waste material returned to the parent factory

      LINE/* or cleared for home consumption invoice no. and date

      LINE/* Quantum of duty paid (Both figure and words).

      LINEP1Place:,, Signature of processor,,name of the factory / address

      LINE* Date:

      LINE/

      LINE*

      LINECSPART III

      LINESMTo be filled by the parent factory in duplicate of challan on receipt

      LINE= of goods from the factory.

      LINE/ Certified that I/We have received the goods removed under the above

      LINE= challan , on

      LINE/ And have been taken credit of the amount vide RG23A/PLA entry no

      LINE= dated Signature of Manufacturer / authorised signatory

      LINE/WADDRESS

      LINE/*Manufacturer and Subcontractor address

      LINE/*

      LINE/:IF &PAGE& EQ 1

      LINE/EADDRESSEE

      LINE/*&T001W-NAME1& &T001W-NAME2&

      LINE/*,,&T001W-STRAS& &T001W-ORT01&

      LINE/*,,&T001W-PFACH& &T001W-PSTLZ&

      LINE/*,,&T001W-LAND1& &T001W-REGIO&

      LINEI4PROCESSOR'S NAME & ADDRESS

      LINEI4,,&LFA1-NAME1& &LFA1-NAME2&

      LINEI4,,&LFA1-STRAS& &LFA1-ORT01&

      LINEI4,,&LFA1-ORT01& &LFA1-PFACH& &LFA1-PSTLZ&

      LINE/*,,&LFA1-LAND1& &LFA1-REGIO&

      LINEI4Date and time of Issue,,,,&J_1IEXCHDR-EXDAT& &J_1IEXCHDR-CPUTM&

      LINE/:ENDIF

      LINE/WINFO

      LINE/*Excise invoice related header information

      LINE/*

      LINE/:IF &PAGE& EQ 1

      LINE/EHEADER_DATA

      LINER1Challan no,,&J_1IEXCHDR-EXNUM&

      LINER1Challan Date,,&J_1IEXCHDR-EXDAT&

      LINER1Trans Post no,,&J_1IEXCHDR-RDOC&

      LINER1Trans Posting yr,,&J_1IEXCHDR-RYEAR&

      LINER1Internal doc no,,&J_1IEXCHDR-DOCNO&

      LINER1Internal doc year,,&J_1IEXCHDR-DOCYR&

      LINER1Currency,,&J_1IEXCDTL-EXCUR&

      LINE/:ENDIF

      END

      ACTVSAP

      E

      <i><b>Print program</b></i>

      REPORT J_1I57FPN MESSAGE-ID 8I.

      TABLES: T001W,

      J_1IWRKCUS,

      J_1IREGSET,

      J_1IINDCUS,

      J_1IEXCDTL,

      J_1IEXCHDR,

      LFA1.

      Data: wa_exchdr like j_1iexchdr.

      Data: wa1_exchdr like j_1iexchdr.

      DATA : ITAB_EXCDTL LIKE TABLE OF J_1IEXCDTL WITH HEADER LINE.

      DATA : BEGIN OF OPTIONS.

      INCLUDE STRUCTURE ITCPO.

      DATA : END OF OPTIONS.

      DATA : BEGIN OF RESULT.

      INCLUDE STRUCTURE ITCPP.

      DATA : END OF RESULT.

      DATA : BEGIN OF THEAD OCCURS 10.

      INCLUDE STRUCTURE THEAD.

      DATA : END OF THEAD.

      DATA : BEGIN OF TLINES OCCURS 10.

      INCLUDE STRUCTURE TLINE.

      DATA : END OF TLINES.

      DATA : TEXT_ID(4) TYPE C.

      DATA : DOC_NUM LIKE J_1IEXCHDR-EXNUM, " pai 17/09/98

      M_LENGTH TYPE I. " pai

      • Begin 11.05.99

      DATA : DOC_NO LIKE J_1IEXCHDR-EXNUM,

      DOC_DT LIKE J_1IEXCHDR-EXDAT,

      SERIES LIKE J_1IEXCHDR-SRGRP,

      PREPRN LIKE J_1IEXCHDR-PREPRN,

      M_SELECTED,

      M_DATE(10) TYPE C,

      TABIX LIKE SY-TABIX.

      DATA : LAYOUT LIKE TNAPR-FONAM,

      text_name like thead-tdname.

      *

      form entry_57f4

      using output_type

      wa_exchdr like j_1iexchdr.

      perform select_print_data using output_type

      WA_EXCHDR-WERKS

      CHANGING OPTIONS

      LAYOUT.

      perform select_data

      TABLES ITAB_EXCDTL

      using wa_exchdr

      CHANGING WA1_EXCHDR.

      perform open_form USING OPTIONS

      LAYOUT

      CHANGING RESULT.

      perform print_layout.

      perform close_form.

      endform.

      **

      *DOC_NUM = DOC_NO. " pai

      *

      *M_LENGTH = STRLEN( DOC_NUM ).

      *WHILE M_LENGTH < 10.

      • CONCATENATE '0' DOC_NUM INTO DOC_NUM.

      • M_LENGTH = M_LENGTH + 1.

      *ENDWHILE.

      *DOC_NO = DOC_NUM. " pai

      **

      • Begin 11.05.99

      *TOP-OF-PAGE.

      • WRITE :/3 TEXT-001,

      • TEXT-002,

      • TEXT-003,

      • TEXT-004.

      **

      *START-OF-SELECTION.

      • IF P_PRINT = 'X'.

      • SELECT * INTO CORRESPONDING FIELDS OF TABLE LISTTAB FROM J_1IEXCHDR

      • WHERE TRNTYP = '57FC' AND STATUS = 'P' AND

      • EXNUM IN SE_EXNUM AND EXDAT IN SE_EXDAT AND PREPRN = ''.

      • ELSEIF P_REPRN = 'X'.

      • SELECT * INTO CORRESPONDING FIELDS OF TABLE LISTTAB FROM J_1IEXCHDR

      • WHERE TRNTYP = '57FC' AND STATUS = 'P' AND

      • EXNUM IN SE_EXNUM AND EXDAT IN SE_EXDAT.

      • ENDIF.

      • IF SY-SUBRC <> 0.

      • MESSAGE E000(8I) WITH

      • 'No data available or Document already printed'.

      • ENDIF.

      **

      *END-OF-SELECTION.

      • SET PF-STATUS '100'.

      • SORT LISTTAB BY EXNUM EXDAT.

      • LOOP AT LISTTAB.

      • WRITE :/ LISTTAB-PROCDOC AS CHECKBOX.

      • WRITE : LISTTAB-EXNUM UNDER TEXT-001,

      • LISTTAB-EXDAT UNDER TEXT-002.

      • WRITE AT 30 LISTTAB-SRGRP.

      • WRITE AT 45 LISTTAB-PREPRN.

      • LISTTAB-LIST_LINE = SY-LINNO.

      • MODIFY LISTTAB.

      • ENDLOOP.

      **

      *AT USER-COMMAND.

      • CASE SY-UCOMM.

      • WHEN 'EPRN'.

      • DO.

      • TABIX = SY-INDEX.

      • READ LINE SY-INDEX FIELD VALUE LISTTAB-PROCDOC.

      • IF SY-SUBRC <> 0.

      • EXIT.

      • ENDIF.

      • IF LISTTAB-PROCDOC = 'X'.

      • READ TABLE LISTTAB WITH KEY LIST_LINE = TABIX.

      • DOC_NO = LISTTAB-EXNUM.

      • DOC_DT = LISTTAB-EXDAT.

      • SERIES = LISTTAB-SRGRP.

      • M_SELECTED = 'y'.

      • EXIT.

      • ENDIF.

      • ENDDO.

      • ENDCASE.

      • Call fn. module to capture pre-printed excise no.

    • IF M_SELECTED = 'y'.

    • CALL FUNCTION 'J_1I_ACCEPT_VALUE'

    • EXPORTING

    • I_PREPRN = PREPRN

    • IMPORTING

    • O_PREPRN = PREPRN.

    • ELSE.

    • MESSAGE E000(8I) WITH 'Select a Document'.

    • ENDIF.

      • Check whether entered pre-printed excise no. already exists

    • SELECT SINGLE * FROM J_1IEXCHDR WHERE PREPRN = PREPRN AND

    • STATUS <> 'D' AND

    • NOT ( EXNUM = DOC_NO

    • AND EXDAT = DOC_DT

    • AND SRGRP = SERIES ).

    • IF SY-SUBRC = 0.

    • SET CURSOR FIELD 'PREPRN'.

    • MESSAGE E000(8I) WITH 'Pre-printed excise no.' PREPRN 'already used'

    • .

      • ENDIF.

      • End 11.05.99

      **

      • SELECT SINGLE * FROM J_1IEXCHDR

      • WHERE EXNUM = DOC_NO

      • AND EXDAT = DOC_DT

      • AND SRGRP = SERIES.

      • IF SY-SUBRC <> 0.

      • MESSAGE E000(8I) WITH 'Invalid Challan number entered'.

    • "10.05.99

      • ELSEIF J_1IEXCHDR-PREPRN <> PREPRN AND J_1IEXCHDR-PREPRN <> ''.

      • MESSAGE E000(8I) WITH

      • '57F4' DOC_NO 'already printed with pre-printed excise no.'

      • J_1IEXCHDR-PREPRN.

      • ENDIF.

      • IF J_1IEXCHDR-STATUS NE 'P'.

      • MESSAGE E000(8I) WITH 'Challan status is not posted..cannot print'

      .

      • ENDIF.

      • Begin 10.05.99

      • j_1iexchdr-exbed = j_1iexchdr-exbed + j_1iexchdr-exsed +

      • j_1iexchdr-exaed.

      • Begin 10.05.99

      • Print totals of BED, SED, AED

    • J_1IEXCHDR-EXBED = LISTTAB-EXBED + LISTTAB-EXSED + LISTTAB-EXAED.

    • LISTTAB-PROCDOC = ''.

    • LISTTAB-PREPRN = PREPRN.

    • MODIFY LINE LISTTAB-LIST_LINE FIELD VALUE LISTTAB-PROCDOC

    • LISTTAB-PREPRN LINE FORMAT COLOR 6 INPUT OFF.

      • End 10.05.99

      • Printing options

    • OPTIONS-TDCOPIES = 1 .

    • OPTIONS-TDNEWID = 'X' .

    • OPTIONS-TDDATASET = 'LIST1' .

    • OPTIONS-TDDELETE = 'X' .

    • OPTIONS-TDPROGRAM = SY-REPID.

    • OPTIONS-TDPREVIEW = 'X' .

    • PERFORM OPEN_FORM.

    • PERFORM GET_HEADER_DATA.

      • Print Line items

    • PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

    • PERFORM WRITE_FORM USING 'MAIN' 'ITEM_HEADER' 'SET'.

    • PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

    • SELECT * FROM J_1IEXCDTL WHERE EXNUM = DOC_NO AND

    • EXDAT = DOC_DT.

    • PERFORM WRITE_FORM USING 'MAIN' 'ITEM_VALUES' 'SET'.

    • ENDSELECT.

    • PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

    • **

      • PERFORM WRITE_FORM USING 'REGS' ' ' ' '.

      • PERFORM WRITE_FORM USING 'HEADER' ' ' ' '.

      • PERFORM WRITE_FORM USING 'TITLE' 'DOC_TITLE_T' 'SET'.

      • PERFORM WRITE_FORM USING 'TITLE' 'DOC_TITLE_EXC_INFO' 'APPEND'.

      **

      • PERFORM WRITE_FORM USING 'ADDRESS' 'ADDRESSEE' 'SET'.

      • PERFORM WRITE_FORM USING 'INFO' 'HEADER_DATA' 'SET'.

      **

      • PERFORM WRITE_FORM USING 'MAIN' 'RETURN_DATE' 'SET'.

      • PERFORM WRITE_FORM USING 'MAIN' 'SERIAL_NO_HDR' 'SET'.

      • PERFORM WRITE_FORM USING 'MAIN' 'REVERSAL_AMOUNT' 'SET'.

      • PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

      **

      • TEXT_ID = 'PROC'.

      **concatenate j_1iexchdr-rdoc j_1iexchdr-ryear into thead-tdname.

      • THEAD-TDNAME = '57FC'.

      • PERFORM READ_TEXT.

      • LOOP AT TLINES.

      • IF TLINES-TDLINE NE SPACE.

      • J_1IREGSET-J_1IRGDESC = TLINES-TDLINE.

      • ENDIF.

      • ENDLOOP.

      • PERFORM WRITE_FORM USING 'FOOTER' ' ' 'SET'.

      *

      • PERFORM ENDFORM.

      • Update table with entered preprn excise no. "10.05.99

    • UPDATE J_1IEXCHDR SET PREPRN = PREPRN

    • WHERE EXNUM = DOC_NO

    • AND EXDAT = DOC_DT

    • AND SRGRP = SERIES.

    • *

      **&----


      *

      **& Form OPEN_FORM

      **&----


      *

      • text

      *

      **----


      *

      • --> p1 text

      • <-- p2 text

      **----


      *

      *FORM OPEN_FORM.

      *

      • CALL FUNCTION 'OPEN_FORM'

      • EXPORTING

      • APPLICATION = 'TX'

      • ARCHIVE_INDEX = ' '

      • ARCHIVE_PARAMS = ' '

    • DEVICE = 'PRINTER'

    • DIALOG = 'X'

    • FORM = 'J_1I_57F4'

      • LANGUAGE = SY-LANGU

      • OPTIONS = options

      • RAW_DATA_INTERFACE = ' '

    • IMPORTING

      • LANGUAGE =

      • NEW_ARCHIVE_PARAMS =

    • RESULT = RESULT

    • EXCEPTIONS

    • CANCELED = 1

    • DEVICE = 2

    • FORM = 3

    • OPTIONS = 4

    • UNCLOSED = 5

    • OTHERS = 6.

    • *

      • IF SY-SUBRC NE 0.

      • MESSAGE E888 WITH 'Error in opening layout set'.

      • ENDIF.

      *ENDFORM. " OPEN_FORM

      *&----


      *& Form WRITE_FORM

      *&----


      • text

      *----


      • --> p1 text

      • <-- p2 text

      *----


      FORM WRITE_FORM USING WINDOW ELEMENT FNCTION.

      CALL FUNCTION 'WRITE_FORM'

      EXPORTING

      ELEMENT = ELEMENT

      FUNCTION = FNCTION

      WINDOW = WINDOW

      • IMPORTING

      • PENDING_LINES =

      EXCEPTIONS

      ELEMENT = 1

      FUNCTION = 2

      TYPE = 3

      UNOPENED = 4

      UNSTARTED = 5

      WINDOW = 6

      OTHERS = 7.

      ENDFORM. " WRITE_FORM

      **&----


      *

      **& Form ENDFORM

      **&----


      *

      • text

      *

      **----


      *

      • --> p1 text

      • <-- p2 text

      **----


      *

      *FORM ENDFORM.

      • CALL FUNCTION 'CLOSE_FORM'

      • IMPORTING

      • RESULT = RESULT

      • TABLES

      • OTFDATA =

    • EXCEPTIONS

    • UNOPENED = 1

    • OTHERS = 2.

    • *

      *

      *ENDFORM. " ENDFORM

      **&----


      *

      **& Form GET_HEADER_DATA

      **&----


      *

      • text

      *

      **----


      *

      • --> p1 text

      • <-- p2 text

      **----


      *

      *FORM GET_HEADER_DATA.

      • CLEAR: T001W,J_1IWRKCUS,J_1IREGSET,J_1IINDCUS.

      • SELECT SINGLE * FROM T001W

      • WHERE WERKS = J_1IEXCHDR-WERKS.

      • SELECT SINGLE * FROM J_1IWRKCUS

      • WHERE J_1IWERKS = J_1IEXCHDR-WERKS.

      • IF SY-SUBRC <> 0.

      • MESSAGE E000(8I) WITH 'plant customisation not found'.

      • ENDIF.

      • SELECT SINGLE * FROM J_1IREGSET

      • WHERE J_1IREGID = J_1IWRKCUS-J_1IREGID.

      • IF SY-SUBRC <> 0.

      • MESSAGE E000(8I) WITH 'register id customisation not found'.

      • ENDIF.

      • SELECT SINGLE * FROM J_1IINDCUS WHERE

      • J_1IBUKRS = J_1IEXCHDR-BUKRS.

      • IF SY-SUBRC <> 0.

      • MESSAGE E000(8I) WITH 'Customisation missing .. indcus'.

      • ENDIF.

      • SELECT SINGLE * FROM LFA1 WHERE

      • LIFNR = J_1IEXCHDR-LIFNR.

      • IF SY-SUBRC <> 0.

      • MESSAGE E000(8I) WITH 'Vendor record missing ....'.

      • ENDIF.

      *ENDFORM. " GET_HEADER_DATA

      **&----


      *

      **& Form READ_TEXT

      **&----


      *

      • text

      *

      **----


      *

      • --> p1 text

      • <-- p2 text

      **----


      *

      FORM READ_TEXT.

      CALL FUNCTION 'READ_TEXT'

      EXPORTING

      CLIENT = SY-MANDT

      ID = TEXT_ID

      LANGUAGE = SY-LANGU

      NAME = THEAD-TDNAME

      OBJECT = 'J1IF'

      ARCHIVE_HANDLE = 0

      IMPORTING

      HEADER = THEAD

      TABLES

      LINES = TLINES

      EXCEPTIONS

      ID = 1

      LANGUAGE = 2

      NAME = 3

      NOT_FOUND = 4

      OBJECT = 5

      REFERENCE_CHECK = 6

      WRONG_ACCESS_TO_ARCHIVE = 7

      OTHERS = 8.

      ENDFORM. " READ_TEXT

      *

      &----


      *& Form SELECT_PRINT_DATA

      &----


      • text

      ----


      • -->P_OUTPUT_TYPE text

      ----


      FORM SELECT_PRINT_DATA USING P_OUTPUT_TYPE

      P_WERKS

      CHANGING P_OPTIONS like itcpo

      p_layout.

      DATA WA_TNAD7 LIKE TNAD7.

      DATA WA_TNAPR LIKE TNAPR.

      SELECT single * FROM TNAD7 INTO WA_TNAD7

      WHERE KSCHL = P_OUTPUT_TYPE

      AND WERKS = P_WERKS.

      CHECK SY-SUBRC EQ 0.

      p_options-tddest = wa_tnad7-ldest.

      p_options-tddataset = wa_tnad7-dsnam.

      p_options-tdsuffix1 = wa_tnad7-dsuf1.

      p_options-tdsuffix2 = wa_tnad7-dsuf2.

      p_options-tdimmed = wa_tnad7-dimme.

      p_options-tddelete = wa_tnad7-delet.

      p_options-tdcover = wa_tnad7-tdocover.

      p_options-tdcovtitle = wa_tnad7-tdcovtitle.

      p_options-tdreceiver = wa_tnad7-tdreceiver.

      p_options-tddivision = wa_tnad7-tddivision.

      p_options-tdautority = wa_tnad7-tdautority.

      P_OPTIONS-TDCOPIES = 1 .

      P_OPTIONS-TDNEWID = 'X' .

      P_OPTIONS-TDPROGRAM = SY-REPID.

      select single * from tnapr into wa_tnapr

      where kschl = p_output_type.

      check sy-subrc eq 0.

      P_LAYOUT = WA_TNAPR-FONAM.

      ENDFORM. " SELECT_PRINT_DATA

      &----


      *& Form SELECT_DATA

      &----


      • text

      ----


      • -->P_WA_EXCHDR text

      ----


      FORM SELECT_DATA

      TABLES P_ITAB_EXCDTL

      USING P_WA_EXCHDR like j_1iexchdr

      CHANGING P_WA1_EXCHDR like j_1iexchdr.

      SELECT single * FROM J_1IEXCHDR into p_wa1_exchdr

      where trntyp = p_wa_exchdr-trntyp

      and docno = p_wa_exchdr-docno

      and docyr = p_wa_exchdr-docyr.

      select * from j_1iexcdtl into table p_itab_excdtl

      where trntyp = p_wa_exchdr-trntyp

      and docno = p_wa_exchdr-docno

      and docyr = p_wa_exchdr-docyr.

      MOVE-CORRESPONDING P_WA1_EXCHDR TO J_1IEXCHDR.

      CLEAR: T001W,J_1IWRKCUS,J_1IREGSET,J_1IINDCUS.

      SELECT SINGLE * FROM T001W

      WHERE WERKS = J_1IEXCHDR-WERKS.

      SELECT SINGLE * FROM J_1IWRKCUS

      WHERE J_1IWERKS = J_1IEXCHDR-WERKS.

      IF SY-SUBRC <> 0.

      MESSAGE E000(8I) WITH 'plant customisation not found'.

      ENDIF.

      SELECT SINGLE * FROM J_1IREGSET

      WHERE J_1IREGID = J_1IWRKCUS-J_1IREGID.

      IF SY-SUBRC <> 0.

      MESSAGE E000(8I) WITH 'register id customisation not found'.

      ENDIF.

      SELECT SINGLE * FROM J_1IINDCUS WHERE

      J_1IBUKRS = J_1IEXCHDR-BUKRS.

      IF SY-SUBRC <> 0.

      MESSAGE E000(8I) WITH 'Customisation missing .. indcus'.

      ENDIF.

      SELECT SINGLE * FROM LFA1 WHERE

      LIFNR = J_1IEXCHDR-LIFNR.

      IF SY-SUBRC <> 0.

      MESSAGE E000(8I) WITH 'Vendor record missing ....'.

      ENDIF.

      CONCATENATE j_1iexchdr-trntyp j_1iexchdr-docno j_1iexchdr-docyr INTO

      text_name.

      ENDFORM. " SELECT_DATA

      &----


      *& Form CLOSE_FORM

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM CLOSE_FORM.

      CALL FUNCTION 'CLOSE_FORM'

      IMPORTING

      RESULT = RESULT

      • TABLES

      • OTFDATA =

      EXCEPTIONS

      UNOPENED = 1

      OTHERS = 2.

      *

      ENDFORM. " CLOSE_FORM

      &----


      *& Form OPEN_FORM

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM OPEN_FORM

      USING OPTIONS

      LAYOUT

      CHANGING RESULT.

      CALL FUNCTION 'OPEN_FORM'

      EXPORTING

      APPLICATION = 'ME'

      • ARCHIVE_INDEX =

      • ARCHIVE_PARAMS =

      DEVICE = 'PRINTER'

      DIALOG = ' '

      FORM = LAYOUT

      LANGUAGE = SY-LANGU

      OPTIONS = OPTIONS

      • MAIL_SENDER =

      • MAIL_RECIPIENT =

      • MAIL_APPL_OBJECT =

      • RAW_DATA_INTERFACE = '*'

      IMPORTING

      • LANGUAGE =

      • NEW_ARCHIVE_PARAMS =

      RESULT = RESULT

      EXCEPTIONS

      CANCELED = 1

      DEVICE = 2

      FORM = 3

      OPTIONS = 4

      UNCLOSED = 5

      • MAIL_OPTIONS = 6

      • ARCHIVE_ERROR = 7

      • INVALID_FAX_NUMBER = 8

      • MORE_PARAMS_NEEDED_IN_BATCH = 9

      OTHERS = 10

      .

      IF SY-SUBRC <> 0.

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

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

      ENDIF.

      ENDFORM. " OPEN_FORM

      &----


      *& Form PRINT_LAYOUT

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM PRINT_LAYOUT.

      PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

      PERFORM WRITE_FORM USING 'MAIN' 'ITEM_HEADER' 'SET'.

      PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

      LOOP AT ITAB_EXCDTL INTO J_1IEXCDTL.

      PERFORM WRITE_FORM USING 'MAIN' 'ITEM_VALUES' 'SET'.

      ENDLOOP.

      PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

      *

      PERFORM WRITE_FORM USING 'REGS' ' ' ' '.

      PERFORM WRITE_FORM USING 'HEADER' ' ' ' '.

      PERFORM WRITE_FORM USING 'TITLE' 'DOC_TITLE_T' 'SET'.

      PERFORM WRITE_FORM USING 'TITLE' 'DOC_TITLE_EXC_INFO' 'APPEND'.

      *

      PERFORM WRITE_FORM USING 'ADDRESS' 'ADDRESSEE' 'SET'.

      PERFORM WRITE_FORM USING 'INFO' 'HEADER_DATA' 'SET'.

      *

      PERFORM WRITE_FORM USING 'MAIN' 'RETURN_DATE' 'SET'.

      PERFORM WRITE_FORM USING 'MAIN' 'SERIAL_NO_HDR' 'SET'.

      PERFORM WRITE_FORM USING 'MAIN' 'REVERSAL_AMOUNT' 'SET'.

      PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

      PERFORM WRITE_FORM USING 'MAIN' 'IDENTIFICATION' 'SET'.

      PERFORM WRITE_FORM USING 'MAIN' 'NATURE' 'SET'.

      *

      TEXT_ID = 'PROC'.

      *concatenate j_1iexchdr-rdoc j_1iexchdr-ryear into thead-tdname.

      THEAD-TDNAME = '57FC'.

      PERFORM READ_TEXT.

      LOOP AT TLINES.

      IF TLINES-TDLINE NE SPACE.

      J_1IREGSET-J_1IRGDESC = TLINES-TDLINE.

      ENDIF.

      ENDLOOP.

      PERFORM WRITE_FORM USING 'FOOTER' ' ' 'SET'.

      ENDFORM. " PRINT_LAYOUT

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 09:35 AM

    Own solution

    Add a comment
    10|10000 characters needed characters exceeded

  • Before answering

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

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