Skip to Content
avatar image
Former Member

Control Level Functionality.

Hi Guys,

I need to Group a Table by two fields : Example first group is on the Product Type and a further Grouping inside is on the Business Partner.

I have been trying to group by only the Product Type first but it doesn't seem to work right.

I have created the control level group in the Context and used Subforms to try and group it. But the Group level field is repeating for every record.

Expected : -

Product Type 1

Row1

Row2

Row3...

Product Type 2

Row1

Row2

Row3..

Current : -


Product Type1

Row1

Product Type1

Row2

Product Type1

Row3

Product Type2

Row1...

Any help is appreciated.

Regards

Piyush Sharma.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Dec 23, 2013 at 08:31 AM

    Hello Piyush,

        The problem lies in the grouping of the records in the table.


    Please follow the steps below.


    Create 2 tables. 1 Header table and 1 Item table.

    1) Header_Table will contain unique product types with field name product_type.

    2) Item_Table will contain the rows. In this add another field at the beginning and the field name will be product_type(just to link with Header table) and other fields as required.

    In context node, first drag the Header_Table.

    Then drag the Item_Table inside the DATA part of Header_Table. This will act as a loop.

    Now click on Item_Table table. In Where Conditions button, give the below condition

    product_type = Header_Table-product_type.

    It acts as a loop as shown below.

    Loop at header_table into st_header.

         Loop at Item_table into st_item where product_type = st_header-product_type.

          .....

          .....

         Endloop.

    Endloop.

    DATA sub form

    Step 1) In layout editor you will be able to see these 2 tables in data view tab.

    Step 2) Don't drag the whole table. Instead, drag only the data part of the Item_Table in the content area sub form in the design view(body page)tab.

    Step 3) Select this DATA sub form and in the object palette give content as flowed and Uncheck the "Allow Page breaks within content".

    Step 4) In Flow direction, give Western text.

    Step 5) In Binding tab, Check the "Repeat sub form for each data item".


    Table sub form

    Step 1) Click on the parent sub form under which the DATA sub form is available. Select this parent sub form and in the object palette give content as flowed. In Flow direction, give Top to bottom. And check the "Allow Page breaks within content".In place give Following previous and in After give Continue filling Parent.

    Step 2) And in Binding section, select the internal table Header_Table. Check the "Repeat sub form for each data item". This binding ensures that for each record of Header_table, only those records of Item_table are grouped for which the product_type is linked.


    So the result will be as below.


    Product Type 1

    Row1

    Row2

    Row3...

    Product Type 2

    Row1

    Row2

    Row3..

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I have put the following conditions in the ITEM_TABLE:

      product_type = Header_table-prodtyp.

      AND BP = BP_Table-BP.

      This is the only way i am getting the correct set of records but with empty BP rows in between.

      If i put :

      product_type = Header_Table-product_type AND BP = Header_Table-BP.

      I get incorrect data.

      I tried putting some condition on the BP_table also. Does not seem to work.  Trying to figure out some other way.