Skip to Content

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

Page Break Problem in Smartforms.

Hi Devolopers,

I have a Smartform with 1 page which print the FI Voucher for only one document. Now the End User wants to Print Multiple Vouchers (document Number 0001-0005) with each Document should print in Separate Page. I have changed the PARAMETERS option to SELECT-OPTIONS in my Driver Program. Now ALL the Documents are Printing in One Smartform.

How can break the pages? so that each Document will print in separate pages.

My Driver Program code Below.

TABLES : BKPF,

BSEG,

ZFI_BSEG.

TYPES : BEGIN OF TY_BKPF,

BUKRS TYPE BKPF-BUKRS,

BELNR TYPE BKPF-BELNR,

GJAHR TYPE BKPF-GJAHR,

BUDAT TYPE BKPF-BUDAT,

XBLNR TYPE BKPF-XBLNR,

BKTXT TYPE BKPF-BKTXT,

BLART TYPE BKPF-BLART,

END OF TY_BKPF.

DATA : IT_BKPF TYPE TABLE OF TY_BKPF WITH HEADER LINE,

IT_BSEG TYPE TABLE OF ZFI_BSEG.

DATA : WA_BKPF LIKE LINE OF IT_BKPF,

WA_BSEG LIKE LINE OF IT_BSEG.

DATA : WRK_KTOPL TYPE T001-KTOPL,

WRK_FRMNAME TYPE RS38L_FNAM.

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

SELECT-OPTIONS : PA_BELNR FOR BKPF-BELNR.

PARAMETERS :

PA_BUKRS TYPE BKPF-BUKRS,

PA_GJAHR TYPE BKPF-GJAHR.

SELECTION-SCREEN END OF BLOCK B1.

PERFORM DATA_SELECTION.

FORM DATA_SELECTION .

SELECT BUKRS

BELNR

GJAHR

BUDAT

XBLNR

BKTXT

BLART

FROM BKPF

INTO CORRESPONDING FIELDS OF TABLE IT_BKPF

WHERE BUKRS = PA_BUKRS

AND BELNR IN PA_BELNR

AND GJAHR = PA_GJAHR.

LOOP AT IT_BKPF.

IF IT_BKPF IS NOT INITIAL.

SELECT BUKRS

BELNR

GJAHR

BUZEI

BSCHL

SHKZG

DMBTR

HKONT

SGTXT

LIFNR

KUNNR

AUGBL

AUGGJ

FROM BSEG

INTO CORRESPONDING FIELDS OF TABLE IT_BSEG

WHERE BELNR = IT_BKPF-BELNR

AND BUKRS = IT_BKPF-BUKRS

AND GJAHR = IT_BKPF-GJAHR.

ENDIF.

SELECT SINGLE KTOPL

FROM T001

INTO WRK_KTOPL

WHERE BUKRS = PA_BUKRS.

LOOP AT IT_BSEG INTO WA_BSEG.

SELECT SINGLE SAKNR

TXT50

FROM SKAT

INTO (WA_BSEG-SAKNR,WA_BSEG-TXT50)

WHERE SAKNR = WA_BSEG-HKONT

AND KTOPL = WRK_KTOPL.

MODIFY IT_BSEG FROM WA_BSEG INDEX SY-TABIX TRANSPORTING SAKNR

TXT50.

ENDLOOP.

SORT IT_BSEG BY SHKZG DESCENDING.

PERFORM CALL_SMARTFORM.

CLEAR : WRK_KTOPL , WA_BSEG.

FREE : IT_BSEG .

ENDLOOP.

ENDFORM. " data_selection

FORM CALL_SMARTFORM .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZFI_VOUCHER'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = WRK_FRMNAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

IF SY-SUBRC 0.

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

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

ENDIF.

IF WRK_FRMNAME IS NOT INITIAL.

CALL FUNCTION WRK_FRMNAME

  • EXPORTING

  • HEADER_DATA = IT_BKPF

TABLES

ITEM_DATA = IT_BSEG

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELLED = 4

OTHERS = 5.

ENDIF.

ENDFORM. " call_smartform

Former Member
Former Member replied

Hi ,

As per your post it_bseg data is not properly fetchin or Not passing to your form .

In the form(layout ) what data your ging to printing .

See the below code Assume that it_bkpf having 10 rec - your O/P willl be 10 pages

here it_bseg will 10 or more that 10 records (Assume it as it_bseg will 100 record .means each page will be 10 records)

LOOP AT it_bkpf INTO wa_bkpf.

CALL FUNCTION SFM_NAME

EXPORTING

CONTROL_PARAMETERS = gs_con_settings

wa_bkpf = wa_bkpf

TABLES

it_bseg = it_bseg.

CLEAR : wa_bkpf.

ENDLOOP.

In the form your are going to print it_bseg data by using table node

in TABLE node data = it_bseg into wa_bseg

in condition tab belnr EQ wa_bkpf-belnr (Put this condition )

Hope u will resolve your issue ... chekc my businesscard.

Let me know if any concerns....

Regards .

1 View this answer in context

Helpful Answer

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