Sie sind auf Seite 1von 9

9/5/2018 SAPTech

SAPTech

- May 17, 2016

     How to create Page break in smart


form? 
Page break : In some cases user wants speci c number
of records per page . we can restrict it manually using
user COMMAND. 

Steps:
 Step 1.  GOTO  Tcode SMARTFORMS and give your Smart form
name .  

Step 2. Give proper description and save it in Local object or any


package .

Step 3.  Go to Form Interface -> table give internal table name. in my
bl h l
https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 1/9
9/5/2018 SAPTech
previous blog ,i have explain 
how to create structure and Table Type. for your reference click on
this .-> Structure and Table type 

I am using same structure and Table type .

Step 4. Under Global De nition  declare your variable and for


command we are taking two extra variable . Like this ->

Step 5. Go on your window right click there and create table .

https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 2/9
9/5/2018 SAPTech

Step 6. After creating table ,create line type . I have already discuss in
my previous Blog . For more you can go ->  Basic smart forms

Step 7. Create 4 column in your line type . In header every column


create Text 
text1 ->  SL NO
text2-> material number
text3->Created on
text4-> Name of person

Step 7. Create 4 text in main Area also and give all eld name.
      text5-> &gv_no&
      text6-> &matnr&
      text7->  &ersad&
      text8-> &ernam&
Step 8.  Right click on Main Window and copy and paste , to create
new page ,page2
Step 9 . Right click on main area create-> ow logic->loop
Step 10. Again right click on Loop-> create-> ow logic ->command
Step 11.  On command go to General Attributes and give page name
as page 2

Step 12.  On condition Window give condition like GV_FLAG = 'X'.

Step 13. Go on cell 5 in main area, right click and create command
and right there code for page break.

https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 3/9
9/5/2018 SAPTech

gv_no = gv_no + 1.
DATA: lv_no type i.
lv_no = gv_no mod 10.
IF lv_no = 0.
   gv_ aG = 'X'.
ELSE.
  gv_ aG = ''.
ENDIF.

Step 14. Save & activate , get function module name , environment->
function module name.

Step 15. Now Create Driver program Zdemo_pagebreak using tcode


se38

*&---------------------------------------------------------------------*
*& Report  ZDEMO_PAGEBREAK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZDEMO_PAGEBREAK.
TABLES MARA.
DATA: T_MARA TYPE ZTDEMO_STRUCT_MARA.
DATA: LV_FNAME TYPE TDSFNAME VALUE 'ZDEMO_PAGEBREAK',
      LV_FMNAME TYPE RS38L_FNAM .

SELECT
  MATNR
ERSDA
ERNAM
   FROM MARA INTO TABLE T_MARA UP TO 40 ROWS.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 4/9
9/5/2018 SAPTech

      FORMNAME                 = LV_FNAME
*     VARIANT                  = ' '
*     DIRECT_CALL              = ' '
   IMPORTING
     FM_NAME                  = LV_FMNAME
*   EXCEPTIONS
*     NO_FORM                  = 1
*     NO_FUNCTION_MODULE       = 2
*     OTHERS                   = 3
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

 CALL FUNCTION LV_FMNAME
*  EXPORTING
*    ARCHIVE_INDEX              =
*    ARCHIVE_INDEX_TAB          =
*    ARCHIVE_PARAMETERS         =
*    CONTROL_PARAMETERS         =
*    MAIL_APPL_OBJ              =
*    MAIL_RECIPIENT             =
*    MAIL_SENDER                =
*    OUTPUT_OPTIONS             =
*    USER_SETTINGS              = 'X'
*  IMPORTING
*    DOCUMENT_OUTPUT_INFO       =
*    JOB_OUTPUT_INFO            =
*    JOB_OUTPUT_OPTIONS         =
   TABLES
     T_MARA                     = T_MARA
*  EXCEPTIONS
*    FORMATTING_ERROR           = 1
*    INTERNAL_ERROR             = 2
*    SEND_ERROR                 = 3
*    USER_CANCELED              = 4
*    OTHERS                     = 5
           .
 IF SY-SUBRC <> 0.
* Implement suitable error handling here
 ENDIF.

Step 16. For calling your function module go to pattern -> click on call
function and give your function module name
https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 5/9
9/5/2018 SAPTech
function and give your function module name.
Step 17 . Save and activate and execute it.

Here i have added page number  also so for this we need to create
extra window in page 1.
right click on page 1 and create new window .  For window size give
length and width like this .

Step 18. In that window create text and in text put value
pages &sfsy-page& of &sfsy-formpages& 

Save and activate it .


Execute your driver program 
Output should be like this :
page 1:

https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 6/9
9/5/2018 SAPTech

Page 2.

In bottom of every pages page number will come ... like this.

Thank you
Please share your opinion :) 

Imjerry@07 2 May 2018 at 23:10

In my smartforms using page preview, one blank line


coming.
How to remove that one?

REPLY

Enter your comment...

https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 7/9
9/5/2018 SAPTech

Popular posts from this blog

Persistence Class In ABAP


- April 02, 2017

Persistence Service: By default the lifetime and


scope of the object is within the program where it
is declared i.e. once the control comes out of the …

READ MORE

How To Upload a excel / txt File Usin ABAP OOPs?


- December 21, 2016

1. Goto SE38 . 2. Give Program


name zdemo_class_upload And click on create. 3.
Give description and make it as executable  4. Now…

READ MORE

TOP OF PAGE in OOPS ALV


- May 25, 2017

REPORT zdemo_repo_oops.
PARAMETERS: p_matnr TYPE mara-matnr.
TYPES: BEGIN OF type_mara, …

READ MORE

Powered by Blogger

Theme images by Galeries

https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 8/9
9/5/2018 SAPTech

SUPRIYA SHAH

Follow 38

VISIT PROFILE

Archive

Report Abuse

https://mysapnuts.blogspot.com/2016/05/to-create-page-break-in-smart-form-page.html 9/9

Das könnte Ihnen auch gefallen