Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 24, 2010 at 02:17 PM

    Hi Bibhu,

    Try the following code

    DATA : gs_con_settings TYPE SSFCTRLOP.

    gs_con_settings-NO_OPEN = 'X'.

    gs_con_settings-NO_CLOSE = 'X'.

    CALL FUNCTION 'SSF_OPEN'

    EXPORTING

    CONTROL_PARAMETERS = gs_con_settings .

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

    FORMNAME = SF_NAME " For zztest_sform1

    IMPORTING

    FM_NAME = SFM_NAME .

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    LOOP AT IT_BKPF.

    PERFORM fetch_BSEG USING IT_BKPF-BELNR IT_BKPF-BUKRS IT_BKPF-GJAHR.

    CALL FUNCTION SFM_NAME

    EXPORTING

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

    CONTROL_PARAMETERS = gs_con_settings

    TABLES

    it_bseg = it_bseg.

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    ENDIF.

    CLEAR it_bkpf.

    REFRESH it_bseg.

    ENDLOOP. "it_bkpf

    CALL FUNCTION 'SSF_CLOSE'

    • IMPORTING

    • JOB_OUTPUT_INFO =

    • EXCEPTIONS

    • FORMATTING_ERROR = 1

    • INTERNAL_ERROR = 2

    • SEND_ERROR = 3

    • OTHERS = 4

    .

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    Try the above code

    Let me know if you any concerns.........

    Regards ,

    Lokesh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Thanks Lokesh, Thanks Karthik.

      Thanks for your Support. The issue is Resolved. I am closing the issue. Hoping great support from you in future.

      Regards,

      Bibhu

  • avatar image
    Former Member
    Jun 24, 2010 at 08:56 AM

    Hi..

    To print each Accounting Document in separate pages, you can follow the following steps:

    1. In TABLE node, DATA tab, enter the field name (BELNR probably) based on which new page should be triggered and check on 'Event on Sort Begin'.

    2. An event will be created between the header and Main Area in the Smartform Table.

    3. In the node Event, Create-> Flow Logic ->Command.

    4. In the command node, check on goto new page and give the same page as New Page.

    This will print each Accnt. Doc on separate page. If the first prints without any entry, then you can put some condition such that blank is not printed.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Thanks Karthik, Thanks Lokesh

      Thanks for your Support. The issue is Resolved. I am closing the issue. Hoping great support from you in future.

      Regards,

      Bibhu