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

OOP report with Header section having Listboxs

Former Member
0 Likes
671

I want to create following report :

1) There will be three fields on Header section of the report

Sales Org, Distribution channel and Division

2) Main body of the report will consist of Normal ALV grid having multiple columns.

3) The header section (i.e Sales Org, Distribution channel and Division) should be having Listboxes for all three fields .

If user chooses some value from Sales Org. Listbox, main report body should change accordingly.(Similar requirement for rest of the two fields).

My solution is : to use OOP Splitter container which will split report horizantly in two sections :

1) Upper section (For Header info. Sales Org, dist channel and division)

2) Lower section consisting of report body (ALV Grid)

Please suggest how can I do this.

Regs

Tulip

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
643

Hi Tulip Shah,

Hope the following code is helpful for the spliting of the container

CREATE OBJECT CUSTOM_CONTAINER

EXPORTING

CONTAINER_NAME = CONTAINER

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

OTHERS = 6.

IF SY-SUBRC <> 0. "#EC NEEDED

ENDIF.

CREATE OBJECT SPLIT

EXPORTING

PARENT = CUSTOM_CONTAINER

ORIENTATION = 0

SASH_POSITION = 15

WITH_BORDER = 1

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0. "#EC NEEDED

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*Perform field catalog for the screen 100

CREATE OBJECT GRID

EXPORTING

I_PARENT = CUSTOM_CONTAINER

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

OTHERS = 5.

IF SY-SUBRC <> 0. "#EC NEEDED

ENDIF.

PERFORM F003_FIELDCAT.

  • Create an instance of alv control

CREATE OBJECT GRID

EXPORTING

I_PARENT = SPLIT->BOTTOM_RIGHT_CONTAINER.

  • Object for display of selection parameters in HTML top container

CREATE OBJECT HEADER

EXPORTING

STYLE = 'ALV_GRID'.

  • Add Text For Header to the Report

  • User Name

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-016

SAP_EMPHASIS = TEXT-017.

CALL METHOD HEADER->NEW_LINE.

  • Date

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-022.

WRITE SY-DATUM DD/MM/YYYY TO TEXT01.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT01

SAP_EMPHASIS = TEXT-017.

CALL METHOD HEADER->NEW_LINE.

  • Number of Selected employees

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-019.

COUNT = COUNT - 1.

WRITE COUNT TO TEXT01.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT01

SAP_EMPHASIS = TEXT-017.

CALL METHOD HEADER->NEW_LINE.

  • Number of selected cost centers

IF KOSTLTXT EQ 'X'.

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-020.

WRITE STAT-KOSTL TO TEXT01.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT01

SAP_EMPHASIS = TEXT-017.

ENDIF.

  • Display the data

CALL METHOD HEADER->DISPLAY_DOCUMENT

EXPORTING

PARENT = SPLIT->TOP_LEFT_CONTAINER.

and for the Lower section of the report

First based on the input in the upper section of the body pass the respective table to the ALV. Capture the data in seperate internal tables in the code and based on selection pass to ALV.

Hope it is helpful.

Regards,

Radha.

I want to create following report :

1) There will be three fields on Header section of the report

Sales Org, Distribution channel and Division

2) Main body of the report will consist of Normal ALV grid having multiple columns.

3) The header section (i.e Sales Org, Distribution channel and Division) should be having Listboxes for all three fields .

If user chooses some value from Sales Org. Listbox, main report body should change accordingly.(Similar requirement for rest of the two fields).

My solution is : to use OOP Splitter container which will split report horizantly in two sections :

1) Upper section (For Header info. Sales Org, dist channel and division)

2) Lower section consisting of report body (ALV Grid)

Please suggest how can I do this.

Regs

Tulip

3 REPLIES 3
Read only

Former Member
0 Likes
644

Hi Tulip Shah,

Hope the following code is helpful for the spliting of the container

CREATE OBJECT CUSTOM_CONTAINER

EXPORTING

CONTAINER_NAME = CONTAINER

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

OTHERS = 6.

IF SY-SUBRC <> 0. "#EC NEEDED

ENDIF.

CREATE OBJECT SPLIT

EXPORTING

PARENT = CUSTOM_CONTAINER

ORIENTATION = 0

SASH_POSITION = 15

WITH_BORDER = 1

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0. "#EC NEEDED

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*Perform field catalog for the screen 100

CREATE OBJECT GRID

EXPORTING

I_PARENT = CUSTOM_CONTAINER

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

OTHERS = 5.

IF SY-SUBRC <> 0. "#EC NEEDED

ENDIF.

PERFORM F003_FIELDCAT.

  • Create an instance of alv control

CREATE OBJECT GRID

EXPORTING

I_PARENT = SPLIT->BOTTOM_RIGHT_CONTAINER.

  • Object for display of selection parameters in HTML top container

CREATE OBJECT HEADER

EXPORTING

STYLE = 'ALV_GRID'.

  • Add Text For Header to the Report

  • User Name

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-016

SAP_EMPHASIS = TEXT-017.

CALL METHOD HEADER->NEW_LINE.

  • Date

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-022.

WRITE SY-DATUM DD/MM/YYYY TO TEXT01.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT01

SAP_EMPHASIS = TEXT-017.

CALL METHOD HEADER->NEW_LINE.

  • Number of Selected employees

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-019.

COUNT = COUNT - 1.

WRITE COUNT TO TEXT01.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT01

SAP_EMPHASIS = TEXT-017.

CALL METHOD HEADER->NEW_LINE.

  • Number of selected cost centers

IF KOSTLTXT EQ 'X'.

CALL METHOD HEADER->ADD_GAP

EXPORTING

WIDTH = 1.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT-020.

WRITE STAT-KOSTL TO TEXT01.

CALL METHOD HEADER->ADD_TEXT

EXPORTING

TEXT = TEXT01

SAP_EMPHASIS = TEXT-017.

ENDIF.

  • Display the data

CALL METHOD HEADER->DISPLAY_DOCUMENT

EXPORTING

PARENT = SPLIT->TOP_LEFT_CONTAINER.

and for the Lower section of the report

First based on the input in the upper section of the body pass the respective table to the ALV. Capture the data in seperate internal tables in the code and based on selection pass to ALV.

Hope it is helpful.

Regards,

Radha.

Read only

0 Likes
643

Hi

Thanks..

could you plz, give me a Working code (may be with a simple exemple of a couple of fields)

I will be highly obliged

regs

Tulip

Read only

0 Likes
643

Hi try to find this paper

An easy reference alv grid

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a41...

It explain all about the alv grid

Regards

Jaime