Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Weird Sapscript output

Hi everyone!

My problem goes like this: I recently revised a sapscript driver program for the payment advice form, which is working fine in another version. The problem is, when I copied the subroutine to another version of the driver program, what it does is it includes in the final output the "test version" of the form, like what you normally see when you test the sapscript from se71, plus the pages with the actual data in them. I am really not sure what is wrong with the driver program, since it's working fine with the other version. The subroutine was originally copied off the include RFFORI06. For everyone's reference, The code is below, and the one marked PBA01 are my additional code. Nothing was added or changed to the sapscript.

*----


*

  • FORM AVIS *

*----


*

  • Druck Avis *

  • Gerufen von END-OF-SELECTION (RFFOxxxz) *

*----


*

  • keine USING-Parameter *

*----


*

FORM avis.

DATA:

l_form LIKE itcta-tdform,

l_pages LIKE itctg OCCURS 0 WITH HEADER LINE.

*----


*

  • Abarbeiten der extrahierten Daten *

*----


*

IF flg_sort NE 2.

SORT BY avis.

flg_sort = 2.

ENDIF.

LOOP.

*-- Neuer zahlender Buchungskreis -

-


AT NEW reguh-zbukr.

PERFORM buchungskreis_daten_lesen.

ENDAT.

*-- Neuer Zahlweg -

-


AT NEW reguh-rzawe.

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

"kein Probedruck durchgeführt

IF reguh-rzawe NE space.

PERFORM zahlweg_daten_lesen.

ENDIF.

  • Zahlungsformular nur zum Lesen öffnen

CALL FUNCTION 'OPEN_FORM'

EXPORTING

form = t042e-zforn

dialog = space

device = 'SCREEN'

language = t001-spras

EXCEPTIONS

form = 1.

IF sy-subrc EQ 0. "Formular existiert

  • Formular auf Segmenttext (Global ®UP-SGTXT) untersuchen

  • Start Fix SL 20.01.99.

  • Next 3 lines added to allow the production of both EDI Idocs and

  • paper remittance advices due to implementation of BoA.

  • IF par_avis NE space AND par_xdta NE space. " PE001

  • par_xdta = space. " PE001

  • ENDIF. " PE001

IF par_xdta EQ space.

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. "Global für Segmenttext existiert

EXIT.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

CALL FUNCTION 'CLOSE_FORM'.

ENDIF.

  • Überschrift für den Formularabschluß modifizieren

t042z-text1 = text_001.

  • Dataset zur Ausgabe des Avises angeben

PERFORM fill_itcpo USING par_pria

'LIST5S'

par_sofa

hlp_auth.

IF par_pria EQ space.

flg_dialog = 'X'.

ELSE.

flg_dialog = space.

ENDIF.

  • Formular öffnen

***********************BEGIN OF PBA01*********************************

IF p_mail NE space.

SELECT SINGLE * INTO wa_lfa1 FROM lfa1

WHERE lifnr = reguh-lifnr.

CHECK sy-subrc = 0.

SELECT SINGLE * INTO wa_adrt FROM adrt

WHERE addrnumber = wa_lfa1-adrnr

AND remark = 'ZFFOEDI1'.

IF sy-subrc = 0.

SELECT SINGLE smtp_addr INTO g_emailadd

FROM adr6

WHERE addrnumber = wa_lfa1-adrnr

AND consnumber = wa_adrt-consnumber.

ELSE.

CLEAR wa_adr6.

ENDIF.

IF g_emailadd NE SPACE.

itcpo-tdimmed = SPACE.

ENDIF.

ENDIF.

************************END OF PBA01**********************************

CALL FUNCTION 'OPEN_FORM'

EXPORTING

form = t042b-aforn

device = 'PRINTER'

language = t001-spras

OPTIONS = itcpo

dialog = flg_dialog

EXCEPTIONS

form = 1.

IF sy-subrc EQ 1. "Abbruch:

IF sy-batch EQ space. "Formular ist nicht aktiv!

MESSAGE a069 WITH t042b-aforn.

ELSE.

MESSAGE s069 WITH t042b-aforn.

MESSAGE s094.

STOP.

ENDIF.

ENDIF.

*------ end original code

  • ENDIF.

              • End Add Dune01 **********************

ENDAT.

*-- Neue Hausbank -

-


AT NEW reguh-ubnkl.

PERFORM hausbank_daten_lesen.

  • Felder für Formularabschluß initialisieren

cnt_avise = 0.

cnt_avedi = 0.

