Skip to Content
0
Oct 30, 2013 at 01:30 PM

How to clear OOO ALV header text in TOP_OF_PAGE

318 Views

Hi Experts,

I have a ABAP OO ALV report.

There are 2 ALV tables one below the other.

The first ALV has checkbox in the row.

The second ALV has a user defined button "Create SD" in the toolbar.

When the user selects a checkbox in the first ALV and presses "Create SD" button in the second then I display status text "SD 9678 created successfully" in the top of page header.

When the user deselects the checkbox then I need to clear the text displayed on the top of page.

When again the user selects the checkbox I need to display the updated text on the top of page.

For the first time when checkbox is selected by default the top of page test is getting populated.

But when I deselect the checkbox then the top of page text is not getting cleared? Also it is not getting updated when I again select the checkbox?

Not sure what is wrong in my code.

My code is as below:

FORM event_top_of_page USING p_flg TYPE c.

IF p_flg IS INITIAL.
"Populating header to top-of-page

CLEAR : dl_text.

"Move shipment doc status

CONCATENATE 'Shipment Document :' v_sddoc 'Successfully created' INTO dl_text SEPARATED BY space.

"Add shipmemnt doc status to Document
v_type = 'S'.
PERFORM add_text USING dl_text
v_type.

"Add new-line

CALL METHOD v_doc_id->new_line.

CLEAR : dl_text.

"Move handling unit status

CONCATENATE 'Pallet ID :' v_palletid 'Successfully created' INTO dl_text SEPARATED BY space.

"Add handling unit status to Document
v_type = 'E'.
PERFORM add_text USING dl_text
v_type.

CLEAR : dl_text.
PERFORM html.
ELSE. <-- Here is the code to clear the top of page text.
" Initializing document
CALL METHOD v_doc_id->initialize_document
EXPORTING
background_color = cl_dd_document=>col_textarea
no_margins = abap_true.

"Creating html control
CREATE OBJECT v_html_cntrl
EXPORTING
parent = v_parent_html.

CALL METHOD v_doc_id->display_document
EXPORTING
reuse_control = 'X'
parent = v_parent_html
EXCEPTIONS
html_display_error = 1.
ENDIF.

ENDFORM.

FORM add_text USING p_text TYPE sdydo_text_element
p_type TYPE c.

"Adding text

IF p_type = 'S'.
CALL METHOD v_doc_id->add_text
EXPORTING
text = p_text
sap_fontsize = cl_dd_area=>large
sap_color = cl_dd_document=>list_heading_int
sap_emphasis = cl_dd_document=>strong.
ELSEIF p_type = 'E'.
CALL METHOD v_doc_id->add_text
EXPORTING
text = p_text
sap_fontsize = cl_dd_area=>large
sap_color = cl_dd_area=>list_negative_inv "red color
sap_emphasis = cl_dd_document=>strong.
ENDIF.

ENDFORM. " ADD_TEXT


FORM html.

DATA : v_length TYPE i, " Length
v_html_cntrl TYPE REF TO cl_gui_html_viewer. "Reference to html container

"Creating html control
CREATE OBJECT v_html_cntrl
EXPORTING
parent = v_parent_html.

CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
EXPORTING
document = v_doc_id
bottom = space
IMPORTING
length = v_length.

"Get TOP->HTML_TABLE ready

CALL METHOD v_doc_id->merge_document.

"Connect TOP document to HTML-Control

v_doc_id->html_control = v_html_cntrl.

"Display TOP document

CALL METHOD v_doc_id->display_document
EXPORTING
reuse_control = 'X'
parent = v_parent_html
EXCEPTIONS
html_display_error = 1.

IF sy-subrc NE 0.

"MESSAGE I999.

ENDIF.

ENDFORM.

Thanks

Gopal