Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to print checks according to Vendor names

Former Member
0 Kudos

    Hi All,

I am using a Z copy of program RFFOUS_C with few changes to print checks. The program prints according to vendor numbers. Now the user wants to print checks based on vendor names. I see that Reguh and Regup are only structures in this program. Can anyone please let me know in which include and for which table  i need to apply sort for the checks to be printed in alphabetical order? I checked a lot of discussions on SCN, but none helped my requirement.

Thanks,

Lavanya

5 REPLIES 5

former_member210541
Active Participant
0 Kudos

can you please paste the code snippet where you are looping on the table and calling the print portion

0 Kudos

hi Tee,

here you go .

this code comes under perform scheck(include RFFORI01)

LOOP.

**  ALI added on June 12, 2012
     add 1 to cnt.





*-- Neuer zahlender Buchungskreis --------------------------------------

*-- new paying company code --------------------------------------------

       AT NEW reguh-zbukr.



         PERFORM buchungskreis_daten_lesen.

*{   INSERT         DEVK905122                                       42

**--At new check: clear variables, statics, etc. - MBRIGHT - 4.13.2006

         CLEAR: l_budat,

                l_xblnr,

                l_sgtxt,

                l_skfbt,

                l_psskt,

                l_wrbtr,

                l_len,

                l_pos,

                l_pos2,

                l_pos3,

*               l_item_cnt,

                lt_line,

                ls_head,

                l_itm_cnt_total,

                l_offset.

         FREE lt_line.

*}   INSERT



       ENDAT.





*-- Neuer Zahlweg ------------------------------------------------------

*-- new payment method -------------------------------------------------

       AT NEW reguh-rzawe.



         flg_probedruck = 0.              "für diesen Zahlweg wurde noch

         "kein Probedruck durchgeführt

         "test print for this payment

         "method not yet done

         PERFORM zahlweg_daten_lesen.



*     Spoolparameter zur Ausgabe des Schecks angeben

*     specify spool parameters for check print

         PERFORM fill_itcpo USING par_priz

                                  t042z-zlstn

                                  space   "par_sofz via tab_ausgabe!

                                  hlp_auth.



         IF flg_schecknum NE 0.

           itcpo-tddelete  = 'X'.         "delete after print

         ENDIF.

         EXPORT itcpo TO MEMORY ID 'RFFORI01_ITCPO'.



*     Scheckformular öffnen

*     open check form

         CALL FUNCTION 'OPEN_FORM'
           EXPORTING
             form     = t042e-zforn
             device   = 'PRINTER'
             language = t001-spras
             OPTIONS  = itcpo
             dialog   = space
           EXCEPTIONS
             form     = 1.

         IF sy-subrc EQ 1.                "abend:

           IF sy-batch EQ space.          "form is not active

             MESSAGE a069 WITH t042e-zforn.

           ELSE.

             MESSAGE s069 WITH t042e-zforn.

             MESSAGE s094.

             STOP.

           ENDIF.

         ENDIF.



*     Formular auf Segmenttext (Global &REGUP-SGTXT) untersuchen

*     examine whether segment text is to be printed

         IF t042e-xavis NE space AND t042e-anzpo NE 99.

           flg_sgtxt = 0.

           CALL FUNCTION 'READ_FORM_LINES'
             EXPORTING
               element = hlp_ep_element
             TABLES
               lines   = tab_element
             EXCEPTIONS
               element = 1.

           IF sy-subrc EQ 0.

             LOOP AT tab_element.

               IF    tab_element-tdline   CS 'REGUP-SGTXT'

                 AND tab_element-tdformat NE '/*'.

                 flg_sgtxt = 1.

                 EXIT.                    "global for segment text exists

               ENDIF.

             ENDLOOP.

           ENDIF.

         ENDIF.



*     Scheck auf Währungsschlüssel (Global &REGUD-WAERS&) und Maximal-

*     betrag für die Umsetzung der Ziffern in Worten untersuchen

*     currency code &REGUD-WAERS& has to exist in window CHECK for

*     foreign currency checks, compute maximal amount 'in words'

         flg_fw_scheck = 0.

         IF t042z-xeinz EQ space.

           hlp_element = '545'.

         ELSE.

           hlp_element = '546'.

         ENDIF.

         CALL FUNCTION 'READ_FORM_LINES'
           EXPORTING
             window  = 'CHECK'
             element = hlp_element
           TABLES
             lines   = tab_element
           EXCEPTIONS
             element = 2.

         CALL FUNCTION 'READ_FORM_LINES'
           EXPORTING
             window  = 'CHECKSPL'
             element = hlp_element
           TABLES
             lines   = tab_element2
           EXCEPTIONS
             element = 2.

         APPEND LINES OF tab_element2 TO tab_element.



         hlp_maxstellen = 0.              "der Maximalbetrag wird nur

         hlp_maxbetrag  = 10000000000000. "berechnet, wenn die Globals

         "SPELL-DIGnn verwendet wurden

         IF sy-tabix NE 0.                "max. amount only computed if

           LOOP AT tab_element.           "globals SPELL-DIGnn are used

             IF tab_element-tdformat NE '/*'.

*           Währungsschlüssel

*           currency code

               IF tab_element-tdline CP '*REGU+-WAERS*'.

                 flg_fw_scheck = 1.

               ENDIF.

*           Maximal umsetzbare Stellen ermitteln

*           find out maximal number of places which can be transformed

               WHILE tab_element-tdline CS '&SPELL-DIG'.

                 SHIFT tab_element-tdline BY sy-fdpos PLACES.

                 SHIFT tab_element-tdline BY 10 PLACES.

                 IF tab_element-tdline(2) CO '0123456789'.

                   IF hlp_maxstellen LT tab_element-tdline(2)."#EC PORTABLE

                     hlp_maxstellen = tab_element-tdline(2).

                   ENDIF.

                 ENDIF.

               ENDWHILE.

             ENDIF.

           ENDLOOP.

*       Maximalbetrag ermitteln

*       compute maximal amount for transformation 'in words'

           IF hlp_maxstellen NE 0.

             hlp_maxbetrag = 1.

             DO hlp_maxstellen TIMES.

               hlp_maxbetrag = hlp_maxbetrag * 10.

             ENDDO.

           ENDIF.

         ENDIF.

         CALL FUNCTION 'CLOSE_FORM'.



       ENDAT.





*-- Neue Hausbank ------------------------------------------------------

*-- new house bank -----------------------------------------------------

       AT NEW reguh-ubnkl.



         PERFORM hausbank_daten_lesen.



*     Felder für Formularabschluß initialisieren

*     initialize fields for summary

         cnt_formulare = 0.

         cnt_hinweise  = 0.

         sum_abschluss = 0.



         flg_druckmodus = 0.

*     Vornumerierte Schecks: erste Schecknummer ermitteln

*     prenumbered checks: find out first check number

         IF flg_schecknum NE 0.

           PERFORM schecknummer_ermitteln USING 1.

         ENDIF.



       ENDAT.





*-- Neue Kontonummer bei der Hausbank ----------------------------------

*-- new account number with house bank ---------------------------------

       AT NEW reguh-ubknt.



*     Kontonummer ohne Aufbereitungszeichen für OCRA-Zeile speichern

*     store numerical account number for code line

         regud-obknt = reguh-ubknt.



       ENDAT.





*-- Neue Empfängerbank

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

*-- new bank of payee --------------------------------------------------

       AT NEW reguh-zbnkl.



         PERFORM empfbank_daten_lesen.



       ENDAT.





*-- Neue Zahlungsbelegnummer -------------------------------------------

*-- new payment document number ----------------------------------------

       AT NEW reguh-vblnr.

*     Austria only

         IF t042e-xausl EQ 'X' AND        "nur Auslandsscheck

           hlp_laufk NE 'P'.              "kein HR

           REFRESH up_oenb_angaben.

           CLEAR up_oenb_kontowae.

           READ TABLE up_oenb_kontowae WITH KEY reguh-ubhkt.

           IF sy-subrc NE 0.

             PERFORM hausbank_konto_lesen.

             up_oenb_kontowae-ubhkt = reguh-ubhkt.

             PERFORM isocode_umsetzen

               USING t012k-waers up_oenb_kontowae-uwaer.

             APPEND up_oenb_kontowae.

           ENDIF.

         ENDIF.



*     Lesen der Referenzangaben (Schweiz)

*     Switzerland only

         PERFORM hausbank_konto_lesen.



*     Kein Druck falls Fremdwährung, aber kein Fremdwährungsscheck

*     no print if foreign currency, but global &REGUD-WAERS& is missing

         flg_kein_druck = 0.

         IF reguh-waers NE t001-waers AND flg_fw_scheck EQ 0.

           err_fw_scheck-fname = t042e-zforn.

           MOVE-CORRESPONDING reguh TO err_fw_scheck.

           COLLECT err_fw_scheck.

           flg_kein_druck = 1.            "kein Druck möglich

         ENDIF.                           "no print



         IF flg_kein_druck EQ 0.



           PERFORM zahlungs_daten_lesen.