sum_abschluss = 0.

sum_abschl_edi = 0.

REFRESH tab_edi_avis.

  • Avisformular starten

CALL FUNCTION 'START_FORM'

EXPORTING

language = t001-spras

EXCEPTIONS

form = 1

unended = 2.

IF sy-subrc EQ 1. "Abbruch:

IF sy-batch EQ space. "Formular ist nicht aktiv!

MESSAGE a069 WITH t042b-aforn.

ELSE.

MESSAGE s069 WITH t042b-aforn.

MESSAGE s094.

STOP.

ENDIF.

ENDIF.

ENDAT.

*-- Neue Empfängerbank -

-


AT NEW reguh-zbnkl.

PERFORM empfbank_daten_lesen.

ENDAT.

*-- Neue Zahlungsbelegnummer -

-


AT NEW reguh-vblnr.

  • Prüfe, ob Avis auf Papier erzwungen wird

  • Check if advice on paper is forced

IF flg_papieravis EQ 1.

reguh-ediav = space.

ENDIF.

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

  • Check if HR-form is to be used

hrxblnr = regup-xblnr.

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.

  • HR-Formular besorgen

  • read HR form

IF hlp_xhrfo EQ 'X'.

PERFORM hr_formular_lesen.

ENDIF.

  • Prüfung, ob Avis erforderlich

cnt_zeilen = 0.

IF hlp_xhrfo EQ space.

IF flg_sgtxt EQ 1.

cnt_zeilen = reguh-rpost + reguh-rtext.

ELSE.

cnt_zeilen = reguh-rpost.

ENDIF.

ELSE.

DESCRIBE TABLE pform LINES cnt_zeilen.

ENDIF.

flg_kein_druck = 0.

IF reguh-ediav EQ 'V'.

  • Avis bereits versendet

flg_kein_druck = 1. "kein Druck erforderlich

ELSEIF reguh-rzawe NE space.

  • Avis zu Formular

IF hlp_zeilen EQ 0 AND par_xdta EQ space.

IF t042e-xavis EQ space OR cnt_zeilen LE t042e-anzpo.

flg_kein_druck = 1. "kein Druck erforderlich

ENDIF.

  • Avis zum DTA

ELSE.

CLEAR tab_kein_avis.

MOVE-CORRESPONDING reguh TO tab_kein_avis.

READ TABLE tab_kein_avis.

IF sy-subrc EQ 0.

flg_kein_druck = 1. "kein Druck erforderlich

ENDIF.

ENDIF.

ENDIF.

PERFORM zahlungs_daten_lesen.

IF reguh-ediav NA ' V' AND hlp_xhrfo EQ space.

PERFORM summenfelder_initialisieren.

ENDIF.

  • Schecknummer bei vornumerierten Schecks

CLEAR regud-chect.

READ TABLE tab_schecks WITH KEY

zbukr = reguh-zbukr

vblnr = reguh-vblnr.

IF sy-subrc EQ 0.

regud-chect = tab_schecks-chect.

ELSEIF flg_schecknum EQ 1.

IF zw_xvorl EQ space.

IF hlp_laufk NE 'P'. "FI-Beleg vorhanden?

SELECT * FROM payr

WHERE zbukr EQ reguh-zbukr

AND vblnr EQ reguh-vblnr

AND gjahr EQ regud-gjahr

AND voidr EQ 0.

ENDSELECT.

sy-msgv1 = reguh-zbukr.

sy-msgv2 = regud-gjahr.

sy-msgv3 = reguh-vblnr.

ELSE. "HR-Abrechnung vorhanden?

SELECT * FROM payr

WHERE pernr EQ reguh-pernr

AND seqnr EQ reguh-seqnr

AND btznr EQ reguh-btznr

AND voidr EQ 0.

ENDSELECT.

sy-msgv1 = reguh-pernr.

sy-msgv2 = reguh-seqnr.

sy-msgv3 = reguh-btznr.

ENDIF.

IF sy-subrc EQ 0.

regud-chect = payr-chect.

ELSE.

IF sy-batch EQ space. "check does not exist

MESSAGE a564(fs) WITH sy-msgv1 sy-msgv2 sy-msgv3.

ELSE.

MESSAGE s564(fs) WITH sy-msgv1 sy-msgv2 sy-msgv3.

MESSAGE s549(fs).

STOP.

ENDIF.

ENDIF.

ELSE.

regud-chect = 'TEST'.

ENDIF.

ENDIF.

  • Berechnung Anzahl benötigter Wechsel

