Application Development and Automation 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: 
Read only

Help SMARTFORMS creating multiple pages with different material records

jeff_broodwar
Active Participant
0 Likes
9,461

Hi Abapers,

I have a new requirement where I need to print a form depending on the number of inputted records, example:

input 10 records to be retrieved from table MAKT..displaying matnr and maktx

output should be:

Page 1.           1          Coke light

Page 2.          2          Pepsi

Page 3.           3          Mirinda

Page 4.           4          Sarsi

.

.

.

Page 10          10         RC

Please let me know what approach should be done to achieve this. print preview should have 10 pages but different records per page.

Thank you in advance.

Thanks,

Jeffbroodwar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
7,660

Hey Jeff,

I can see the attachment....

I am putting it again.

Hi Abapers,

I have a new requirement where I need to print a form depending on the number of inputted records, example:

input 10 records to be retrieved from table MAKT..displaying matnr and maktx

output should be:

Page 1.           1          Coke light

Page 2.          2          Pepsi

Page 3.           3          Mirinda

Page 4.           4          Sarsi

.

.

.

Page 10          10         RC

Please let me know what approach should be done to achieve this. print preview should have 10 pages but different records per page.

Thank you in advance.

Thanks,

Jeffbroodwar

23 REPLIES 23
Read only

former_member259807
Active Participant
Read only

pavanm592
Contributor
0 Likes
7,660

Hello,

As per my understanding you can do it multiple ways,

-> By using  B. Wallagh suggested link OR

-> Make the Main window size in such a way that only one record should be fixed and make

    Next page as same First Page(PAGE1) ,So that the number of pages will contain unique record.

Regards,

Pavan

Read only

Former Member
0 Likes
7,660

Hello,

First u have  to Create a LOOP and  Mark the GO TO NEXT PAGE and give the page in which the data should go.

Regards,

Ashwini

Read only

VijayaKrishnaG
Active Contributor
0 Likes
7,660

Hi Jeff,

You can use Smartform events on the table that containing material records. In that events call new page using "Command", so that for every new material record new page will be triggered and remaining data in the page will be printed normally.

Thanks & Regards,

-Vijay

Read only

jeff_broodwar
Active Participant
0 Likes
7,660

Hi, thanks for the inputs, I tried the suggestion of B. Wallagh but got only the last record... I would like to get many pages containing different CARRID per page..

Thanks!

Jeffbroodwar

Read only

jeff_broodwar
Active Participant
0 Likes
7,660

Please see form used and let me know how to achieve the requirement...

Thanks in advance.

Jeffbroodwar

Read only

Former Member
0 Likes
7,660

Hi Jeff,

I saw your form and their you used the command and also a condition.

it will work fine if you change the condition.

Just remove the code section and in the command, put the condition as

With this, for the first record page break will not be triggered, but for all other records Page-Break would trigger and all the records would come in next page.

Regards,

Sumit

Read only

0 Likes
7,659

I just followed the instruction in the link...and if I remove the code in the code section, how will I get the records? code selects records from sflight table...

Thanks,
Jeffbroodwar

Read only

0 Likes
7,659

Followed as instructed, removed code node but still getting the last record only and only 1 page...table contains 30 records, I'm expecting 30 pages each having unique carrid values.... hope you can help me guys...

Thanks,

Jeffbroodwar

Read only

0 Likes
7,659

Did you put the conditions as sy-tabix ne 1 in the command?????

Read only

0 Likes
7,659

Hi Jeff,

I found the solution of the problem. I tried to show 5 entries and they came in 5 different pages.

Instead of Loop use Table in the main window of the Tflight.

By this I can see that I am getting 5 pages for 5 entries. Your problem would then be solved.

Read only

0 Likes
7,659

Hi Sumit Sharma,

I tried the same but I don't get anything... can you please attache the form you used?

Thanks

Jeffbroodwar

Read only

0 Likes
7,659

Hi Jeff,

I am unable to upload the XML form. Kindly guide me how to upload that form on SCN.

Read only

0 Likes
7,659

Try this,

data: wa_control type ssfctrlop.

data: wa_output_options     type ssfcompop.