*       Tag der Zahlung in Worten (Spanien)

*       day of payment in words (Spain)

           CLEAR t015z.

           SELECT SINGLE * FROM t015z

             WHERE spras EQ hlp_sprache

               AND einh  EQ reguh-zaldt+6(1)

               AND ziff  EQ reguh-zaldt+7(1).

           IF sy-subrc EQ 0.

             regud-text2 = t015z-wort.

             TRANSLATE regud-text2 TO LOWER CASE.         "#EC TRANSLANG

             TRANSLATE regud-text2 USING '; '.

           ELSE.

             CLEAR err_t015z.

             err_t015z-spras = hlp_sprache.

             err_t015z-einh  = reguh-zaldt+6(1).

             err_t015z-ziff  = reguh-zaldt+7(1).

             COLLECT err_t015z.

           ENDIF.



*       Elementname für die Einzelposteninformation ermitteln

*       determine element name for item list

           IF hlp_laufk EQ 'P' OR

              hrxblnr-txtsl EQ 'HR' AND hrxblnr-txerg EQ 'GRN'.

             hlp_ep_element = '525-HR'.

           ELSE.

             hlp_ep_element = '525'.

           ENDIF.



*       Name des Fensters mit dem Anschreiben zusammensetzen

*       specify name Ɖf the window with the check text

           hlp_element   = '510-'.

           hlp_element+4 = reguh-rzawe.

           hlp_eletext   = text_510.

           REPLACE '&ZAHLWEG' WITH reguh-rzawe INTO hlp_eletext.



*       Druckvorgaben modifizieren lassen

*       modification of print parameters

           IMPORT itcpo FROM MEMORY ID 'RFFORI01_ITCPO'.

           PERFORM modify_itcpo.



*       open form only at first time or when optical archiving is active

           IF flg_druckmodus NE 1 OR itcpo-tdarmod NE '1'.

*         Scheckformular öffnen

*         open check form

             IF cnt_formulare EQ 0.

               itcpo-tdnewid = 'X'.

             ELSE.

               itcpo-tdnewid = space.

             ENDIF.

             IF par_priz EQ space.

               flg_dialog = 'X'.

             ELSE.

               flg_dialog = space.

             ENDIF.



*         close last form

             IF flg_druckmodus NE 0.

               CALL FUNCTION 'CLOSE_FORM'
                 IMPORTING
                   RESULT = itcpp.



               IF itcpp-tdspoolid NE 0.

                 CLEAR tab_ausgabe.

                 tab_ausgabe-name    = t042z-text1.

                 tab_ausgabe-dataset = itcpp-tddataset.

                 tab_ausgabe-spoolnr = itcpp-tdspoolid.

                 tab_ausgabe-immed   = par_sofz.

                 COLLECT tab_ausgabe.

               ENDIF.

             ENDIF.



             flg_druckmodus = itcpo-tdarmod.







             CALL FUNCTION 'OPEN_FORM'
               EXPORTING
                 archive_index  = toa_dara
                 archive_params = arc_params
                 form           = t042e-zforn
                 device         = 'PRINTER'
                 language       = t001-spras
                 OPTIONS        = itcpo
                 dialog         = flg_dialog
               IMPORTING
                 RESULT         = itcpp
               EXCEPTIONS
                 form           = 1.

             IF sy-subrc EQ 1.              "abend:

               IF sy-batch EQ space.        "form is not active

                 MESSAGE a069 WITH t042e-zforn.

               ELSE.

                 MESSAGE s069 WITH t042e-zforn.

                 MESSAGE s094.

                 STOP.

               ENDIF.

             ENDIF.

             par_priz = itcpp-tddest.

             PERFORM fill_itcpo_from_itcpp.

             EXPORT itcpo TO MEMORY ID 'RFFORI01_ITCPO'.

           ENDIF. "flg_druckmodus NE 1 OR itcpo-tdarmod NE '1'



*       Probedruck

*       test print

           IF flg_probedruck EQ 0.        "Probedruck noch nicht erledigt

             PERFORM daten_sichern.       "test print not yet done

             IF flg_schecknum EQ 2.

               regud-chect = xxx_regud-chect.

               regud-checf = xxx_regud-checf.

             ENDIF.

             cnt_seiten = 0.

             DO par_anzp TIMES.

*           Vornumerierte Schecks: Schecknummer hochzählen ab 2.Seite

*           prenumbered checks: add 1 to check number

               IF flg_schecknum EQ 1 AND sy-index GT 1.

                 hlp_page = sy-index.

                 PERFORM schecknummer_addieren.

               ENDIF.

*           Probedruck-Formular starten

*           start test print form

               CALL FUNCTION 'START_FORM'
                 EXPORTING
                   language = hlp_sprache.

*           Fenster mit Probedruck schreiben

*{   INSERT         DEVK902591                                        1

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.
*IF T042E-ZFORN NE 'ZCHECK_FORM'.

*}   INSERT

*           write windows with test print

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window   = 'INFO'
                   element  = '505'
                   function = 'APPEND'
                 EXCEPTIONS
                   window   = 1
                   element  = 2.

*{   INSERT         DEVK902591                                       16

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

**--START: MBRIGHT 01/10/2006:

**--REMOVE ASTERICKX FROM AMOUNT AND PREFIX WITH DOLLAR SIGN

*IF flg_schecknum EQ 1 AND cnt_seiten GT 0



*Modified

******            IF t042e-zforn EQ 'ZF110_PRENUMCHCK' .

               IF t042e-zforn EQ 'ZCHECK_FORM'   .

*             IF t042e-zforn EQ 'ZF110_CA_CHCK' .

*End Modified

                 DO.

                   REPLACE '*' INTO regud-swnes WITH space.

                   IF sy-subrc <> 0.

                     EXIT.

                   ENDIF.

                 ENDDO.



                 CONDENSE regud-swnes.

*   IF REGUD-WAERS EQ 'USD'.

*     SHIFT REGUD-SWNES RIGHT BY 1 PLACES.

*     REGUD-SWNES+0(1) = '$'.

                 CLEAR regud-snets.

                 regud-snets = regud-swnes.

*   ENDIF.

               ENDIF.

*}   INSERT

               CALL FUNCTION 'WRITE_FORM'

                    EXPORTING

                         window  = 'CHECK'

                         element = '540'

                    EXCEPTIONS

                         window  = 1

*{   INSERT         DEVK902591                                        3

*

*}   INSERT

                         element = 2.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   element = hlp_element
                 EXCEPTIONS
                   window  = 1
                   element = 2.

*{   INSERT         DEVK902591                                        4

*

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.

*}   INSERT

               IF sy-subrc NE 0.

                 CALL FUNCTION 'WRITE_FORM'
                   EXPORTING
                     element = '510'
                   EXCEPTIONS
                     window  = 1
                     element = 2.

               ENDIF.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   element = '514'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   element = '515'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

*{   INSERT         DEVK902591                                       17

*ENDIF.
******************start of insertion srkoduku
***--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM
*              CALL FUNCTION 'WRITE_FORM'
*
*                   EXPORTING
*
*                        element  = '525'
*
*                        function = 'APPEND'
*
*                   EXCEPTIONS
*
*                        window   = 1
*
**{   INSERT         DEVK902591                                        6
*
**
*
**}   INSERT
*
*                        element  = 2.
**}   INSERT
******************end of insertion srkoduku
*break-point.
               CALL FUNCTION 'WRITE_FORM'

                    EXPORTING

                         element  = hlp_ep_element

                         function = 'APPEND'

                    EXCEPTIONS

                         window   = 1

*{   INSERT         DEVK902591                                        6

*

*}   INSERT

                         element  = 2.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   element  = '530'
                   function = 'APPEND'
                 EXCEPTIONS
                   window   = 1
                   element  = 2.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window  = 'TOTAL'
                   element = '530'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

*{   INSERT         DEVK902591                                       18

*

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN EQ 'ZF110_PRENUMCHCK'.

*}   INSERT

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window   = 'INFO'
                   element  = '505'
                   function = 'DELETE'
                 EXCEPTIONS
                   window   = 1
                   element  = 2.

*{   INSERT         DEVK902591                                        8

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*}   INSERT

*           Probedruck-Formular beenden

*           End test print

               CALL FUNCTION 'END_FORM'
                 IMPORTING
                   RESULT = itcpp.

               IF itcpp-tdpages EQ 0.     "Print via RDI

                 itcpp-tdpages = 1.

               ENDIF.

               ADD itcpp-tdpages TO cnt_seiten.

             ENDDO.

             IF flg_schecknum EQ 1 AND cnt_seiten GT 0.

               PERFORM scheckinfo_speichern USING 1.

             ENDIF.

             PERFORM daten_zurueck.

             flg_probedruck = 1.          "Probedruck erledigt

           ENDIF.                         "Test print done



           PERFORM summenfelder_initialisieren.

*{   INSERT         DEVK902591                                     Ɖ 29



*}   INSERT



