Application Development 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: 

Header for ALV grids using OO concepts?

Former Member
0 Kudos

Hi Guys,

My requirement is i have to display ALV grid with OO concepts and also Heading or TOP_OF_PAGE.i was able to find the relevant code in the SDn but i was not abl to understand.

what i want to display is Plant , Company code and Quantity structure type in the header.

so can anybody just send me the code for only header and grid display.?

<b><REMOVED BY MODERATOR></b>

Thanks,

Gopi.

Message was edited by:

Alvaro Tejada Galindo

2 REPLIES 2

Former Member
0 Kudos

Check these threads. It should help. Please go thru the links -

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

ashish

Former Member
0 Kudos

Data:

DATA:go_grid TYPE REF TO cl_gui_alv_grid, " Grid Variable

go_container TYPE REF TO cl_gui_custom_container, " Custom Container

go_splitter TYPE REF TO cl_gui_splitter_container, " Splitter Control

go_parent_html TYPE REF TO cl_gui_container, " Abstract Container for GUI Controls

go_parent_grid TYPE REF TO cl_gui_container, " Abstract Container for GUI Controls

go_dyndoc_id TYPE REF TO cl_dd_document, " Dynamic Documents: Document

go_html_cntrl TYPE REF TO cl_gui_html_viewer. " HTML Control Proxy Class

<b>Selection Screen</b>

SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002 .

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001 .

PARAMETERS: p_cheque RADIOBUTTON GROUP rb1 DEFAULT 'X', " Cheques

p_credit RADIOBUTTON GROUP rb1, " Credit card

p_bacs RADIOBUTTON GROUP rb1. " Bacs/Chaps

SELECTION-SCREEN END OF BLOCK blk1.

PARAMETERS: p_bukrs TYPE t001-bukrs OBLIGATORY. " Company Code

SELECT-OPTIONS: s_days FOR gs_bseg2-aplzl

NO-EXTENSION VISIBLE LENGTH 3 OBLIGATORY. " Days outstanding

SELECT-OPTIONS: s_wrbtr FOR gs_bseg1-wrbtr NO-EXTENSION NO INTERVALS, " Amount

s_bzirk FOR gs_t171t-bzirk NO-EXTENSION NO INTERVALS. " Sales district

<b>Class for TOP OF PAGE</b>

CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

METHODS: top_of_page

FOR EVENT top_of_page

OF cl_gui_alv_grid

IMPORTING e_dyndoc_id.

ENDCLASS. "lcl_event_receiver DEFINITION

&----


*& CLASS IMPLEMENTATION

&----


&----


  • CLASS lcl_event_receiver IMPLEMENTATION

&----


  • Class implementation for TOP-OF-PAGE

&----


CLASS lcl_event_receiver IMPLEMENTATION.

----


  • METHOD top_of_page.

----


  • To set Top of Page

----


METHOD top_of_page. "implementation

DATA : lv_text TYPE sdydo_text_element,

lv_wrbtr TYPE char15,

lv_ndays1(3) TYPE n,

lv_ndays2(3) TYPE n.

DATA: lv_background_id TYPE sdydo_key VALUE space.

<b>* Selection Criteria

CONCATENATE text-010 ' : ' INTO lv_text SEPARATED BY space.

CALL METHOD go_dyndoc_id->add_text

EXPORTING

text = lv_text

sap_style = cl_dd_area=>key.

  • Company Code

CALL METHOD go_dyndoc_id->new_line.

CLEAR lv_text.

CONCATENATE text-022 ' : ' p_bukrs INTO lv_text SEPARATED BY space.

CALL METHOD go_dyndoc_id->add_text

EXPORTING

text = lv_text

sap_style = cl_dd_area=>key.

CALL METHOD go_dyndoc_id->new_line.

  • Days Outstanding

IF s_days IS NOT INITIAL.

CLEAR: lv_text, lv_ndays1.

lv_ndays1 = s_days-low.

CONCATENATE text-023 ' : ' lv_ndays1 INTO lv_text SEPARATED BY space.

IF s_days-high IS NOT INITIAL.

CLEAR: lv_ndays2.

lv_ndays2 = s_days-high.

CONCATENATE lv_text text-024 lv_ndays2 INTO lv_text SEPARATED BY space.

ENDIF.

CALL METHOD go_dyndoc_id->add_text

EXPORTING

text = lv_text

sap_style = cl_dd_area=>key.

CALL METHOD go_dyndoc_id->new_line.

ENDIF.

  • Sales District

IF s_bzirk IS NOT INITIAL.

CLEAR lv_text.

CONCATENATE text-006 ' : ' s_bzirk-low INTO lv_text SEPARATED BY space.

CALL METHOD go_dyndoc_id->add_text

EXPORTING

text = lv_text

sap_style = cl_dd_area=>key.

CALL METHOD go_dyndoc_id->new_line.

ENDIF.

  • Value

IF s_wrbtr IS NOT INITIAL.

CLEAR: lv_text, lv_wrbtr.

lv_wrbtr = s_wrbtr-low.

CONCATENATE text-015 ' : ' lv_wrbtr INTO lv_text SEPARATED BY space.

CALL METHOD go_dyndoc_id->add_text

EXPORTING

text = lv_text

sap_style = cl_dd_area=>key.

CALL METHOD go_dyndoc_id->new_line.

ENDIF.</b>

IF go_html_cntrl IS INITIAL.

CREATE OBJECT go_html_cntrl

EXPORTING

parent = go_parent_html.

ENDIF.

CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'

EXPORTING

document = go_dyndoc_id

bottom = space.

CALL METHOD go_dyndoc_id->merge_document.

CALL METHOD go_dyndoc_id->set_document_background

EXPORTING

picture_id = lv_background_id.

go_dyndoc_id->html_control = go_html_cntrl.

CALL METHOD e_dyndoc_id->display_document

EXPORTING

reuse_control = abap_true

parent = go_parent_html

EXCEPTIONS

html_display_error = 1.

IF sy-subrc <> 0.

MESSAGE i014.

ENDIF.

ENDMETHOD. "TOP_OF_PAGE

ENDCLASS. "lcl_event_receiver IMPLEMENTATION

Above code will print the slection screen at top of page if user select any value in selection screen

Rewards if useful................

Minal