IF reguh-weamx EQ 0.

regud-wecan = 1.

ELSE.

regud-wecan = reguh-weamx.

IF reguh-wehrs NE 0.

ADD 1 TO regud-wecan.

ENDIF.

ENDIF.

ENDAT.

*-- Verarbeitung der Einzelposten-Informationen -

-


AT daten.

PERFORM einzelpostenfelder_fuellen.

IF flg_papieravis EQ 1.

reguh-ediav = space.

ENDIF.

IF reguh-ediav NA ' V' AND hlp_xhrfo EQ space.

PERFORM summenfelder_fuellen.

ENDIF.

ENDAT.

*-- Ende der Zahlungsbelegnummer -

-


AT END OF reguh-vblnr.

  • Zahlungsbelegnummer bei Saldo-Null-Mitteilungen und

  • Zahlungsanforderungen nicht ausgeben

IF ( reguh-rzawe EQ space AND reguh-xvorl EQ space )

OR t042z-xzanf NE space.

reguh-vblnr = space.

ENDIF.

  • Stets Ausgabe via EDI, falls möglich

IF flg_papieravis EQ 1.

reguh-ediav = space.

ENDIF.

CLEAR regud-avedn.

IF reguh-ediav NA ' V' AND hlp_xhrfo EQ space.

CALL FUNCTION 'FI_EDI_REMADV_PEXR2001_OUT'

EXPORTING

reguh_in = reguh

regud_in = regud

xeinz_in = regud-xeinz

IMPORTING

docnum_out = regud-avedn

TABLES

tab_regup = tab_regup

EXCEPTIONS

not_possible = 4.

IF sy-subrc EQ 0.

ADD 1 TO cnt_avedi.

ADD reguh-rbetr TO sum_abschl_edi.

WRITE:

cnt_avise TO regud-avise,

cnt_avedi TO regud-avedi,

sum_abschluss TO regud-summe CURRENCY t001-waers,

sum_abschl_edi TO regud-suedi CURRENCY t001-waers.

TRANSLATE:

regud-avise USING ' *',

regud-avedi USING ' *',

regud-summe USING ' *',

regud-suedi USING ' *'.

tab_edi_avis-reguh = reguh.

tab_edi_avis-regud = regud.

APPEND tab_edi_avis.

flg_kein_druck = 1.

ENDIF.

ENDIF.

  • Ausgabe auf Papier (nur falls notwendig)

IF flg_kein_druck EQ 0.

  • Name des Elements mit dem Anschreiben zusammensetzen

IF reguh-rzawe NE space.

hlp_element = '610-'.

hlp_element+4 = reguh-rzawe.

hlp_eletext = text_610.

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

ELSE.

hlp_element = '611-'.

hlp_element+4 = reguh-avisg.

hlp_eletext = text_611.

ENDIF.

  • Probedruck

IF flg_probedruck EQ 0. "Probedruck noch nicht erledigt

PERFORM daten_sichern.

DO par_anzp TIMES.

  • Probedruck-Formular starten

CALL FUNCTION 'START_FORM'

EXPORTING

language = hlp_sprache.

  • Fenster mit Probedruck schreiben

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'INFO'

element = '605'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = hlp_element

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc NE 0.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '610'

EXCEPTIONS

window = 1

element = 2.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '614'

EXCEPTIONS

window = 1

element = 2.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '615'

EXCEPTIONS

window = 1

element = 2.

DO 5 TIMES.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '625'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

ENDDO.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '630'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'TOTAL'

element = '630'

EXCEPTIONS

window = 1

element = 2.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'INFO'

element = '605'

function = 'DELETE'

EXCEPTIONS

window = 1

element = 2.

  • Probedruck-Formular beenden

CALL FUNCTION 'END_FORM'.

ENDDO.

PERFORM daten_zurueck.

flg_probedruck = 1. "Probedruck erledigt

ENDIF.

PERFORM zahlungs_daten_lesen_hlp.

PERFORM summenfelder_initialisieren.

  • Formular starten

CALL FUNCTION 'START_FORM'

EXPORTING

language = hlp_sprache.

IF hlp_xhrfo EQ space.

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

IF reguh-eikto NE space.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'INFO'

element = '605'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'INFO'.

err_element-elemt = '605'.

err_element-text = text_605.

COLLECT err_element.

ENDIF.

ENDIF.

  • Fenster Carry Forward, Element Übertrag (außer letzte Seite)

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'CARRYFWD'

element = '635'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'CARRYFWD'.