*       Prüfe, ob HR-Formular zu verwenden ist

*       Check if HR-form is to be used

           IF ( hlp_laufk EQ 'P' OR

                hrxblnr-txtsl EQ 'HR' AND hrxblnr-txerg EQ 'GRN' )

            AND hrxblnr-xhrfo NE space.

             hlp_xhrfo = 'X'.

           ELSE.

             hlp_xhrfo = space.

           ENDIF.

*{   INSERT         DEVK902591                                       28



*}   INSERT



*       Formular starten

*       start check form

           CALL FUNCTION 'START_FORM'
             EXPORTING
               archive_index = toa_dara
               language      = hlp_sprache.



*       Vornumerierte Schecks: nächste Schecknummer ermitteln

*       prenumbered checks: compute next check number

           IF flg_schecknum NE 0.

             PERFORM schecknummer_ermitteln USING 2.

           ENDIF.



*       Fenster Check, Element Entwerteter Scheck

*       window check, element voided check

*{   INSERT         DEVK902591                                       30

**--START: MBRIGHT 01/10/2006:

**--REMOVE ASTERICKX FROM AMOUNT AND PREFIX WITH DOLLAR SIGN



*Modified

*        IF t042e-zforn EQ 'ZF110_PRENUMCHCK' .

           IF t042e-zforn EQ 'CHECK_FORM' .

*End Modified

             DO.

               REPLACE '*' INTO regud-swnes WITH space.

               IF sy-subrc <> 0.

                 EXIT.

               ENDIF.

             ENDDO.



             CONDENSE regud-swnes.

*   IF REGUD-WAERS EQ 'USD'.

*     SHIFT REGUD-SWNES RIGHT BY 1 PLACES.

*     REGUD-SWNES+0(1) = '$'.

             CLEAR regud-snets.

             regud-snets = regud-swnes.

             regud-swnes = reguh-rwbtr.



*   ENDIF.

           ENDIF.

*}   INSERT

           CALL FUNCTION 'WRITE_FORM'
             EXPORTING
               window  = 'CHECK'
               element = '540'
             EXCEPTIONS
               window  = 1
               element = 2.

           IF sy-subrc EQ 2.

             err_element-fname = t042e-zforn.

             err_element-fenst = 'CHECK'.

             err_element-elemt = '540'.

             err_element-text  = text_540.

             COLLECT err_element.

           ENDIF.



           IF hlp_xhrfo EQ space.



*         Fenster Info, Element Unsere Nummer (falls diese gefüllt ist)

*         window info, element our number (if filled)

             IF reguh-eikto NE space.

*{   INSERT         DEVK902591                                        9

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.

*}   INSERT

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window   = 'INFO'
                   element  = '505'
                   function = 'APPEND'
                 EXCEPTIONS
                   window   = 1
                   element  = 2.

               IF sy-subrc EQ 2.

                 err_element-fname = t042e-zforn.

                 err_element-fenst = 'INFO'.

                 err_element-elemt = '505'.

                 err_element-text  = text_505.

                 COLLECT err_element.

               ENDIF.

             ENDIF.

*{   INSERT         DEVK903547                                       38

*ENDIF.

*}   INSERT



*         Fenster Carry Forward, Element Ãœbertrag (außer letzte Seite)

*         window carryfwd, element carry forward below (not last page)

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 window  = 'CARRYFWD'
                 element = '535'
               EXCEPTIONS
                 window  = 1
                 element = 2.

             IF sy-subrc EQ 2.

               err_element-fname = t042e-zforn.

               err_element-fenst = 'CARRYFWD'.

               err_element-elemt = '535'.

               err_element-text  = text_535.

               COLLECT err_element.

             ENDIF.

*{   INSERT         DEVK902591                                       10

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

             IF hlp_element+0(3) NE '510'.

*}   INSERT



*         Hauptfenster, Element Anschreiben (nur auf der ersten Seite)

*         main window, element check text (only on first page)

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   element = hlp_element
                 EXCEPTIONS
                   window  = 1
                   element = 2.

*{   INSERT         DEVK902591                                       11

             ENDIF.

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM



*modified

*          IF t042e-zforn NE 'ZF110_PRENUMCHCK' .

             IF t042e-zforn EQ 'ZCHECK_FORM' .

*End Modified



*}   INSERT

               IF sy-subrc EQ 2.

                 CALL FUNCTION 'WRITE_FORM'
                   EXPORTING
                     element = '510'
                   EXCEPTIONS
                     window  = 1
                     element = 2.

                 err_element-fname = t042e-zforn.

                 err_element-fenst = 'MAIN'.

                 err_element-elemt = hlp_element.

                 err_element-text  = hlp_eletext.

                 COLLECT err_element.

               ENDIF.



*         Hauptfenster, Element Zahlung erfolgt im Auftrag von

*         main window, element payment by order of

               IF reguh-absbu NE reguh-zbukr.

                 CALL FUNCTION 'WRITE_FORM'
                   EXPORTING
                     element = '513'
                   EXCEPTIONS
                     window  = 1
                     element = 2.

                 IF sy-subrc EQ 2.

                   err_element-fname = t042e-zforn.

                   err_element-fenst = 'MAIN'.

                   err_element-elemt = '513'.

                   err_element-text  = text_513.

                   COLLECT err_element.

                 ENDIF.

               ENDIF.



*         Hauptfenster, Element Abweichender Zahlungsemfänger

*         main window, element different payee

               IF regud-xabwz EQ 'X'.

                 CALL FUNCTION 'WRITE_FORM'
                   EXPORTING
                     element = '512'
                   EXCEPTIONS
                     window  = 1
                     element = 2.

                 IF sy-subrc EQ 2.

                   err_element-fname = t042e-zforn.

                   err_element-fenst = 'MAIN'.

                   err_element-elemt = '512'.

                   err_element-text  = text_512.

                   COLLECT err_element.

                 ENDIF.

               ENDIF.



*         Hauptfenster, Element Gruß und Unterschrift

*         main window, element regards and signature

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   element = '514'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

*{   INSERT         DEVK903547                                       34

             ENDIF.

*}   INSERT



*         Hauptfenster, Element Ãœberschrift (nur auf der ersten Seite)

*         main window, element title (only on first page)

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element = '515'
               EXCEPTIONS
                 window  = 1
                 element = 2.

             IF sy-subrc EQ 2.

               err_element-fname = t042e-zforn.

               err_element-fenst = 'MAIN'.

               err_element-elemt = '515'.

               err_element-text  = text_515.

               COLLECT err_element.

             ENDIF.

*{   INSERT         DEVK903547                                       35

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.

*}   INSERT



*         Hauptfenster, Element Ãœberschrift (ab der zweiten Seite oben)

*         main window, element title (2nd and following pages)

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element = '515'
                 type    = 'TOP'
               EXCEPTIONS
                 window  = 1        "Fehler bereits oben gemerkt
                 element = 2.       "error already noted



*         Hauptfenster, Element Ãœbertrag (ab der zweiten Seite oben)

*         main window, element carry forward above (2nd and following p)

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element  = '520'
                 type     = 'TOP'
                 function = 'APPEND'
               EXCEPTIONS
                 window   = 1
                 element  = 2.

             IF sy-subrc EQ 2.

               err_element-fname = t042e-zforn.

               err_element-fenst = 'MAIN'.

               err_element-elemt = '520'.

               err_element-text  = text_520.

               COLLECT err_element.

             ENDIF.
*{   INSERT         DEVK902591                                       19

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*}   INSERT



           ELSE.



             PERFORM hr_formular_lesen.



           ENDIF.



*       Prüfung, ob Avishinweis erforderlich

*       check if advice note is necessary

           cnt_zeilen = 0.

           IF t042e-xavis NE space AND t042e-anzpo NE 99.

             IF hlp_xhrfo EQ space.

               IF flg_sgtxt = 1.

                 cnt_zeilen = reguh-rpost + reguh-rtext.

               ELSE.

                 cnt_zeilen = reguh-rpost.

               ENDIF.

             ELSE.

               DESCRIBE TABLE pform LINES cnt_zeilen.

             ENDIF.

             IF cnt_zeilen GT t042e-anzpo.

               IF hlp_xhrfo EQ space.

*{   INSERT         DEVK902591                                       20

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.

*}   INSERT

                 CALL FUNCTION 'WRITE_FORM'
                   EXPORTING
                     element  = '526'
                     function = 'APPEND'
                   EXCEPTIONS
                     window   = 1
                     element  = 2.

                 IF sy-subrc EQ 2.

                   err_element-fname = t042e-zforn.

                   err_element-fenst = 'MAIN'.

                   err_element-elemt = '526'.

                   err_element-text  = text_526.

                   COLLECT err_element.

                 ENDIF.

*{   INSERT         DEVK902591                                       21

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*}   INSERT

               ENDIF.

               ADD 1 TO cnt_hinweise.

             ENDIF.

           ENDIF.



*       HR-Formular ausgeben