form sub_process_print .

  wa_output_options-tdimmed = 'X'.

  wa_output_options-tddest   = 'LOCL'.

  wa_control-no_open   = 'X'.

  wa_control-no_close  = 'X'.

  wa_control-no_dialog = ' '.

  wa_control-preview   = ' '.

  gv_count = gv_count + 1.

  if gv_count = 1.

    wa_control-no_dialog = ' '.

  elseif gv_count > 1.

    wa_control-no_dialog = 'X'.

  endif.

  if gv_count = 1.

    call function 'SSF_OPEN'

      exporting

        control_parameters = wa_control

        output_options     = wa_output_options

        user_settings      = space

      exceptions

        formatting_error   = 1

        internal_error     = 2

        send_error         = 3

        user_canceled      = 4

        others             = 5.

    if sy-subrc <> 0.

      message id sy-msgid type sy-msgty number sy-msgno

              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      exit.

    endif.

  endif.

  if wa_final is not initial.

    call function gv_fm_nam

      exporting

*       ARCHIVE_INDEX              =

*       ARCHIVE_INDEX_TAB          =

*       ARCHIVE_PARAMETERS         =

       control_parameters         = wa_control

*       MAIL_APPL_OBJ              =

*       MAIL_RECIPIENT             =

*       MAIL_SENDER                =

       output_options             = wa_output_options

       user_settings              = ' '

        wa_final                   = wa_final

*     IMPORTING

*       DOCUMENT_OUTPUT_INFO       =

*       JOB_OUTPUT_INFO            =

*       JOB_OUTPUT_OPTIONS         =

     exceptions

       formatting_error           = 1

       internal_error             = 2

       send_error                 = 3

       user_canceled              = 4

       others                     = 5

              .

  if gv_count eq gv_lines.

    call function 'SSF_CLOSE'

      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.

  endif.

endform.                    " F_PROCESS_PRINT

*&---------------------------------------------------------------------*

*&      Form  SUB_PRINT_LETTER

*&---------------------------------------------------------------------*

*       text

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

*  -->  p1        text

*  <--  p2        text

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

form sub_print_letter .

gv_lines = lines( it_final ) .

  call function 'SSF_FUNCTION_MODULE_NAME'

    exporting

      formname = 'smartform_name'

    importing

      fm_name  = gv_fm_nam.

  loop at it_final into wa_final .

    perform sub_process_print .

  endloop .

endform.

Read only

0 Likes
7,659

Do not use the reply to specific person, use the REPLY TO ORIGINAL POST at the bottom of the thread then use the link advanced controls, there you will see the attach files option on the new page that will be generated.

Thanks,

Jeffbroodwar

Read only

Former Member
0 Likes
7,659

Dear jeff,

I think you can go for another way to call smartform within loop passing different work area value and design the form accordingly.

with regards

vikas pandey

Read only

Former Member
0 Likes
7,659

Hi Jeff,

Here is the form which i used to get 5 pages for 5 entries.

Read only

0 Likes
7,659

I don't see any attachments...

Read only

0 Likes
7,659

I have put it again...

If you didn't get it yet...Please share your E-mail ID I will send the attachment to you.

Read only

Former Member
0 Likes
7,659

Dear Jeff,

With the help of a global variable for storing the previous Material No, and a Command in the smartform for checking whether the current Material No is equal to or not equal to the previous assigned Material No. If the Material differs from the previous one, then in the Command give the next Page.

This way you can display different Material details in different page. Use Code for assigning previous Material No and Command for checking and moving to next Page.

Thanks and Regards,

Rinzy Deena Mathews

Applexus Technologies (P) Ltd.

Read only

Former Member
0 Likes
7,661

Hey Jeff,

I can see the attachment....

I am putting it again.

Read only

jeff_broodwar
Active Participant
0 Likes
7,659

Thanks for all who contributed, I guess the problem is that I forgot to remove the logic in the condition tab of the table node, this results to only one page being displayed. I now know how to use the command node to achieve this requirement.

Thanks,
Jeffbroodwar

Read only

Former Member
0 Likes
7,659

Thank you Sumit Sharma , your smartform really helpful