err_element-elemt = '635'.

err_element-text = text_635.

COLLECT err_element.

ENDIF.

  • Hauptfenster, Element Anschreiben-x (nur auf der ersten Seite)

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = hlp_element

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '610'

EXCEPTIONS

window = 1

element = 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = hlp_element.

err_element-text = hlp_eletext.

COLLECT err_element.

ENDIF.

  • Hauptfenster, Element Abweichender Zahlungsemfänger

IF regud-xabwz EQ 'X'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '612'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '612'.

err_element-text = text_612.

COLLECT err_element.

ENDIF.

ENDIF.

  • Hauptfenster, Element Zahlung erfolgt im Auftrag von

IF reguh-absbu NE reguh-zbukr.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '613'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '613'.

err_element-text = text_613.

COLLECT err_element.

ENDIF.

ENDIF.

  • Hauptfenster, Element Unterschrift

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '614'

EXCEPTIONS

window = 1

element = 2.

  • Hauptfenster, Element Überschrift (nur auf der ersten Seite)

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '615'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '615'.

err_element-text = text_615.

COLLECT err_element.

ENDIF.

  • Hauptfenster, Element Überschrift (ab der zweiten Seite oben)

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '615'

type = 'TOP'

EXCEPTIONS

window = 1

element = 2. "Fehler bereits oben gemerkt

  • Hauptfenster, Element Übertrag (ab der zweiten Seite oben)

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '620'

type = 'TOP'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '620'.

err_element-text = text_620.

COLLECT err_element.

ENDIF.

ELSE.

  • HR-Formular ausgeben

  • write HR form

LOOP AT pform.

CHECK sy-tabix GT t042e-anzpo.

regud-txthr = pform-linda.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '625-HR'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '625-HR'.

err_element-text = text_625.

COLLECT err_element.

ENDIF.

ENDLOOP.

ENDIF.

  • Ausgabe der Einzelposten

flg_diff_bukrs = 0.

LOOP AT tab_regup.

AT NEW bukrs.

regup-bukrs = tab_regup-bukrs.

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.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '613'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '613'.

err_element-text = text_613.

COLLECT err_element.

ENDIF.

ENDIF.

ENDAT.

regup = tab_regup.

PERFORM einzelpostenfelder_fuellen.

IF hlp_xhrfo EQ space.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '625'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '625'.

err_element-text = text_625.

COLLECT err_element.

ENDIF.

ENDIF.

PERFORM summenfelder_fuellen.

IF hlp_xhrfo EQ space.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '625-TX'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

ENDIF.

ENDLOOP.

PERFORM ziffern_in_worten.

  • Summenfelder hochzählen und aufbereiten

ADD 1 TO cnt_avise.

ADD reguh-rbetr TO sum_abschluss.

WRITE:

cnt_avise TO regud-avise,

cnt_avedi TO regud-avedi,

sum_abschluss TO regud-summe CURRENCY t001-waers,

sum_abschl_edi TO regud-suedi CURRENCY t001-waers.

TRANSLATE:

regud-avise USING ' *',

regud-avedi USING ' *',

regud-summe USING ' *',

regud-suedi USING ' *'.

IF hlp_xhrfo EQ space.

  • Hauptfenster, Element Gesamtsumme (nur auf der letzten Seite)

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '630'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '630'.

err_element-text = text_630.

COLLECT err_element.

ENDIF.

  • Hauptfenster, Element Bankgebühr (Japan)

IF reguh-paygr+18(2) EQ '$J'.

WHILE reguh-paygr(1) EQ 0.

SHIFT reguh-paygr(10) LEFT.

IF sy-index > 10. EXIT. ENDIF.

ENDWHILE.

SUBTRACT reguh-rspe1 FROM: regud-swnet, sum_abschluss.

WRITE:

regud-swnet TO regud-swnes CURRENCY reguh-waers,

sum_abschluss TO regud-summe CURRENCY t001-waers.

TRANSLATE:

regud-swnes USING ' *',

regud-summe USING ' *'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '634'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042b-aforn.

err_element-fenst = 'MAIN'.

err_element-elemt = '634'.

err_element-text = text_634.

COLLECT err_element.

ENDIF.

ENDIF.

  • Fenster Carry Forward, Element Übertrag löschen

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'CARRYFWD'

element = '635'

function = 'DELETE'

EXCEPTIONS

window = 1

element = 2. "Fehler bereits oben gemerkt

  • Hauptfenster, Element Überschrift löschen

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '615'