*       write HR form

           IF hlp_xhrfo NE space.

             LOOP AT pform.

               IF cnt_zeilen GT t042e-anzpo AND sy-tabix GT t042e-anzpo.

                 EXIT.

               ENDIF.

               regud-txthr = pform-linda.

               PERFORM scheckavis_zeile.

             ENDLOOP.

           ENDIF.

           flg_diff_bukrs = 0.



         ENDIF.



       ENDAT.



*-- Neuer Rechnungsbuchungskreis ---------------------------------------

*-- New invoice company code -------------------------------------------

       AT NEW regup-bukrs.



         IF cnt_zeilen LE t042e-anzpo AND hlp_xhrfo EQ space.

           IF ( regup-bukrs NE reguh-zbukr OR flg_diff_bukrs EQ 1 ) AND

              ( reguh-absbu EQ space OR reguh-absbu EQ reguh-zbukr ).

             flg_diff_bukrs = 1.

             SELECT SINGLE * FROM t001 INTO *t001

               WHERE bukrs EQ regup-bukrs.

             regud-abstx = *t001-butxt.

             regud-absor = *t001-ort01.

*{   INSERT         DEVK902591                                       22

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.

*}   INSERT

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element = '513'
               EXCEPTIONS
                 window  = 1
                 element = 2.

             IF sy-subrc EQ 2.

               err_element-fname = t042e-zforn.

               err_element-fenst = 'MAIN'.

               err_element-elemt = '513'.

               err_element-text  = text_513.

               COLLECT err_element.

             ENDIF.

*{   INSERT         DEVK902591                                       23

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*}   INSERT

           ENDIF.

         ENDIF.



       ENDAT.





*-- Verarbeitung der Einzelposten-Informationen ------------------------

*-- single item information --------------------------------------------

       AT daten.



         IF flg_kein_druck EQ 0.



           PERFORM einzelpostenfelder_fuellen.



*       Ausgabe der Einzelposten, falls kein Avishinweis erforderl. war

*       single item information if no advice note

           IF cnt_zeilen LE t042e-anzpo AND hlp_xhrfo EQ space.

             regud-txthr = regup-sgtxt.

*{   INSERT         DEVK903547                                       36



*}   INSERT

*{   INSERT         DEVK903547                                       39



*}   INSERT

             PERFORM scheckavis_zeile.

*{   INSERT         DEVK903547                                       40



*}   INSERT

           ENDIF.

*{   INSERT         DEVK903547                                       37



*}   INSERT



           PERFORM summenfelder_fuellen.

