Page break,sub total and grand total  in adobe forms

hi,
In adobe forms, i am displaying purchase order details in table format. internal table contains 150 records but it displaying
only 50 records in single page. how i have to call a new page,how i have to create a page preak and i want to display only
5 records for a page with carry forward,page total and total net value.

Hi Sivaprasath,
For the table content to flow onto the next pages please make sure that the outermost subform is NOT with the content property "Positioned".
For having only 5 records per page, you can design a deep structure with fields:
Table 1 (The table which will hold 5 records per page)
Page total
total net value
Have the table type of it defined in the form.
Put the logic for filling the table in such a way that each row of this nested table has 5 records and pagetotal and total net value.
then put it inside a subform and check the checkbox for "rpeat subformt for each data item".
Another way is to use Conditional breaks in Pagination tab.
Thanks and regards,
Priyanka

Similar Messages

  • Sub totals in ADOBE Forms

    Hi i have a requirement where i have to do total for a group of records based on the order number which are displayed in the table.
    Could you sugest how do i go ahead, as i have written the code for Sub total and it works extremely fine but the problem is that i have used the text fields in the table format and it works but the problem is that the heading keeps on getting repeated for each record which i dont need.
    So to aviod this i took a table but this does not support the sub totals.
    Could you please suggest a way to acheive this.
    Thanks
    Phani Kumar P

    Hi!
    make the grandtotal fielf in the layout and it should be in a one subform.
    click in the field for which the grandtotal is there and then up where you can see different options like EDIT,VIEW like that BELOW THERE YOU CAN SEE :  SHOW  and a list box displaying events select Events with Scripts click on language as java script and RUN AT client
    and add the java script code there
    sum(data.Table1.Group1.Row1[].PRICE[])
    this will give the grandtotal as well.
    Try it will work.
    Regards.

  • Page Totals in Adobe Form

    Hi
    Need some help in Page totals in Adobe forms
    I am having a table which flows into several pages .
    I need to display the Total of a column at the end of every Page .
    How can i achieve that .
    I have tried the Script wih the pageContent method it is not working .i have also tried the sum method but it gives the grand total not the page total
    Since we can not know at what record in the table page break can occur, i can not add in the back end program . It has to be done dynamically .
    Please help me .
    Thanks
    Ramakanth

    Hi
    Thanks Andres
    I am now able to do the Sub Totals , but i am facing a new problem
    My Requirement is
    I have a table in my Design page
    If the data in my table flows for more than one page then
    1) I should show at page end sub total of Net Amount column in the table
    2) The same Amount should be shown in the starting of the Second Page after which the table contents should flow
    3) At the end of Page 2 i should again display the total amount which is addition of total from previous page and sum of all items in page 2 .
    Example
    Page 1
    Documentnumber currecy Amount
    1                             USD      100
    2                             USD      200
    3                             USD      300
    Balance CarryFwd              600
    Page 2
    Balance Carryfwd              600
    4                           USD       1000
    5                           USD       2000
    6                           USD       3000
    Balance Carryfwd              6600
    Page 3
    Balance Carry fwd            6600
    ..... and so on
    I have tried to use the Overflow leader and Trailer to get this functionality but in that case only texts are being displayed
    not the Values .
    I have tried to create the BalanceCarryfwd form in Master page but the sub totals are not comin up there .
    How can i implement this logic , Please help me in this .
    Thanks
    Ramakanth

  • Caculating page wise sub totals and totals

    Friends,
    I am working on an ADOBE form,  where i need to calculate subtotals and grand totals for the invoice lines displayed.
    I achieved the functionality in the smartforms by defining a different window under the main window(this contains line amounts). For the new window where the subtotal is expected to print i triggerred the event 'Before the end of main window' to print the totals before the lines flow to the next page by auto page break in the main window.
    I tried in the forms putting different content area(other than the main content area where table lines are printed) for the subtotals in the layout designer and manipulated using all the pagination options avialable in the table properties, but in vain. 
    What exatly is the equivalent for the event 'Before the end of main window' as that of smart forms.
    Any inputs on this?
    regards
    Nalinikanth.

    Hi Nalinikanth,
    assumed you have a table created with subforms like
    MyTable
    - Header
      (text elements)
    - Data
      (repeating subform with line elements)
    you can create a line with subtotal as following:
    1. Define a new line below "MyTable" for the subtotals with name e.g. "Subtotals" and insert elements (similar to the ones in "Data").
    2. In subform "Data": palette Object -> Pagination -> Overflow Trailer: "Subtotals"
    3. In Hierarchy palette, right-click on "Subtotals" -> Insert Script Object
    4. name this script object "tableCalcs" and insert following code
    *   Table Calculation Functions
    *     To invoke these functions:
    *   syntax:     scriptObjectSOM.obj.functionName(sFieldName, [startPage], [endPage]);
    *   example:     tableCalcs.Sum("Field1", 2, 3);
    *   notes:           
    *                    -The SOM expression of the Script Object may vary upon its position in the Hierarchy.
    *                    -The start and end page arguments are 0-based numbers or a reference to an XFA object.
    DO NOT MODIFY THE CODE BEYOND THIS POINT - 705.20051114114126.253659.250577 - tableCalcs.xfo
    var obj = new CalcObject();
    function CalcObject()
         this.Sum = _doSum;
         this.Average = _doAverage;
         this.Count = _doCount;
    *     Calculate the sum of all fields with the same name.
    *      NUMBER Sum(STRING sFieldName, [NUMBER pageNum])
    *      NUMBER Sum(STRING sFieldName, [OBJECT xfaObject])
    *      NUMBER Sum(STRING sFieldName, [NUMBER startPage], [NUMBER endPage])
    *      NUMBER Sum(STRING sFieldName, [OBJECT xfaObject], [OBJECT xfaObject])
    *     param1:     STRING; Name of field to calculate sum of
    *     param2:     NUMBER; Start page for calculation
    *     param2:     OBJECT; XFA object on the page calculation will start on
    *     param3:     NUMBER; End page for calculation
    *     param3:     OBJECT; XFA object on the page calculation will end on
    *     return: NUMBER; Sum of all fields
    function _doSum(fieldName)
         var fieldSum = null;
         var startPage = 0;
         var endPage = 0;
         var lengthOfDecimal = 0;
         if (arguments.length == 2) {
              startPage = _GetPageNum(arguments[1]);
              endPage = startPage;
         } else if (arguments.length == 3){
              startPage = _GetPageNum(arguments[1]);
              endPage = _GetPageNum(arguments[2]);
         } else {
              startPage = 0;
              endPage = xfa.layout.pageCount() - 1;
         if ((startPage < 0) || (endPage < 0) || (startPage > endPage))
              throw new PageNumberException(startPage, endPage);
         var curPage = startPage;
         while (curPage <= endPage) {
              // Get the field containers on the current page
              var oFields = xfa.layout.pageContent(curPage, "field");
              var fieldCount = oFields.length;
              // Continue if fields were found on the page
              if (fieldCount > 0) {
                   var i = 0;
                   for (i=0; i < fieldCount; i++) {
                        if (oFields.item(i).name == fieldName) {
                             //only count non-empty/numeric fields
                             var fieldVal = _GetFieldVal(oFields.item(i));
                             if (fieldVal != null) {                         
                                  fieldSum += fieldVal;
                             if (_GetLengthOfField(oFields.item(i)) > lengthOfDecimal) {
                                  lengthOfDecimal = _GetLengthOfField(oFields.item(i));
              curPage++;
         if (fieldSum == null)
              throw new FieldNotFoundException(fieldName);
         if(lengthOfDecimal > 0) {
              return fieldSum.toFixed(lengthOfDecimal);
         return fieldSum;
    *     Calculate the average of all fields with the same name.
    *      NUMBER Average(STRING sFieldName, [NUMBER pageNum])
    *      NUMBER Average(STRING sFieldName, [OBJECT xfaObject])
    *      NUMBER Average(STRING sFieldName, [NUMBER startPage], [NUMBER endPage])
    *      NUMBER Average(STRING sFieldName, [OBJECT xfaObject], [OBJECT xfaObject])
    *     param1:     STRING; Name of field to calculate average of
    *     param2:     NUMBER; Start page for calculation
    *     param2:     OBJECT; XFA object on the page calculation will start on
    *     param3:     NUMBER; End page for calculation
    *     param3:     OBJECT; XFA object on the page calculation will end on
    *     return: NUMBER; Average of all fields
    function _doAverage(fieldName)
         var fieldCount = null;
         var fieldSum = null;
         var startPage = 0;
         var endPage = 0;
         var lengthOfDecimal = 0;
         if (arguments.length == 2) {
              startPage = _GetPageNum(arguments[1]);
              endPage = startPage;
         } else if (arguments.length == 3){
              startPage = _GetPageNum(arguments[1]);
              endPage = _GetPageNum(arguments[2]);
         } else {
              startPage = 0;
              endPage = xfa.layout.pageCount() - 1;
         if ((startPage < 0) || (endPage < 0) || (startPage > endPage))
              throw new PageNumberException(startPage, endPage);
         var curPage = startPage;
         while (curPage <= endPage) {
              // Get the field containers on the current page
              var oFields = xfa.layout.pageContent(curPage, "field");
              var allFields = oFields.length;
              // Continue if fields were found on the page
              if (allFields > 0) {
                   var i = 0;
                   for (i=0; i < allFields; i++) {
                        if (oFields.item(i).name == fieldName) {
                             //only count non-empty/numeric fields
                             var fieldVal = _GetFieldVal(oFields.item(i));
                             if (fieldVal != null) {
                                  fieldCount ++;
                                  fieldSum += fieldVal;
                             if (_GetLengthOfField(oFields.item(i)) > lengthOfDecimal) {
                                  lengthOfDecimal = _GetLengthOfField(oFields.item(i));
              curPage++;
         if (fieldCount == null)
              throw new FieldNotFoundException(fieldName);
         if (fieldCount != null && fieldSum != null && fieldCount > 0) {
              var average = fieldSum / fieldCount;
              if(lengthOfDecimal > 0) {
                   return average.toFixed(lengthOfDecimal);
              return average;
         else {
              return null;
    *     Calculate the number of fields with the same name.
    *      NUMBER Count(STRING sFieldName, [NUMBER pageNum])
    *      NUMBER Count(STRING sFieldName, [OBJECT xfaObject])
    *      NUMBER Count(STRING sFieldName, [NUMBER startPage], [NUMBER endPage])
    *      NUMBER Count(STRING sFieldName, [OBJECT xfaObject], [OBJECT xfaObject])
    *     param1:     STRING; Name of field to calculate number of
    *     param2:     NUMBER; Start page for calculation
    *     param2:     OBJECT; XFA object on the page calculation will start on
    *     param3:     NUMBER; End page for calculation
    *     param3:     OBJECT; XFA object on the page calculation will end on
    *     return: NUMBER; Number of fields found
    function _doCount(fieldName)
         var fieldCount = null;
         var startPage = 0;
         var endPage = 0;
         if (arguments.length == 2) {
              startPage = _GetPageNum(arguments[1]);
              endPage = startPage;
         } else if (arguments.length == 3){
              startPage = _GetPageNum(arguments[1]);
              endPage = _GetPageNum(arguments[2]);
         } else {
              startPage = 0;
              endPage = xfa.layout.pageCount() - 1;
         if ((startPage < 0) || (endPage < 0) || (startPage > endPage))
              throw new PageNumberException(startPage, endPage);
         var curPage = startPage;
         while (curPage <= endPage) {
              // Get the field containers on the current page
              var oFields = xfa.layout.pageContent(curPage, "field");
              var allFields = oFields.length;
              // Continue if fields were found on the page
              if (allFields > 0) {
                   var i = 0;
                   for (i=0; i < allFields; i++) {
                        if (oFields.item(i).name == fieldName) {
                             //only count non-empty/numeric fields
                             var fieldVal = _GetFieldVal(oFields.item(i));
                             if (fieldVal != null) {
                                  fieldCount ++;
              curPage++;
         if (fieldCount == null)
              throw new FieldNotFoundException(fieldName);
         return fieldCount;
    function _GetFieldVal(obj)
         var fieldVal = obj.rawValue;
         if (typeof fieldVal != "number") {                         
              if (typeof fieldVal == "string" && fieldVal.length > 0) {
                   fieldVal = parseFloat(fieldVal);
                   if (isNaN(fieldVal))
                        fieldVal = null;
              } else {
                   fieldVal = null;
         return fieldVal;
    function _GetPageNum(val)
         var pageNum = -1;
         if (typeof val == "number") {                         
              pageNum = val;
         else if (typeof val == "object") {
              if (val != null) {               
                   pageNum = xfa.layout.page(val) - 1
         return pageNum;
    function _GetLengthOfField(obj)
         var fieldVal = obj.rawValue;
         if (fieldVal != null) {
              if (typeof fieldVal == "number") {
               fieldVal = new String(fieldVal);
              var index = fieldVal.indexOf(".");
              if (index > -1) {
                   return fieldVal.length - index - 1;
         return 0;
    function getExceptionString() { return this.message; }
    function FieldNotFoundException(fieldName)
         this.message = "Calculation failed: No non-empty fields found called '" + fieldName + "'.";
         this.name = "FieldNotFoundException";
         this.toString = getExceptionString;
    function PageNumberException(startPage, endPage)
         this.message = "Calculation failed: Incorrect page references (start page = " + startPage + ", end page = " + endPage + ").";
         this.name = "PageNumberException";
         this.toString = getExceptionString;
    // END OF DO NOT MODIFY     
    5. In the subtotal fields, add script for event "calculate":
    this.rawValue = this.parent.variables.tableCalcs.obj.Sum("AMOUNT", 0, this);
    where "AMOUNT" is the name of the referenced field.
    HTH & best regards,
    Carlo

  • Page total in adobe forms

    Hi Experts,
    I want to do page total on a particular field in adobe forms . I am getting grand total but cann't get the page total.
    Is their some java script or adobe script is required for it . If yes then provide me the solution for it.  Its very urgent. Point is garanted for the solution.
    Thanks in advance.
    Regards,
    Anomitro

    Hi,
    I want to do the summation of a particular field separetely for every  page as we do in the smartforms Ihave to do it in adobe forms. I donn't want total number of page . I want sub total of  a field on every page.
    Thanks in advance.
    Regards,
    Anomitro
    Edited by: Anomitro Guha on May 28, 2008 8:44 PM
    Edited by: Anomitro Guha on May 29, 2008 11:56 AM

  • Sub total in smart forms

    how to calculate sub total in smartforms
    give step by step
    mak

    Check out the below related thread .... Hope it helps
    total and subtotal in smartform
    HI    SUBTOTAL IN SMARTFORM
    Hi can any one help subtotal in SMARTFORM with sample steps&code
    Regards,
    Santosh

  • Need to skip page break between header and Detail sections

    Hello,
    I am combining two reports in one report (one in header section and another report in the body section). when this report is run, there's a page break between these two sections. Is it possible to eliminate it? Ideally I would like the detail section to start as soon as the header section of the report is completed in the same page instead of starting (detail section report) in a new page.
    Any help is highly appreciated. Thanks,
    Sundar

    I'd put them into one section to control the breaks.

  • Line break on a user defined condition in adobe forms

    Dear experts,
    my problem is as follows:
    i designed a form with adobe forms with a scheme like this.
    pos
    10 text
         text2
         text3
    11 text4
         text5
    my Problem is now that like breaks occour random.
    for example:
    10 text
         text2                                        page 1
         text3                                        page 2
    11 text4
         text5
    I want it like this:
    10 text
         text2
         text3
    11 text4
         text5
    i want a line break the way that all positions are linked.
    Please help
    Thanks.

    Fix your points count. You will fnd troublesome to find any help here if you have never helped a living soul. Otto

  • Check on EHP2 and EHP5 Compatibility for Adobe Forms

    Hi,
    Does anyone knows if adobe forms for EHP2 and EHP5 is downward compatible?
    Meaning, the standard SAP adobe forms I have in EHP2 can run as well in EHP5?
    Or appreciate there is any info on the compatibility for sap adobe forms

    Hi Sashu,
    It should be downward Compatible .
    Ranganathan

  • Dropdown and Value Help in Adobe Form (WebDynpro Java)

    Hi Experts,
    I need to develop a Adobe form where i have to implement Dropdown and Value Help, which will coming from custom BAPI. I am using WebDynpro Java, EP 7.0 and ALD 8.0. Please let me know how can i implement those 2 UI Elemnts..
    Regards
    Subhrajyoti

    Hi Jyothi,
    Herewith I had Explained detailed Procedure,
    For Dropdown,
    1.     Create a node and attribute to the dropdown ,
    2.     call the bapi,
    3.     Assign the Bapi attribute to the Dropdown node attribute
    4.     Place the Interactive form UI to the Java Application
    5.     Create an another  attribute for read the interactive form
                  a.Name: pdf_src
                  b.Type :byte, Assign this attribute to PDF Source property of the Interactive form UI Element.
    6.     Give the Name to the Template source property of the Interactive form UI and double click the        template source.
    7.     It asking Name for the Interactive form, Give the name for that
    8.     Once give the Name, It ask context for Adobe form, assign the already created node for dropdown in Webdynpro application to the interactive form.
    9.     Now Context Bounded with Webdynpro and Interactive form
    10.     Interactive form screen will be open into the studio
    11.     Place the Dropdown UI element  to the Interactive form and bind the attribute to the dropdown
    12.     Select the Dropdown UI Element, go to the object property, Click the Specify Item values. The pop window displayed, here give the $ value to the Item Text, Item value. The Data Connection dropdown and Default Binding , it has value when the attribute bounded to the dropdown UI .
    13.     Save and Test the Application
    For Value Help,
    1.     Do the Same Procedure for up to 10 steps,
    2.     Place the Text field UI and Value Help UI Element
    3.     Select the Value Help, go the Script Editor give the name of the text field attribute name in var fieldName = "*INSERT_NAME_HERE*";
    4.     Save and Test the Application
    By
    Parthi

  • Purchase order wise total in adobe forms...

    hi all,
           In adobe i am displaying purchase order header items below that i am displaying its line items.i want to display the net price
           for each purchase order below the line items..
    for example..
                  23435325                 3000               nb         
                             m-10       5           1000
                             m-20       6           2000
    purchase order net price            3000
                  23435326                 3000               nb         
                             m-30       5           1000
                             m-40       6           2000
    purchase order net price            3000
    Edited by: sivaprasath sekar on Oct 15, 2009 11:58 AM

    Hi
    You can do the calculation using script.
    Check the meterial numbers are equal and add the total.
    Kind Regads
    Mukesh

  • I´m in Argentina and I cant buy Adobe Forms.. Any help?

    Dear friends, I need a few Forms and I cant buy; any help¿?
    Thanks!

    Im from Argentina too, I created an account and selected United States as Region.
    When I click on pricing and then subscribe I get redirected to this webpage (probably the webpage detects that I am in Argentina through my IP):
    https://www.acrobat.com/formscentral/es_ES/unsupported-country.html?promoid=IEHMO&mboxsess ion=1386571540267-935238
    I am not given the option to enter a US credit card nor billing address which I do have.
    Is there a workaround?
    I only need to get to the webpage where I can pay.
    Thanks

  • Page break in between group and subreport

    I have created a report with one group based on the customer order number.   We want the user to be able to run a range of customers orders. For example, print 10 customer orders at one time.  The group pulls the required information for each
    customer order.   After each customer order,  I have a sub-report that is a pallet pick sheet.   We want a page break after each group, so the sub-report prints on a separate page. It goes like this
    customer order 137158 detail - 1st iteration of the group.
    page break
    sub-report pallet pick sheet for 137158 - starts on a new page.
    page break
    customer order 137159 detail starts on a new page. - 2nd iteration of the group.
    page break
    sub-report pallet pick sheet 137159 - starts a new page.  
    I would really appreciate if someone can help solve this issue.  I've spent over half a day reading forums and trying different solutions, and every attempt at adding page breaks seems to be ignored.   I'm working with SSRS 2012. 
    Jeff

    I had the company logo and a title outside of the data tablix.   When I moved these into the list table, the issue with the additional white space was resolved.   At this point, we have resolved the page break and the extra white space
    on the report.   I have one more issue.  
    On the main report, I have two parameters for starting customer order number and ending customer order number.   I created the same parameters on the sub-report.  When I run the report, I enter a range of 139818 to 139824.   The
    main report which is the customer order information prints correctly.   However, instead of getting just the sub-report for the first order which is 139818,  I get a sub report for every order in the range.   Then, the main report
    prints order 139819, and then repeats the sub-report loop for every order.  So, each time the main report prints, I get 7 sub-reports.   How do I link the main report to the sub-report so there is a one to one match so only
    one sub-report is generated per customer order?    
    I really appreciate the help,
    Jeff

  • Allow page breaks and text overflow indicator

    I have set up a sub form to allow page breaks within content which works but then the content that continues on the next page has the text overflow indicator showing and the text field does not expand which is what I want it to do. What do I need to do to get it to continue flowing?

    I do not understand why this should be so difficult.   What I am doing is just opening a blank form and I can either insert a text field or a subform.  I then go to check allow page breaks within content and it is greyed out on a text field.  I also can create the subform and it allows me to set it to flowed and allow page breaks but it then has a indicator that displays (Although the object is allowed to break, deselecting allow page breaks within content object of the parent object restrict this object from breaking between pages).  The only thing that makes sense is the parent is the blank page form.  I have searched all over the place and I cannot see anyplace to set the form page to allow page breaks.  The only thing that is on the form is either a check box or a subform and thats it. It keeps having a problem with a parent object.  The only 2 objects I see are the blank page and then the text field I add.  Nothing seems obvious to fix this.  This software does not appear to be very user friendly.

  • ALV how to display page no in every page - Page break

    Hi All
    I would like to know how can i write an ALV page no in each of the page.
    Currently i manage to write the page no in the top , but only show "Page No : 1 "
    but when i send to spool the All the page no will break into "Page No : 1 , Page No :2 and up to end page .
    thank you

    Hi Check this program.
    A Simple ABAP ALV LIST VIEWER Example
    This ALV program have all the basic report requirements such as page heading, page no, sub-total and a grand total.
    This is a basic ALV with the followings:-
    - Page Heading
    - Page No
    - Sub-Total
    - Grand Total
    REPORT ZALV.
    TYPE-POOLS: SLIS.
    DATA: G_REPID LIKE SY-REPID,
    GS_PRINT            TYPE SLIS_PRINT_ALV,
    GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
    GT_EVENTS           TYPE SLIS_T_EVENT,
    GT_SORT             TYPE SLIS_T_SORTINFO_ALV,
    GS_LAYOUT           TYPE SLIS_LAYOUT_ALV,
    GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
    FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
    COL_POS TYPE I.
    DATA: BEGIN OF ITAB,
      FIELD1(5) TYPE C,
      FIELD2(5) TYPE C,
      FIELD3(5) TYPE P DECIMALS 2,
    END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB1.
    DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB_FIELDCAT.
    Print Parameters
    PARAMETERS:
                P_PRINT  AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
                P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
                P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
                P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
                P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
                P_RESERV TYPE I.                  "NO OF FOOTER LINE
    INITIALIZATION.
    G_REPID = SY-REPID.
    PERFORM PRINT_BUILD    USING GS_PRINT.      "Print PARAMETERS
    START-OF-SELECTION.
    TEST DATA
    MOVE 'TEST1' TO ITAB1-FIELD1.
    MOVE 'TEST1' TO ITAB1-FIELD2.
    MOVE '10.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    MOVE 'TEST2' TO ITAB1-FIELD1.
    MOVE 'TEST2' TO ITAB1-FIELD2.
    MOVE '20.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    DO 50 TIMES.
      APPEND ITAB1.
    ENDDO.
    END-OF-SELECTION.
    PERFORM BUILD.
    PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
    PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
    PERFORM CALL_ALV.
    FORM BUILD.
    DATA FIELD CATALOG
    Explain Field Description to ALV
    DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD1'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
    FIELDCAT_LN-KEY       = ' '.   "SUBTOTAL KEY
    FIELDCAT_LN-NO_OUT    = ' '.
    FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD2'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    FIELDCAT_LN-NO_OUT    = 'X'.
    FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME     = 'FIELD3'.
    FIELDCAT_LN-TABNAME       = 'ITAB1'.
    FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
    FIELDCAT_LN-REF_TABNAME   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
    FIELDCAT_LN-NO_OUT        = ' '.
    FIELDCAT_LN-DO_SUM        = 'X'.   "SUM UPON DISPLAY
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    DATA SORTING AND SUBTOTAL
    DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD1'.
    GS_SORT-SPOS      = 1.
    GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD2'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    ENDFORM.
    FORM CALL_ALV.
    ABAP List Viewer
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
    IS_LAYOUT =  GS_LAYOUT
    IT_FIELDCAT = GT_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
      IT_SORT = GT_SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
      IT_EVENTS = GT_EVENTS[]
    IT_EVENT_EXIT =
      IS_PRINT = GS_PRINT
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = ITAB1
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    ENDFORM.
    HEADER FORM
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    *GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    define END_OF_PAGE event
    READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_PAGE
                             INTO LS_EVENT.
    IF SY-SUBRC = 0.
      MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
      APPEND LS_EVENT TO LT_EVENTS.
    ENDIF.
    ENDFORM.
    FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'H'.
      GS_LINE-INFO = 'HEADER 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      GS_LINE-KEY  = 'STATUS 1'.
      GS_LINE-INFO = 'INFO 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      GS_LINE-KEY  = 'STATUS 2'.
      GS_LINE-INFO = 'INFO 2'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
    CLEAR GS_LINE.
    GS_LINE-TYP  = 'A'.
    GS_LINE-INFO = 'ACTION'.
    APPEND GS_LINE TO  GT_TOP_OF_PAGE.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
    ENDFORM.
    FORM END_OF_PAGE.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.
    PRINT SETTINGS
    FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
      LS_PRINT-PRINT              = P_PRINT.  "PRINT IMMEDIATE
      LS_PRINT-NO_PRINT_SELINFOS  = P_NOSINF. "NO SELECTION INFO
      LS_PRINT-NO_COVERPAGE       = P_NOCOVE. "NO COVER PAGE
      LS_PRINT-NO_NEW_PAGE        = P_NONEWP.
      LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
      LS_PRINT-RESERVE_LINES      = P_RESERV.
    ENDFORM.
    *END OF ZALV PROGRAM
    Reward if it helps you.

Maybe you are looking for

  • Hp 4000n, WIN 7 HOME NETWORK PRINTER GOES OFFLINE ON REBOOT

    I have 2 WIN7 desktops and 2 printers.  One HP L4000n is attached locally to one computer and shared by the other computer on the home network.  It is attached to a standard parallel printer port (via) a IEEE1284 controller card.  The other printer i

  • Please help. Sound eahancements feature in my Xperia Z1 is disabled. How to enable it?

    Sound eahancements feature in my Xperia Z1 is disabled since the phone was turned on first time. I have updated the software also but still this faeture is disabled. Rest feature like Clear audio+ and dynamic normaliser are working fine. Please tell

  • Performance Impact of Using Sessions

    All, I have a general question regarding the performance impact of using Sessions within a Servlet. Specifically, I'm working with a group that wants to use the Session object to store customer contacts temporarily. The application is expected to ser

  • Remapping keys broken

    I want to remap the control key to the caps lock on my PB. To do this, I used System Preferences -> Hardware -> Keyboard and Mouse -> Modifier Keys to make both caps lock and control keys perform the control action. The result is unreliable. Usually

  • Choose From List Condition on Detail table field rather than Master table

    Dear All, I have a master detail udo having udts @master @detail I need to filter my cfl object on bases of field in @detail table. Can you tell how do I do this.