type = 'TOP'

function = 'DELETE'

EXCEPTIONS

window = 1

element = 2. "Fehler bereits oben gemerkt

  • Hauptfenster, Element Übertrag löschen

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '620'

type = 'TOP'

function = 'DELETE'

EXCEPTIONS

window = 1

element = 2. "Fehler bereits oben gemerkt

  • Hauptfenster, Element Abschlußtext

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '631'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2. "Ausgabe ist freigestellt

  • Fenster Total, Element Gesamtsumme

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'TOTAL'

element = '630'

EXCEPTIONS

window = 1

element = 2. "Ausgabe ist freigestellt

ENDIF.

  • Formular beenden

CALL FUNCTION 'END_FORM'.

ENDIF.

ENDAT.

*-- Ende der Hausbank -

-


AT END OF reguh-ubnkl.

IF ( cnt_avise NE 0 "Formularabschluß erforderlich

OR cnt_avedi NE 0 ) AND hlp_laufk NE '*'.

SET COUNTRY space.

  • Liste aller Avis-Zwischenbelege ausgeben

IF cnt_avedi NE 0.

REFRESH tab_elements.

CALL FUNCTION 'READ_FORM_ELEMENTS'

TABLES

elements = tab_elements

EXCEPTIONS

OTHERS = 3.

READ TABLE tab_elements WITH KEY

window = 'MAIN'

element = '676'.

IF sy-subrc EQ 0.

CALL FUNCTION 'START_FORM'

EXPORTING

language = t001-spras

startpage = 'EDI'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '675'

type = 'TOP'

EXCEPTIONS

OTHERS = 4.

sic_reguh = reguh.

sic_regud = regud.

LOOP AT tab_edi_avis.

reguh = tab_edi_avis-reguh.

regud = tab_edi_avis-regud.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '676'

EXCEPTIONS

OTHERS = 4.

ENDLOOP.

CALL FUNCTION 'END_FORM'.

reguh = sic_reguh.

regud = sic_regud.

ENDIF.

ENDIF.

  • Formular für den Abschluß starten

CALL FUNCTION 'START_FORM'

EXPORTING

language = t001-spras

startpage = 'LAST'.

  • Ausgabe des Formularabschlusses

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'SUMMARY'

EXCEPTIONS

window = 1.

IF sy-subrc EQ 1.

err_element-fname = t042b-aforn.

err_element-fenst = 'SUMMARY'.

err_element-elemt = space.

err_element-text = space.

COLLECT err_element.

ENDIF.

  • Formular beenden

CALL FUNCTION 'END_FORM'.

ENDIF.

ENDAT.

*-- Ende des Zahlwegs -

-


AT END OF reguh-rzawe.

  • Abschluß des Formulars

CALL FUNCTION 'CLOSE_FORM'

IMPORTING

RESULT = itcpp.

**************************BEGIN OF PBA01******************************

  • If a vendor email address exists, will call function *

  • ZFI_EMAILREMITFROMSPOOL to send remittance advice, else will include *

  • the spool number in the list for printing. *

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

IF g_emailadd NE SPACE.

v_spoolid = itcpp-tdspoolid.

CALL FUNCTION 'ZFI_EMAILREMITFROMSPOOL'

EXPORTING

I_SPOOLID = v_spoolid

I_RECIPIENT = g_emailadd

I_REGUH = reguh

EXCEPTIONS

FAILED_TO_CONVERT_TO_PDF = 1

OTHERS = 2.

*--- Delete Spool from list to distinguish from RA's for printing

CLEAR wa_spoolreq.

wa_spoolreq-rqident = v_spoolid.

CALL FUNCTION 'RSPO_IDELETE_SPOOLREQ'

EXPORTING

SPOOLREQ = wa_spoolreq

EXCEPTIONS

ERROR = 1

OTHERS = 2.

ELSE.

IF itcpp-tdspoolid NE 0.

CLEAR tab_ausgabe.

tab_ausgabe-name = t042z-text1.

tab_ausgabe-dataset = itcpp-tddataset.

tab_ausgabe-spoolnr = itcpp-tdspoolid.

COLLECT tab_ausgabe.

  • Next line added. " PE001

SET PARAMETER ID 'ZSP' FIELD tab_ausgabe-spoolnr. " PE001

ENDIF.

ENDIF.

***************************END OF PBA01*******************************

ENDAT.

ENDLOOP.

ENDFORM. "Avis[/code]

Former Member
Not what you were looking for? View more on this topic or Ask a question