set_source_table 

Use this method to create a new pivot table in the current workbook using the contents of an internal table. The system creates the pivot table on a new worksheet.

The method allows you to select which fields of the internal table you want to appear in the pivot table. You must also decide whether they should be row fields, column fields, or data fields.

CALL METHOD pivot->set_source_table
       EXPORTING ddic_name    = ddic_name
                 data_table   = data_table
                 fields_table = fields_table
                 name         = name
                 items        = items
                 itemsnr      = itemsnr
                 length       = length
       IMPORTING error        = error
                 retcode      = retcode.

Description of parameters

Parameter

Optional

Description

ddic_name

X

The name of a table or structure in the ABAP Dictionary with the same structure as the internal table you want to insert in the workbook.

Note: If your internal table does not have the structure of an ABAP Dictionary table, you must use the fields_table parameter instead.

data_table

 

The name of the internal table in your ABAP program containing the data that you want to display in the pivot table

fields_table

X

You use this parameter when you cannot use the ddic_name parameter to describe the structure of the data table. It is an internal table with the type SOI_FIELDS_TABLE , which you must fill with the names of the fields in the data table.

name

 

The name to be given to the pivot table

items

X

If you described your data table using the fields_table parameter, you can use this parameter to specify the fields of the table that should appear in the pivot table, and whether they should be row fields, column fields, or data fields. It is an internal table with the type SOI_NAMETYPE_TABLE . This has two fields:
name , containing the name of the field, and type , which describes the type of the field. type can have the following values:
i_oi_pivot=>rowfield : Each value of the field is a row in the pivot table
i_oi_pivot=>columnfield : Each value of the field is a column in the pivot table
i_oi_pivot_datafield : The values of the field appear in the body of the table itself.

Note: If you want to specify the fields by their index number and not by name, use the itemsnr parameter instead.

itemsnr

X

Use this parameter to specify the fields of the table that should appear in the pivot table, and whether they should be row fields, column fields, or data fields. It is an internal table with the type SOI_COLTYPE_TABLE . This has two fields:
col , containing the index number of the field from the internal table, and type , which describes the type of the field. type can have the following values:
i_oi_pivot=>rowfield : Each value of the field is a row in the pivot table
i_oi_pivot=>columnfield : Each value of the field is a column in the pivot table
i_oi_pivot=>datafield : The values of the field appear in the body of the table itself.

Note: If you used the ddic_name parameter, you must use this parameter to define how the fields of the data table should be arranged in the pivot table. If you used the fields_name parameter, you may use the items parameter instead, which allows you to specify the fields by name instead of by index number.

length

X

If you used the ddic_name parameter to specify the structure of your data table, you can use this parameter to specify the length of the field labels that the system should use in the pivot table. These are taken from the definitions of the underlying data elements in the ABAP Dictionary. Possible values:

  • 'S' : Short field labels
  • 'M' : Medium field labels
  • 'L' : Long field labels.

Note: If you specify a value that is not valid (or no value at all) the system cannot display the pivot table correctly.

You cannot use this parameter if you used fields_table to describe the structure of your data table.