Using Final window in Smartforms

WRITTEN BY: supportmymoto.com STAFF

For these individuals who haven’t tried the Closing window in Smartforms then learn on…

As you might be conscious, there are 4 several types of home windows obtainable from SAP Foundation launch 6.10. They’re Principal, Secondary, Closing and Copies. Lately I acquired an opportunity to make use of the ‘Closing’ window kind in Smartforms. Someday again I had posted a question within the ABAP discussion board for a requirement (which is described right here) however didn’t obtain any reply. Later I discovered a means and thought I can share it right here.

Let me clarify the properties and use of the ‘Closing’ window on this session.

The home windows are processed from prime to backside as given within the Smartforms builder navigation tree.

image

So the execution first skips all of the Closing home windows and completes the processing of different home windows. As soon as all of the non ultimate home windows are processed, the Closing home windows are processed from prime to backside. For instance if you want to have the whole worth of all of the objects on the primary web page however the worth of that is identified solely on the finish of the shape processing, we will use the Closing window for displaying the whole worth. The sum of line objects is calculated within the MAIN window.

Lately I obtained the next requirement to provide an output for displaying objects from the cargo. These things are from a number of supply paperwork and every supply is related to a ship-to-party. Each time the ship-to-party modifications a web page break is required and the web page quantity ought to reset. For instance, if the primary ship-to-party has two pages the web page quantity can be ‘Web page 1 of two’ and ‘Web page 2 of two’. Now for the following ship-to-party the web page quantity once more begins from 1 and the whole variety of pages can be for that specific ship-to-party.

See also  Career Path of SAP Consultant

image

This can’t be achieved utilizing the conventional technique. i.e. utilizing the SFSY construction (SFSY-FORMPAGES and SFSY-PAGE). In our instance as a result of the whole variety of pages for a selected ship-to-party is calculated solely after the processing of all its pages are accomplished. For such instances the ‘Closing home windows’ could be useful.

The logic I’ve adopted captures the web page numbers for every ship-to-party after which makes use of the ultimate window ‘PAGE’ to show that.

Step-1 (Make the window as a ultimate window)

Double click on on the window and within the ‘Common Attributes’ tab choose window kind as ‘Closing Window’.

image

Be aware that after getting chosen as ultimate window, the icon modifications.

Step-2 (Seize the pages for every ship to celebration)

Within the Principal window I’m utilizing the LOOP node to loop via every ship-to-party and the TABLE node to loop via the road objects of every chosen ship-to-party from the LOOP node. It’s because specific web page break utilizing the ‘Command’ node can’t be known as inside TABLE.

Within the International settings

Sort

 TYPES: BEGIN OF t_pagest,
                pagefr(3),
                pageto(3),
             END   OF t_pagest.

TYPES: t_pages TYPE STANDARD TABLE OF t_pagest WITH DEFAULT KEY.

International Knowledge

image

A code is written slightly below the LOOP node to seize the web page numbers for the ship to celebration.

image

The code for this program line node (GET_PAGE_NO) is given under and can seize pages for all of the ship-to-parties besides the final one. Capturing pages for the ultimate ship-to-party is defined in Step-3. The under code won’t work for the primary ship-to-party (IF sfsy-formpages > 1) and can begin from the second SHP.

See also  Is Walmart Jewelry Real In 2021? (Gold, Diamonds + More)

DATA: wa_pageno(3),
           wa_pagecnt(3).

* This code begins working from web page 2 onwards
IF sfsy-formpages > 1.

  wa_pageno  = sfsy-formpages – wa_lastpage.
  wa_pagecnt = 1.

  DO wa_pageno TIMES.
    wa_pages-pagefr = wa_pagecnt.
    wa_pages-pageto = wa_pageno.
    wa_pagecnt      = wa_pagecnt + 1.
    APPEND wa_pages TO wt_pages.
  ENDDO.

ENDIF.

wa_lastpage = sfsy-formpages.

Step-3 (Seize the pages for ultimate ship to celebration and format web page numbers)

Now we’ve got another program line node within the ultimate window ‘PAGE’ and that is simply earlier than the web page output. Capturing pages for ultimate ship-to-party is coded right here as a result of that’s the ultimate document within the LOOP_SHP and this system line node GET_PAGE_NO won’t be executed.

image

Code for ‘PRINT_PAGE’ is as follows.

DATA: wa_page(3),
          wa_pagecnt(3).

IF ws_once = ‘X’.
* One time for final web page
  wa_page    = sfsy-formpages – wa_lastpage + 1.
  wa_pagecnt = 1.

  DO wa_page TIMES.
    wa_pages-pagefr = wa_pagecnt.
    wa_pages-pageto = wa_page.
    wa_pagecnt      = wa_pagecnt + 1.
    APPEND wa_pages TO wt_pages.
  ENDDO.

  CLEAR ws_once.
ENDIF.

*Format Web page Numbers
CLEAR wa_pages.
READ TABLE wt_pages INTO wa_pages INDEX 1.
IF sy-subrc = 0.
  CONDENSE: wa_pages-pagefr,
            wa_pages-pageto.

  CONCATENATE ‘Web page’ wa_pages-pagefr ‘of’ wa_pages-pageto
                     INTO wa_pageno SEPARATED BY house.
  DELETE wt_pages INDEX 1.
ENDIF.

Step-4 (Show Formatted Pages)

Within the textual content node ‘PAGE’ I’ve given the next.

&WA_PAGENO(C)&

For variations previous to Foundation 6.10

The above won’t work if you’re on 4.6C or 4.6D model. However there’s a work round urged by SAP to perform the identical. However the assist bundle stage have to be on SAPKB46C12 for 4.6C and SAPKB46D04 for 4.6D. That is described within the OSS word 359009.

See also  How to Pick the Right Cricket Helmets?

As a way to obtain late (Closing) processing of home windows do the next.

  • Create a secondary window that you just need to course of like FINAL window.
  • Now on the primary web page create one other secondary window as the primary node. On this create a program line node and name the next subroutine for each window that you just need to behave as a Closing window.

          PERFORM set_late_window IN PROGRAM saplstxbc USING ‘FNL_WINDOW’
                                                                                        CHANGING l_subrc.

          ‘FNL_WINDOW’ is the identify of the window. In case you have a number of home windows, it’s a must to name the subroutine for all of the home windows.

NOTE : Please do not copy - https://supportmymoto.com

Leave a Reply