*{   INSERT         DEVK903547                                       33

**--START: MBRIGHT 03/01/2006 - PRINT COPY OF ITEMS IN INFO WINDOW.



*Modified

*        IF t042e-zforn EQ 'ZF110_PRENUMCHCK' .

           IF t042e-zforn EQ 'ZCHECK_FORM' .

*End Modified

             ADD 1 TO l_item_cnt.

             ADD 1 TO l_itm_cnt_total.

           ENDIF.

           CLEAR: l_budat,

                  l_xblnr,

                  l_sgtxt,

                  l_skfbt,

                  l_psskt,

                  l_wrbtr.



*Modified

*        IF t042e-zforn EQ 'ZF110_PRENUMCHCK'  AND l_item_cnt < 13
*
*                                             OR  l_item_cnt >= reguh-rpost.

*          IF t042e-zforn EQ 'ZCHECK_FORM'  AND l_item_cnt < 13
*                                             OR  l_item_cnt >= reguh-rpost.

**Sharique ALI commented the above two lines and the modified lines below
                 IF t042e-zforn EQ 'ZCHECK_FORM' .

* Sharique Ali Added logic for more than one vendors

    IF CNT GT 1.
     IF LV_LIFNR NE reguh-Lifnr.
      MOVE reguh-Lifnr TO LV_LIFNR.
     refresh lt_line.
     cnt = 1.
     l_item_cnt = 1.
     ENDIF.
     ELSE.
     MOVE reguh-Lifnr TO LV_LIFNR.
    ENDIF.

*   endat.
*end of Logic

*End Modified

             CLEAR lt_line.

             IF l_item_cnt = 1.

               lt_line-tdformat = 'T2'.



*added by Rajan 04/02/07



***            CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
***              EXPORTING
***                date_internal            = regup-budat
***              IMPORTING
***                date_external            = l_budat
***              EXCEPTIONS
***                date_internal_is_invalid = 1
***                OTHERS                   = 2.
***
***            IF sy-subrc <> 0.
***
***              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
***
***                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
***
***            ENDIF.

*            DATA: lifnr(10).
*
*            WRITE reguh-lifnr TO lifnr.

*            CONCATENATE  reguh-lifnr ',,' reguh-name1 ',,' regup-vblnr

*',,' l_budat ' ,,  - Check :  ' regud-chect





*bEGIN OF COMMENT BY SAGAR



*            CONCATENATE  lifnr ',,' reguh-name1 ',,' regup-vblnr ',,'

*l_budat

*                   INTO  lt_line-tdline.



*END OF COMMENT BY SAGAR





** End added







*Commented by sagar



**            CONCATENATE 'Invoice Date,,Invoice ID,,Reference Info,,,,'
**
**                        'Invoice Amount,,Discount,,,,Payment' INTO
**
**                        lt_line-tdline.


               CONCATENATE 'Invoice#,,Inv Date,,'

                           'Gross Amount,,Discount,,Net Amount' INTO

                           lt_line-tdline.

*Commented by sagar



               APPEND lt_line.

               CLEAR lt_line.

**---change nradic 04/12/07

*          ADD 1 TO l_item_cnt.

*          ADD 1 TO l_itm_cnt_total.

**---end change 04/12/07

*added by Rajan 04/02/07

               lt_line-tdformat = 'T2'.

               lt_line-tdline = space.

               APPEND lt_line.

               CLEAR lt_line.

**---change nradic 04/12/07

*          ADD 1 TO l_item_cnt.

*          ADD 1 TO l_itm_cnt_total.

**---end change 04/12/07

*end added.



*Modified

*        IF t042e-zforn EQ 'ZF110_PRENUMCHCK'.



*            ls_head-tdform  = 'ZF110_PRENUMCHCK'.

               ls_head-tdform  = 'ZCHECK_FORM'.

               ls_head-tdstyle = 'T1'.



*        ELSEIF t042e-zforn EQ 'ZF110_CA_CHCK'.

*

*            ls_head-tdform  = 'ZF110_CA_CHCK'.

*            ls_head-tdstyle = 'T1'.



*        ENDIF.



*end Modified



             ENDIF.



             CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
               EXPORTING
                 date_internal            = regup-budat
               IMPORTING
                 date_external            = l_budat
               EXCEPTIONS
                 date_internal_is_invalid = 1
                 OTHERS                   = 2.

             IF sy-subrc <> 0.

               MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

             ENDIF.





*          l_sgtxt = regup-sgtxt.
*
*          l_skfbt = regup-pswbt.
*
*          l_psskt = regup-sknto.



*Get Invoice amount from BSEG.

* START OF DELETION BY ASALEKAR UNDER DEVK900950
*            SELECT SINGLE xblnr INTO l_xblnr FROM bkpf
*                    WHERE belnr = regup-rebzg AND
*                          gjahr = regup-rebzj.
* END OF DELETION BY ASALEKAR UNDER DEVK900950

* START OF INSERTION BY ASALEKAR UNDER DEVK900950
             SELECT SINGLE xblnr
               INTO l_xblnr
               FROM bkpf
              WHERE bukrs EQ regup-bukrs
                AND belnr EQ regup-belnr
                AND gjahr EQ regup-gjahr.
* END OF INSERTION BY ASALEKAR UNDER DEVK900950

             IF sy-subrc NE 0.

               l_xblnr = regup-xblnr.

             ENDIF.


* START OF DELETION BY ASALEKAR UNDER DEVK900950
*            SELECT SINGLE dmbtr INTO wa_dmbtr FROM bseg
*                    WHERE belnr = regup-rebzg AND
*                          gjahr = regup-rebzj AND
*                          buzei = regup-rebzz.
* END OF DELETION BY ASALEKAR UNDER DEVK900950

* START OF INSERTION BY ASALEKAR UNDER DEVK900950
             SELECT SINGLE dmbtr
               INTO wa_dmbtr
               FROM bseg
              WHERE bukrs EQ regup-bukrs
                AND belnr EQ regup-belnr
                AND gjahr EQ regup-gjahr
                AND buzei EQ regup-buzei.
* END OF INSERTION BY ASALEKAR UNDER DEVK900950


             IF sy-subrc NE 0.

               l_dmbtr = regup-dmbtr.

             ELSE.

               l_dmbtr = wa_dmbtr.

             ENDIF.

* START OF DELETION BY ASALEKAR UNDER DEVK900950
*            SELECT SINGLE sknto INTO wa_sknto FROM bseg
*                    WHERE belnr = regup-rebzg AND
*                          gjahr = regup-rebzj AND
*                          buzei = regup-rebzz.
* END OF DELETION BY ASALEKAR UNDER DEVK900950

* START OF INSERTION BY ASALEKAR UNDER DEVK900950
             SELECT SINGLE sknto
               INTO wa_sknto
               FROM bseg
              WHERE bukrs EQ regup-bukrs
                AND belnr EQ regup-belnr
                AND gjahr EQ regup-gjahr
                AND buzei EQ regup-buzei.
* END OF INSERTION BY ASALEKAR UNDER DEVK900950

             IF sy-subrc NE 0.
               l_sknto = regup-sknto.
             ELSE.
               l_sknto = wa_sknto.
             ENDIF.


*            SELECT SINGLE wrbtr INTO wa_wrbtr FROM bseg
*                          WHERE belnr = regup-rebzg AND
*                           gjahr = regup-rebzj AND
*                           buzei = regup-rebzz.

* START OF INSERTION BY ASALEKAR UNDER DEVK900950
             SELECT SINGLE wrbtr
               INTO wa_wrbtr
               FROM bseg
              WHERE bukrs EQ regup-bukrs
                AND belnr EQ regup-belnr
                AND gjahr EQ regup-gjahr
                AND buzei EQ regup-buzei.
* END OF INSERTION BY ASALEKAR UNDER DEVK900950

             IF sy-subrc NE 0.
               l_wrbtr = regup-wrbtr.
             ELSE.
               l_wrbtr = wa_wrbtr.
             ENDIF.

*End Get Invoice

**--Add sign to credits

*--change nradic to add sign

*if regup-SHKZG eq 'S'.

*   shift l_wrbtr left by 1 places.

*   l_wrbtr+19(1) = '-'.

*endif.



*          PERFORM payment_calc2(zfiisapscript_sub) USING    regup-waers

*                                                            l_psskt

*                                                            '0'

*                                                   CHANGING l_psskt.

*

*          PERFORM payment_calc2(zfiisapscript_sub) USING    regup-waers

*                                                            l_skfbt

*                                                            '0'

*                                                   CHANGING l_skfbt.



             SHIFT l_xblnr LEFT  DELETING LEADING space.

*          SHIFT l_sgtxt LEFT  DELETING LEADING space.

*          SHIFT l_psskt RIGHT DELETING TRAILING space.

*          SHIFT l_skfbt RIGHT DELETING TRAILING space.

             SHIFT l_dmbtr LEFT DELETING LEADING space.

             SHIFT l_sknto LEFT DELETING LEADING space.

             SHIFT l_wrbtr LEFT DELETING LEADING space.


             lt_line-tdformat = 'T1'.



             IF regup-shkzg EQ 'S'.

*            CONCATENATE l_budat ',,' l_xblnr ',,' l_sgtxt ',,,,'

*                        l_skfbt '-' ',,'

*                        l_psskt ',,' l_wrbtr '-' INTO lt_line-tdline.

*

*modified 03.04.2008

*         CONCATENATE regup-rebzg ',,,,' l_budat ',,'

*l_dmbtr ',,' l_skfbt '-' ',,'

*                        l_psskt ',,' l_wrbtr '-' INTO lt_line-tdline.

* End of modified 03.04.2008

*
               CLEAR l_len.
               l_len = STRLEN( l_dmbtr ).



               CASE l_len.
                   .
                 WHEN '7'.

                   CONCATENATE l_dmbtr+0(1) l_dmbtr+1(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN '8'.

                   CONCATENATE l_dmbtr+0(2) l_dmbtr+2(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN '9'.

                   CONCATENATE l_dmbtr+0(3) l_dmbtr+3(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN '10'.

                   CONCATENATE l_dmbtr+0(1) l_dmbtr+1(3) l_dmbtr+4(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN '11'.

                   CONCATENATE l_dmbtr+0(2) l_dmbtr+2(3) l_dmbtr+5(6) INTO l_dmbtr SEPARATED BY ','.


                 WHEN '12'.

                   CONCATENATE l_dmbtr+0(3) l_dmbtr+3(3) l_dmbtr+6(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN '13'.

                   CONCATENATE l_dmbtr+0(1) l_dmbtr+1(3) l_dmbtr+4(3) l_dmbtr+7(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN OTHERS.



               ENDCASE.


               CLEAR l_len2.
               l_len2 = STRLEN( l_wrbtr ).

               CASE l_len2.
                   .
                 WHEN '7'.

                   CONCATENATE l_wrbtr+0(1) l_wrbtr+1(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '8'.

                   CONCATENATE l_wrbtr+0(2) l_wrbtr+2(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '9'.

                   CONCATENATE l_wrbtr+0(3) l_wrbtr+3(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '10'.

                   CONCATENATE l_wrbtr+0(1) l_wrbtr+1(3) l_wrbtr+4(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '11'.

                   CONCATENATE l_wrbtr+0(2) l_wrbtr+2(3) l_wrbtr+5(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '12'.

                   CONCATENATE l_wrbtr+0(3) l_wrbtr+3(3) l_wrbtr+6(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '13'.

                   CONCATENATE l_wrbtr+0(1) l_wrbtr+1(3) l_wrbtr+4(3) l_wrbtr+7(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN OTHERS.

               ENDCASE.

*              CONCATENATE  l_xblnr ',,' l_budat ',,' l_dmbtr ',,' l_sknto ',,' l_wrbtr INTO lt_line-tdline.

*START OF INSERTION by lyjacob on 27/02/2009 under DEVK901849
*Addition of negative sign in amount for US check

               CONCATENATE  l_xblnr ',,' l_budat ',,' '-' l_dmbtr ',,' l_sknto ',,' '-' l_wrbtr INTO lt_line-tdline.

*END OF INSERTION by lyjacob on 27/02/2009 under DEVK901849

             ELSE.

*            CONCATENATE l_budat ',,' l_xblnr ',,' l_sgtxt ',,,,'

*                        l_skfbt ',,'

*                        l_psskt ',,' l_wrbtr INTO lt_line-tdline.



*Modified on 23.04.2008



***            IF reguh-zbukr EQ 'US'.

*                  l_budat_mm = l_budat+3(2).
*                  l_budat_dd = l_budat+0(2).
*                  l_budat_yy = l_budat+6(4).

*              CONCATENATE l_budat+3(2) l_budat+0(2) l_budat+6(4) INTO l_budat

* START OF DELETION BY ASALEKAR UNDER DEVK900835
*              CONCATENATE l_budat_mm '/' l_budat_dd  '/' l_budat_yy INTO l_budat.
*               SEPARATED BY '/'.
* END OF DELETION BY ASALEKAR UNDER DEVK900835

***            ENDIF.

*End modified

***Modified on 30.05.2008
               CLEAR l_len.
               l_len = STRLEN( l_dmbtr ).



               CASE l_len.
                   .
                 WHEN '7'.

                   CONCATENATE l_dmbtr+0(1) l_dmbtr+1(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN '8'.

                   CONCATENATE l_dmbtr+0(2) l_dmbtr+2(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN '9'.

*                  CONCATENATE l_dmbtr+0(1) l_dmbtr+1(2) l_dmbtr+2(6) INTO l_dmbtr SEPARATED BY ','.   " DEVK900835(-)
*                  CONCATENATE l_dmbtr+0(3) l_dmbtr+2(6) INTO l_dmbtr SEPARATED BY ','.                 " DEVK900835(+) DEVK900950(-)
                   CONCATENATE l_dmbtr+0(3) l_dmbtr+3(6) INTO l_dmbtr SEPARATED BY ','.                 " DEVK900950(+)

                 WHEN '10'.

*                  CONCATENATE l_dmbtr+0(2) l_dmbtr+2(2) l_dmbtr+4(6) INTO l_dmbtr SEPARATED BY ','.    " DEVK900835(-)
                   CONCATENATE l_dmbtr+0(1) l_dmbtr+1(3) l_dmbtr+4(6) INTO l_dmbtr SEPARATED BY ','.     " DEVK900835(+)

                 WHEN '11'.

*                  CONCATENATE l_dmbtr+0(1) l_dmbtr+1(2) l_dmbtr+3(2) l_dmbtr+5(6) INTO l_dmbtr SEPARATED BY ','.     " DEVK900835(-)
                   CONCATENATE l_dmbtr+0(2) l_dmbtr+2(3) l_dmbtr+5(6) INTO l_dmbtr SEPARATED BY ','.                   " DEVK900835(+)


                 WHEN '12'.

*                  CONCATENATE l_dmbtr+0(2) l_dmbtr+2(2) l_dmbtr+4(2) l_dmbtr+6(6) INTO l_dmbtr SEPARATED BY ','.     " DEVK900835(-)
                   CONCATENATE l_dmbtr+0(3) l_dmbtr+3(3) l_dmbtr+6(6) INTO l_dmbtr SEPARATED BY ','.                   " DEVK900835(+)

                 WHEN '13'.

                   CONCATENATE l_dmbtr+0(1) l_dmbtr+1(3) l_dmbtr+4(3) l_dmbtr+7(6) INTO l_dmbtr SEPARATED BY ','.

                 WHEN OTHERS.



               ENDCASE.


* START OF INSERTION BY ASALEKAR UNDER DEVK900835
               CLEAR l_len2.
               l_len2 = STRLEN( l_wrbtr ).

               CASE l_len2.
                   .
                 WHEN '7'.

                   CONCATENATE l_wrbtr+0(1) l_wrbtr+1(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '8'.

                   CONCATENATE l_wrbtr+0(2) l_wrbtr+2(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '9'.

*                  CONCATENATE l_wrbtr+0(3) l_wrbtr+2(6) INTO l_wrbtr SEPARATED BY ','.        " DEVK900950(-)
                   CONCATENATE l_wrbtr+0(3) l_wrbtr+3(6) INTO l_wrbtr SEPARATED BY ','.        " DEVK900950(+)

                 WHEN '10'.

                   CONCATENATE l_wrbtr+0(1) l_wrbtr+1(3) l_wrbtr+4(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '11'.

                   CONCATENATE l_wrbtr+0(2) l_wrbtr+2(3) l_wrbtr+5(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '12'.

                   CONCATENATE l_wrbtr+0(3) l_wrbtr+3(3) l_wrbtr+6(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN '13'.

                   CONCATENATE l_wrbtr+0(1) l_wrbtr+1(3) l_wrbtr+4(3) l_wrbtr+7(6) INTO l_wrbtr SEPARATED BY ','.

                 WHEN OTHERS.

               ENDCASE.

* END OF INSERTION BY ASALEKAR UNDER DEVK900835


***end modified

               CONCATENATE  l_xblnr ',,' l_budat ',,' l_dmbtr ',,' l_sknto ',,' l_wrbtr INTO lt_line-tdline.

*              sort lt_line by l_budat.

             ENDIF.
***ALI enclosed append atatement in a condtion to avoid filling of Lt_line more than 10 lines
             if cnt lt 11.
             APPEND lt_line.
             endif.
             clear lw_line.
             move lt_line to lw_line.

             CLEAR lt_line.

           ENDIF.

           CLEAR l_offset.

*        l_offset = ( l_itm_cnt_total MOD 13 ).

           l_offset = ( l_itm_cnt_total MOD 12 ).



*Modified
*


*          IF t042e-zforn EQ 'ZCHECK_FORM'  AND ( l_offset = 0 OR
*
*                                                   l_itm_cnt_total >= reguh-rpost ).

**Sharique Ali Commented the above two lines and add  modified line below
   IF t042e-zforn EQ 'ZCHECK_FORM' and cnt eq 8.


*End Modified

***Addition Sharique ALi June 04, 2012
***Limit the rows in this internal table to 8 and make a file of the remaining rows at some location
data: lt_temp    LIKE STANDARD TABLE OF tline WITH HEADER LINE,
       lt_temp1    LIKE STANDARD TABLE OF tline WITH HEADER LINE,
       lit_pay     type zfi_pay,
       lwa_pay     type zfi_payment,
       lwa_temp   type tline,
       lit_reguh type table of reguh,
       lit_regud type table of regud,
       lit_regup type table of regup,
       wa_reguh type reguh,
       wa_regup type regup,
       wa_regud type regud.
    Describe table lt_line lines gs_describe.

    add 1 to    ZTOLERANCE=>GV_HEADER.
     if ZTOLERANCE=>gv_header = 1.

    if gs_describe gt 10.
       loop at lt_line into lwa_temp.
         if sy-tabix gt 10.
          append lwa_temp to lt_temp.
          delete lt_line index sy-tabix.
          delete lt_line1 index sy-tabix.

**   Fill the Smartform interface table

*        split lwa_temp-tdline at ',,' into
*            lwa_pay-xblnr(16)
*            lwa_pay-budat(10)
*            lwa_pay-dmbtr
*            lwa_pay-sknto
*            lwa_pay-wrbtr .
*
*          append lwa_pay to lit_pay.
*
*
*         clear lwa_pay.
          clear lwa_temp.
         endif.
       endloop.
     endif.

     if lt_temp[] is not initial.
      lt_line[] = lt_temp[].
     endif.
   endif.
*   include ZFI_PAYMENT.
*** End of Addition

             CALL FUNCTION 'WRITE_FORM_LINES'
               EXPORTING
                 header                   = ls_head
                 window                   = 'INFO'
               TABLES
                 lines                    = lt_line
               EXCEPTIONS
                 function                 = 1
                 type                     = 2
                 unopened                 = 3
                 unstarted                = 4
                 window                   = 5
                 bad_pageformat_for_print = 6
                 spool_error              = 7
                 codepage                 = 8
                 OTHERS                   = 9.

             IF sy-subrc <> 0.



             ENDIF.

*********start of code by srkoduku
             CALL FUNCTION 'WRITE_FORM_LINES'
               EXPORTING
                 header                   = ls_head
                 window                   = 'INFO1'
               TABLES
                 lines                    = lt_line
               EXCEPTIONS
                 function                 = 1
                 type                     = 2
                 unopened                 = 3
                 unstarted                = 4
                 window                   = 5
                 bad_pageformat_for_print = 6
                 spool_error              = 7
                 codepage                 = 8
                 OTHERS                   = 9.

             IF sy-subrc <> 0.



             ENDIF.
*********end of code by srkoduku
             CLEAR: l_item_cnt,

                    lt_line.

** ALI added one more line below June 07, 2012
*             lt_temp[] = lt_line[].

*            REFRESH lt_line.

*ALI commented the above line June 11, 2012 and added an elseif condition bel

    elseif  t042e-zforn EQ 'ZCHECK_FORM'  AND cnt gt 8.

      if cnt eq 9.
        append regup to lit_regup.
        append regud to lit_regud.
*            move '.' to lwa_pay-lifnr.
*            move '' to lwa_pay-xblnr(16).
*            move '' to lwa_pay-budat(10).
*            move '' to lwa_pay-dmbtr.
*            move '' to lwa_pay-sknto.
*            move '.' to lwa_pay-wrbtr .
*            append lwa_pay to lit_pay.
*
*            move '.' to lwa_pay-lifnr.
*            move '' to lwa_pay-xblnr(16).
*            move '' to lwa_pay-budat(10).
*            move '' to lwa_pay-dmbtr.
*            move '' to lwa_pay-sknto.
*            move '.' to lwa_pay-wrbtr .
*            append lwa_pay to lit_pay.
*            clear lwa_pay.

      endif.

       split lw_line-tdline at ',,' into
             lwa_pay-xblnr(16)
             lwa_pay-budat(10)
             lwa_pay-dmbtr
             lwa_pay-sknto
             lwa_pay-wrbtr .

           move reguh-lifnr(10) to lwa_pay-lifnr.
           append lwa_pay to lit_pay.


           append reguh to lit_reguh.
*          append regup to lit_regup.
*          append regud to lit_regud.


          clear lwa_pay.

*      append lw_line to lt_temp.
* ALI added a new elseif below to take care of cnt less than 8 ie less than 8 vendor invoices dated Feb 20, 2013

   elseif t042e-zforn EQ 'ZCHECK_FORM'  AND cnt lt 8.
*   *   include ZFI_PAYMENT.
*** End of Addition

             CALL FUNCTION 'WRITE_FORM_LINES'
               EXPORTING
                 header                   = ls_head
                 window                   = 'INFO'
               TABLES
                 lines                    = lt_line
               EXCEPTIONS
                 function                 = 1
                 type                     = 2
                 unopened                 = 3
                 unstarted                = 4
                 window                   = 5
                 bad_pageformat_for_print = 6
                 spool_error              = 7
                 codepage                 = 8
                 OTHERS                   = 9.

             IF sy-subrc <> 0.



             ENDIF.

*********start of code by srkoduku
             CALL FUNCTION 'WRITE_FORM_LINES'
               EXPORTING
                 header                   = ls_head
                 window                   = 'INFO1'
               TABLES
                 lines                    = lt_line
               EXCEPTIONS
                 function                 = 1
                 type                     = 2
                 unopened                 = 3
                 unstarted                = 4
                 window                   = 5
                 bad_pageformat_for_print = 6
                 spool_error              = 7
                 codepage                 = 8
                 OTHERS                   = 9.

             IF sy-subrc <> 0.



             ENDIF.


*   End of new addition Feb 20,2013

           ENDIF.

**--END: MBRIGHT 03/01/2006 - PRINT COPY OF ITEMS IN INFO WINDOW.

**--START: MBRIGHT 02/27/2006



*Modified

*        IF t042e-zforn EQ 'ZF110_PRENUMCHCK' .

           IF t042e-zforn EQ 'ZCHECK_FORM' .

***Addition by Sharique Ali for Printing additional line item data
*          IF t042e-zforn EQ 'ZCHECK_FORM' .
*            CALL FUNCTION 'WRITE_FORM'
*              EXPORTING
*                window  = 'CUST'
*                element = '590'
*              EXCEPTIONS
*                window  = 1
*                element = 2.

*           endif.

***End of Addition




*End Modified



             DO.

               REPLACE '*' INTO regud-swnes WITH space.

               IF sy-subrc <> 0.

                 EXIT.

               ENDIF.

             ENDDO.

             CONDENSE regud-swnes.

*   IF REGUD-WAERS EQ 'USD'.

*     SHIFT REGUD-SWNES RIGHT BY 1 PLACES.

*     REGUD-SWNES+0(1) = '$'.

             CLEAR regud-snets.

             regud-snets = regud-swnes.

*   ENDIF.

           ENDIF.

**--END: MBRIGHT 02/27/2006

*}   INSERT



           IF cnt_zeilen LE t042e-anzpo AND hlp_xhrfo EQ space.

*{   INSERT         DEVK902591                                       24

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.

*}   INSERT

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element  = '525-TX'
                 function = 'APPEND'
               EXCEPTIONS
                 window   = 1
                 element  = 2.

*{   INSERT         DEVK902591                                       25

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*}   INSERT

           ENDIF.



         ENDIF.



*     Angabentabelle für die OeNB-Meldung (Österreich)

         IF t042e-xausl = 'X'.            "nur Auslandsscheck

           CLEAR up_oenb_angaben.

           up_oenb_angaben-diekz = regup-diekz.

           up_oenb_angaben-lzbkz = regup-lzbkz.

           up_oenb_angaben-summe = regud-netto.

           COLLECT up_oenb_angaben.

         ENDIF.



       ENDAT.





*-- Ende der Zahlungsbelegnummer ---------------------------------------

*-- end of payment document number -------------------------------------

       AT END OF reguh-vblnr.



         IF flg_kein_druck EQ 0.



*       Zahlbetrag ohne Aufbereitungszeichen für Codierzeile speichern

*       store numerical payment amount for code line

           IF reguh-waers EQ t001-waers.

             regud-socra = regud-swnes.

           ELSE.

             regud-socra = 0.

             PERFORM laender_lesen USING t001-land1.

             IF t005-intca EQ 'DE'.

               PERFORM isocode_umsetzen USING reguh-waers hlp_waers.

               IF hlp_waers EQ 'DEM' OR hlp_waers EQ 'EUR'.

                 regud-socra = regud-swnes.

               ENDIF.

             ENDIF.

             IF t005-intca EQ 'AT'.

               PERFORM isocode_umsetzen USING reguh-waers hlp_waers.

               IF hlp_waers EQ 'ATS' OR hlp_waers EQ 'EUR'.

                 regud-socra = regud-swnes.

               ENDIF.

             ENDIF.

           ENDIF.

           IF reguh-waers EQ t012k-waers.

             regud-socrb = regud-swnes.

           ELSE.

             regud-socrb = 0.

           ENDIF.



           PERFORM ziffern_in_worten.



*       Summenfelder hochzählen und aufbereiten

*       add up total amount fields



           ADD 1            TO cnt_formulare.

           ADD reguh-rbetr  TO sum_abschluss.

           WRITE:

             cnt_hinweise   TO regud-avish,

             cnt_formulare  TO regud-zahlt,

             sum_abschluss  TO regud-summe CURRENCY t001-waers.

           TRANSLATE:

             regud-avish USING ' *',

             regud-zahlt USING ' *',

             regud-summe USING ' *'.



           IF hlp_xhrfo EQ space.



* Nur für Brasilien (Check auf Land liegt in Funktionsbaustein)

* Only Brazil (Check on country within the function module)



             CALL FUNCTION 'BOLETO_DATA'
               EXPORTING
                 line_reguh = reguh
               TABLES
                 itab_regup = tab_regup
               CHANGING
                 line_regud = regud.



             CALL FUNCTION 'KOREA_DATA'
               EXPORTING
                 line_reguh = reguh
               TABLES
                 itab_regup = tab_regup
               CHANGING
                 line_regud = regud.





*         HauptfenƉter, Element Gesamtsumme (nur auf der letzten Seite)

*         main window, element total (only last page)

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element  = '530'
                 function = 'APPEND'
               EXCEPTIONS
                 window   = 1
                 element  = 2.

             IF sy-subrc EQ 2.

               err_element-fname = t042e-zforn.

               err_element-fenst = 'MAIN'.

               err_element-elemt = '530'.

               err_element-text  = text_530.

               COLLECT err_element.

             ENDIF.



*         Vornumerierte Schecks: Schecknummer hochzählen ab 2.Seite

*         prenumbered checks: add 1 to check number

             IF flg_schecknum EQ 1.

               CALL FUNCTION 'GET_TEXTSYMBOL'
                 EXPORTING
                   line         = '&PAGE&'
                   start_offset = 0
                 IMPORTING
                   value        = hlp_page.

               IF hlp_page NE hlp_seite.

                 hlp_seite = hlp_page.

                 PERFORM schecknummer_addieren.

               ENDIF.

             ENDIF.



*         Alternativ: Fenster Total, Element Gesamtsumme

*         alternatively: window total, element total

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 window  = 'TOTAL'
                 element = '530'
               EXCEPTIONS
                 window  = 1
                 element = 2.

             IF sy-subrc EQ 2 AND

               err_element-fname NE t042e-zforn

               OR err_element-fenst NE 'MAIN'

               OR err_element-elemt NE '530' ).

               err_element-fname = t042e-zforn.

               err_element-fenst = 'TOTAL'.

               err_element-elemt = '530'.

               err_element-text  = text_530.

               COLLECT err_element.

             ENDIF.

*{   INSERT         DEVK905308                                       43



*Modified

*          IF t042e-zforn EQ 'ZF110_PRENUMCHCK' .

             IF t042e-zforn EQ 'ZCHECK_FORM' .



*End Modified

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window  = 'WINDOW1'
                   element = '530'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

             ENDIF.

*}   INSERT



*         Fenster Carry Forward, Element Ãœbertrag löschen

*         window carryfwd, delete element carry forward below

*{   INSERT         DEVK902591                                       26

**--START: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*IF T042E-ZFORN NE 'ZF110_PRENUMCHCK'.

*}   INSERT

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 window   = 'CARRYFWD'
                 element  = '535'
                 function = 'DELETE'
               EXCEPTIONS
                 window   = 1       "Fehler bereits oben gemerkt
                 element  = 2.      "error already noted



*         Hauptfenster, Element Ãœberschrift löschen

*         main window, delete element title

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element  = '515'
                 type     = 'TOP'
                 function = 'DELETE'
               EXCEPTIONS
                 window   = 1       "Fehler bereits oben gemerkt
                 element  = 2.      "error already noted



*         Hauptfenster, Element Ãœbertrag löschen

*         main window, delete element carry forward above

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 element  = '520'
                 type     = 'TOP'
                 function = 'DELETE'
               EXCEPTIONS
                 window   = 1       "Fehler bereits oben gemerkt
                 element  = 2.      "error already noted

*{   INSERT         DEVK902591                                       27

*ENDIF.

**--END: MBRIGHT 01/10/2006: SUPPRESS IF CUSTOM FORM

*}   INSERT



           ENDIF.



*       Fenster Check, Element Entwerteter Scheck löschen

*       window check, delete element voided check

           IF regud-wrbtr NE 0.           "zero net check has to be voided

*{   INSERT         DEVK902591                                       31

**--START: MBRIGHT 01/10/2006:

**--REMOVE ASTERICKX FROM AMOUNT AND PREFIX WITH DOLLAR SIGN



*Modified

*          IF t042e-zforn EQ 'ZF110_PRENUMCHCK' .

             IF t042e-zforn EQ 'ZCHECK_FORM' .



*End Modified

               DO.

                 REPLACE '*' INTO regud-swnes WITH space.

                 IF sy-subrc <> 0.

                   EXIT.

                 ENDIF.

               ENDDO.

               CONDENSE regud-swnes.

*   IF REGUD-WAERS EQ 'USD'.

*     SHIFT REGUD-SWNES RIGHT BY 1 PLACES.

*     REGUD-SWNES+0(1) = '$'.

               CLEAR regud-snets.

               regud-snets = regud-swnes.

*   ENDIF.

             ENDIF.

*}   INSERT

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 window   = 'CHECK'
                 element  = '540'
                 function = 'DELETE'
               EXCEPTIONS
                 window   = 1       "Fehler bereits oben gemerkt
                 element  = 2.      "error already noted



*         Fenster Check, Element Echter Scheck (nur auf letzte Seite)

*         window check, element genuine check (only last page)

             IF t042z-xeinz EQ space.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window  = 'CHECKSPL'
                   element = '545'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window  = 'CHECK'
                   element = '545'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

               IF sy-subrc EQ 2.

                 err_element-fname = t042e-zforn.

                 err_element-fenst = 'CHECK'.

                 err_element-elemt = '545'.

                 err_element-text  = text_545.

                 COLLECT err_element.

               ENDIF.

*{   INSERT         DEVK905739                                       46

*-----change nradic 05/12/06: forced to do this

               CLEAR: l_itm_cnt_total.



*}   INSERT

             ELSE.                        "debitorische Wechsel Frankreich

               CALL FUNCTION 'WRITE_FORM' "bills of exchange to debitors

                    EXPORTING             "(France)

                         window  = 'CHECKSPL'

                         element = '546'

                    EXCEPTIONS

                         window  = 1

                         element = 2.

               CALL FUNCTION 'WRITE_FORM'
                 EXPORTING
                   window  = 'CHECK'
                   element = '546'
                 EXCEPTIONS
                   window  = 1
                   element = 2.

               IF sy-subrc EQ 2.

                 err_element-fname = t042e-zforn.

                 err_element-fenst = 'CHECK'.

                 err_element-elemt = '546'.

                 err_element-text  = text_546.

                 COLLECT err_element.

               ENDIF.

             ENDIF.

           ENDIF.



*       Angabenteil für die OeNB-Meldung (Österreich)

*       Austria only

           IF t042e-xausl NE space        "Auslandsscheck, nicht Pfändung

           AND NOT ( hrxblnr-txtsl EQ 'HR' AND hrxblnr-txerg EQ 'GRN' ).

             CLEAR:

               regud-x08, regud-x10, regud-x11, regud-x12, regud-x13,

               regud-text1, regud-zwck1, regud-zwck2.

             IF up_oenb_kontowae-uwaer EQ 'ATS'.

               regud-x08   = 'X'.

             ELSE.

               regud-text1 = up_oenb_kontowae-uwaer.

             ENDIF.

             SORT up_oenb_angaben BY summe DESCENDING.

             READ TABLE up_oenb_angaben INDEX 1.

             CASE up_oenb_angaben-diekz.

               WHEN space.

                 regud-x10 = 'X'.

               WHEN 'I'.

                 regud-x10 = 'X'.

               WHEN 'R'.

                 regud-x11 = 'X'.

               WHEN 'K'.

                 regud-x12 = 'X'.

               WHEN OTHERS.

                 regud-x13 = 'X'.

                 PERFORM read_scb_indicator USING up_oenb_angaben-lzbkz.

                 regud-zwck1 = t015l-zwck1.

                 regud-zwck2 = t015l-zwck2.

             ENDCASE.

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 window  = 'ORDERS'
                 element = '550'
               EXCEPTIONS
                 window  = 1
                 element = 2.

           ENDIF.


*       Formular beenden

*       End check form

           CALL FUNCTION 'END_FORM'
             IMPORTING
               RESULT = itcpp.

           IF itcpp-tdpages EQ 0.         "Print via RDI

             itcpp-tdpages = 1.

           ENDIF.

           IF flg_schecknum EQ 1.

             cnt_seiten = itcpp-tdpages"Für vornumerierte Schecks

           ELSE.                          "For prenumbered checks

             cnt_seiten = 1.

           ENDIF.

           IF flg_schecknum NE 0 AND cnt_seiten GT 0.

             PERFORM scheckinfo_speichern USING 2.

           ENDIF.



         ENDIF.

describe table lt_line lines gs_describe2.   "DEVK914116
delete lt_line index gs_describe2.    "DEVK914116

       ENDAT.





*-- Ende der Hausbank --------------------------------------------------

*-- end of house bank --------------------------------------------------

       AT END OF reguh-ubnkl.

*{   INSERT         DEVK905733                                       44

*----changed nradic 05/11/06: forced to do it

*-----set total lines back to 1 when new vendor

         CLEAR: l_itm_cnt_total.

*}   INSERT



         IF cnt_formulare NE 0.           "Formularabschluß erforderlich

           "summary necessary



*       close last check

           CALL FUNCTION 'CLOSE_FORM'
             IMPORTING
               RESULT = itcpp.



           IF itcpp-tdspoolid NE 0.

             CLEAR tab_ausgabe.

             tab_ausgabe-name    = t042z-text1.

             tab_ausgabe-dataset = itcpp-tddataset.

             tab_ausgabe-spoolnr = itcpp-tdspoolid.

             tab_ausgabe-immed   = par_sofz.

             COLLECT tab_ausgabe.

           ENDIF.

           CLEAR flg_druckmodus.



           IF hlp_laufk NE '*'            "kein Onlinedruck

                                          "no online check print

             AND par_nosu EQ space.       "Formularabschluß gewünscht

             "summary requested

*         Formular für den Abschluß starten

*         start form for summary

             SET COUNTRY space.

             IMPORT itcpo FROM MEMORY ID 'RFFORI01_ITCPO'.

             itcpo-tdnewid = space.

             CALL FUNCTION 'OPEN_FORM'
               EXPORTING
                 form     = t042e-zforn
                 device   = 'PRINTER'
                 language = t001-spras
                 OPTIONS  = itcpo
                 dialog   = space.

             CALL FUNCTION 'START_FORM'
               EXPORTING
                 startpage = 'LAST'
                 language  = t001-spras.



*         Vornumerierte Schecks: letzte Schecknummer ermitteln

*         prenumbered checks: compute last check number

             IF flg_schecknum EQ 1.

               PERFORM schecknummer_ermitteln USING 3.

             ENDIF.



*         Ausgabe des Formularabschlusses

*         print summary

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 window = 'SUMMARY'
               EXCEPTIONS
                 window = 1.

             IF sy-subrc EQ 1.

               err_element-fname = t042e-zforn.

               err_element-fenst = 'SUMMARY'.

               err_element-elemt = space.

               err_element-text  = space.

               COLLECT err_element.

             ENDIF.



*         Fenster Scheck, Element Entwertet

*         window check, element voided check

*{   INSERT         DEVK902591                                       32

**--START: MBRIGHT 01/10/2006:

**--REMOVE ASTERICKX FROM AMOUNT AND PREFIX WITH DOLLAR SIGN

*          IF t042e-zforn EQ 'ZF110_PRENUMCHCK' .

             IF t042e-zforn EQ 'ZCHECK_FORM' .



               DO.

                 REPLACE '*' INTO regud-swnes WITH space.

                 IF sy-subrc <> 0.

                   EXIT.

                 ENDIF.

               ENDDO.

               CONDENSE regud-swnes.

*   IF REGUD-WAERS EQ 'USD'.

*     SHIFT REGUD-SWNES RIGHT BY 1 PLACES.

*     REGUD-SWNES+0(1) = '$'.

               CLEAR regud-snets.

               regud-snets = regud-swnes.

*   ENDIF.

             ENDIF.

*}   INSERT

             CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                 window  = 'CHECK'
                 element = '540'
               EXCEPTIONS
                 window  = 1        "Fehler bereits oben gemerkt
                 element = 2.       "error already noted



*         Formular für den Abschluß beenden

*         end form for summary

             CALL FUNCTION 'END_FORM'
               IMPORTING
                 RESULT = itcpp.

             IF itcpp-tdpages EQ 0.       "Print via RDI

               itcpp-tdpages = 1.

             ENDIF.

             cnt_seiten = itcpp-tdpages"Für vornumerierte Schecks

             "For prenumbered checks

             IF flg_schecknum EQ 1 AND cnt_seiten GT 0.

               PERFORM scheckinfo_speichern USING 3.

             ENDIF.



*         Abschluß des Formulars

*         close form

             CALL FUNCTION 'CLOSE_FORM'
               IMPORTING
                 RESULT = itcpp.



             IF itcpp-tdspoolid NE 0.

               CLEAR tab_ausgabe.

               tab_ausgabe-name    = t042z-text1.

               tab_ausgabe-dataset = itcpp-tddataset.

               tab_ausgabe-spoolnr = itcpp-tdspoolid.

               tab_ausgabe-immed   = par_sofz.

               COLLECT tab_ausgabe.

             ENDIF.



               ENDIF.



           IF NOT itcpp-tdspoolid IS INITIAL.

             CALL FUNCTION 'RSPO_FINAL_SPOOLJOB'
               EXPORTING
                 rqident = itcpp-tdspoolid
                 set     = 'X'
                 force   = 'X'
               EXCEPTIONS
                 OTHERS  = 4.

             IF sy-subrc NE 0.

               MOVE-CORRESPONDING syst TO fimsg.

               PERFORM message USING fimsg-msgno.

             ENDIF.

           ENDIF.



         ENDIF.



       ENDAT.

***  ALI added on June 12, 2012
*    add 1 to cnt.


     ENDLOOP.

0 Kudos

Ok, Please provide the place where the table of vendor numbers are getting filled.

0 Kudos

Hi Tee Gee,

there is no table getting filled. That is all the problem here. Else i would have just put a sort on the table. There are only structures as reguh and regup.

Regards,

Lavanya

0 Kudos

hi Lavanya,

Since you are making it to Z report. Try to change  include  ZFIRFFORI01. Here you can fetch required values from REGUP  table into internal table for the values that are coming from structure .Now you can perform the required operations like sorting etc.