Y R Eitan Test 31 08

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 7

REPORT y_r_eitan_test_31_08 .

TYPE-POOLS: abap .
TABLES: ssfscreen .
DATA: text255 TYPE text255 .
*----------------------------------------------------------------------*
TYPES: BEGIN OF tp_tech_1 .
TYPES: it_styl
TYPE salv_t_int4_column .
TYPES: END OF tp_tech_1 .
*----------------------------------------------------------------------*
TYPES: BEGIN OF tp_stxf_1 .
TYPES: formname TYPE stxfadm-formname .
TYPES: END OF tp_stxf_1 .
*----------------------------------------------------------------------*
TYPES: BEGIN OF tp_node_1 .
TYPES: name TYPE ssfscreen-iname ,
value TYPE text255 .
TYPES: ob_ixml_node TYPE REF TO if_ixml_node .
TYPES: END OF tp_node_1 .
*----------------------------------------------------------------------*
TYPES: BEGIN OF tp_alv_data_1 .
INCLUDE TYPE tp_tech_1 AS tech_1 RENAMING WITH SUFFIX _tech_1 .
INCLUDE TYPE tp_stxf_1 AS stxf_1 RENAMING WITH SUFFIX _stxf_1 .
INCLUDE TYPE tp_node_1 AS node_1 RENAMING WITH SUFFIX _node_1 .
TYPES: END OF tp_alv_data_1 .
TYPES: tp_alv_data_1_tab TYPE TABLE OF tp_alv_data_1 .
DATA: it_alv_data_1 TYPE tp_alv_data_1_tab .
*----------------------------------------------------------------------*
TYPES: BEGIN OF tp_alv_data_2 .
INCLUDE TYPE tp_node_1 AS node_1 RENAMING WITH SUFFIX _node_1 .
TYPES: END OF tp_alv_data_2 .
TYPES: tp_alv_data_2_tab TYPE TABLE OF tp_alv_data_2 .
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
CLASS cl_event_receiver DEFINITION .
PUBLIC SECTION.
METHODS: link_click FOR EVENT link_click OF cl_salv_events_table
IMPORTING row column.
PRIVATE SECTION.
METHODS: show_parents
IMPORTING ob_ixml_node_1 TYPE REF TO if_ixml_node .
METHODS: popup
IMPORTING
start_line TYPE i
end_line
TYPE i
start_column TYPE i
end_column TYPE i
value(t_table) TYPE

DEFAULT
DEFAULT
DEFAULT
DEFAULT
table .

2
15
25
150

ENDCLASS .
"cl_event_receiver DEFINITION
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
CLASS cl_event_receiver IMPLEMENTATION.
*----------------------------------------------------------------------*
METHOD: link_click .
FIELD-SYMBOLS: <st_alv_data_1> TYPE tp_alv_data_1 .
FIELD-SYMBOLS: <cell> TYPE ANY .
READ TABLE it_alv_data_1 INDEX row ASSIGNING <st_alv_data_1> .
ASSIGN COMPONENT column OF STRUCTURE <st_alv_data_1> TO <cell> .
CASE column .
WHEN 'NAME_NODE_1' .
me->show_parents( <st_alv_data_1>-node_1-ob_ixml_node ) .
ENDCASE .
ENDMETHOD .
"on_link_click
*----------------------------------------------------------------------*
METHOD: show_parents .
DATA: ob_ixml_node_t TYPE REF TO if_ixml_node .
ob_ixml_node_t = ob_ixml_node_1->get_parent( ) .
DATA: it_alv_data_2 TYPE tp_alv_data_2_tab .
DATA: st_alv_data_2 LIKE LINE OF it_alv_data_2 .
WHILE ob_ixml_node_t IS NOT INITIAL .
st_alv_data_2-node_1-name = ob_ixml_node_t->get_name( ) .
st_alv_data_2-node_1-value = ob_ixml_node_t->get_value( ) .
APPEND st_alv_data_2 TO it_alv_data_2 .
ob_ixml_node_t = ob_ixml_node_t->get_parent( ) .
ENDWHILE .
me->popup( EXPORTING t_table = it_alv_data_2 ) .
ENDMETHOD .
"show_parents
*----------------------------------------------------------------------*
METHOD: popup .
IF t_table IS INITIAL .
MESSAGE s801(dh).
RETURN .
ENDIF .
DATA: ob_salv_table TYPE REF TO cl_salv_table.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = ob_salv_table
CHANGING

t_table

= t_table ).

CATCH cx_salv_msg.
ENDTRY.
CHECK ob_salv_table IS BOUND.
ob_salv_table->set_screen_popup(
start_column = start_column
end_column = end_column
start_line = start_line
end_line
= end_line ).
ob_salv_table->display( ) .
ENDMETHOD .
"popup
*----------------------------------------------------------------------*
ENDCLASS .
"cl_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK block04 WITH FRAME.
SELECT-OPTIONS: s_fname FOR ssfscreen-fname
NO INTERVALS OBLIGATORY .
SELECT-OPTIONS: s_devcl FOR ssfscreen-devclass NO INTERVALS .
SELECTION-SCREEN SKIP .
SELECT-OPTIONS: s_name FOR ssfscreen-iname .
SELECT-OPTIONS: s_value FOR text255 NO INTERVALS.
SELECTION-SCREEN END OF BLOCK block04.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
INITIALIZATION .
PERFORM at_initialization .
START-OF-SELECTION.
PERFORM at_start_of_selection .
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM at_initialization .
* APPEND 'IEQSF_EXAMPLE_01' TO s_fname .
* APPEND 'IEQSF_EXAMPLE_02' TO s_fname .
APPEND 'IEQSF_EXAMPLE_03' TO s_fname .
APPEND 'IEQTDLINE ' TO s_name .
APPEND 'ICP*madam*' TO s_value .
DATA: it_seltexts TYPE TABLE OF rsseltexts .
DATA: st_seltexts LIKE LINE OF it_seltexts .
st_seltexts-name =
st_seltexts-kind =
st_seltexts-text =
APPEND st_seltexts

'S_NAME' .
'S' .
'Node name' .
TO it_seltexts .

st_seltexts-name =
st_seltexts-kind =
st_seltexts-text =
APPEND st_seltexts

'S_VALUE' .
'S' .
'Node value' .
TO it_seltexts .

CALL FUNCTION 'SELECTION_TEXTS_MODIFY'


EXPORTING
program
= sy-cprog
TABLES
seltexts
= it_seltexts
EXCEPTIONS
program_not_found
= 1
program_cannot_be_generated = 2
OTHERS
= 3.
ENDFORM .
"at_initialization
*----------------------------------------------------------------------*
FORM at_start_of_selection .
CLEAR it_alv_data_1 .
DATA: it_stxfadm TYPE TABLE OF stxfadm .
SELECT * INTO TABLE it_stxfadm
FROM stxfadm
WHERE
formname IN s_fname AND
devclass IN s_devcl.
FIELD-SYMBOLS: <st_stxfadm> LIKE LINE OF it_stxfadm .
LOOP AT it_stxfadm ASSIGNING <st_stxfadm> .
PERFORM scan_form
USING
<st_stxfadm>
CHANGING
it_alv_data_1 .
ENDLOOP.
PERFORM display_results
CHANGING
it_alv_data_1 .
ENDFORM .
"at_start_of_selection
*----------------------------------------------------------------------*
FORM scan_form
USING
st_stxfadm TYPE stxfadm
CHANGING
it_alv_data_1 TYPE tp_alv_data_1_tab .
DATA: ob_smart_form TYPE REF TO cl_ssf_fb_smart_form .
CREATE OBJECT ob_smart_form .
CALL METHOD ob_smart_form->load
EXPORTING
im_active = space

im_formname = st_stxfadm-formname
im_language = 'E'.
DATA: ob_ixml
TYPE REF TO if_ixml .
DATA: ob_ixml_document TYPE REF TO if_ixml_document .
ob_ixml
= cl_ixml=>create( ).
ob_ixml_document = ob_ixml->create_document( ) .
ob_smart_form->xml_init( ) .
CALL METHOD ob_smart_form->xml_download
EXPORTING
parent = ob_ixml_document
CHANGING
document = ob_ixml_document.
* DATA: ob_ixml_stream_factory TYPE REF TO if_ixml_stream_factory.
* DATA: ob_ostream TYPE REF TO if_ixml_ostream .
*
*
*
*
*

DATA: debug TYPE string.


ob_ixml_stream_factory = ob_ixml->create_stream_factory( ).
ob_ostream = ob_ixml_stream_factory->create_ostream_cstring( debug ).
ob_ixml_document->render( ostream = ob_ostream ) .
DATA: ob_ixml_node TYPE REF TO if_ixml_node .
ob_ixml_node = ob_ixml_document .
DATA: ob_ixml_node_iterator TYPE REF TO if_ixml_node_iterator .
ob_ixml_node_iterator = ob_ixml_node->create_iterator( ) .
DATA: st_alv_data_1 LIKE LINE OF it_alv_data_1 .
DATA: st_styl LIKE LINE OF st_alv_data_1-tech_1-it_styl .
WHILE NOT ob_ixml_node IS INITIAL .
CLEAR st_alv_data_1 .
st_alv_data_1-stxf_1-formname = st_stxfadm-formname .
st_alv_data_1-node_1-ob_ixml_node = ob_ixml_node .
st_alv_data_1-node_1-name = ob_ixml_node->get_name( ) .
IF st_alv_data_1-node_1-name NOT IN s_name .
ob_ixml_node = ob_ixml_node_iterator->get_next( ).
CONTINUE .
ENDIF .
st_alv_data_1-node_1-value = ob_ixml_node->get_value( ) .
IF st_alv_data_1-node_1-value NOT IN s_value .
ob_ixml_node = ob_ixml_node_iterator->get_next( ).
CONTINUE .
ENDIF .
APPEND st_alv_data_1 TO it_alv_data_1 .

ob_ixml_node = ob_ixml_node_iterator->get_next( ).
ENDWHILE .
ENDFORM.
"scan_form
*----------------------------------------------------------------------*
FORM display_results
CHANGING
t_table TYPE table .
DATA: ob_salv_table TYPE REF TO cl_salv_table .
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = ob_salv_table
CHANGING
t_table
= t_table ).
CATCH cx_salv_msg.
ENDTRY.
DATA: ob_salv_functions_list TYPE REF TO cl_salv_functions_list.
ob_salv_functions_list = ob_salv_table->get_functions( ).
ob_salv_functions_list->set_default( ) .
DATA: st_fcat TYPE lvc_s_fcat .
DATA: ob_salv_columns TYPE REF TO cl_salv_columns_table .
ob_salv_columns = ob_salv_table->get_columns( ) .
ob_salv_columns->set_cell_type_column( 'IT_STYL_TECH_1' ) .
DATA: it_column_ref TYPE salv_t_column_ref .
FIELD-SYMBOLS: <st_column_ref> LIKE LINE OF it_column_ref .
it_column_ref = ob_salv_columns->get( ) .
DATA: ob_salv_column TYPE REF TO cl_salv_column_table .
LOOP AT it_column_ref ASSIGNING <st_column_ref> .
CASE <st_column_ref>-columnname .
WHEN 'NAME_NODE_1' .
st_fcat-scrtext_s = st_fcat-scrtext_m = st_fcat-scrtext_l = 'Node Name'(
011) .
<st_column_ref>-r_column->set_short_text( value = st_fcat-scrtext_s ) .
<st_column_ref>-r_column->set_medium_text( value = st_fcat-scrtext_m ) .
<st_column_ref>-r_column->set_long_text( value = st_fcat-scrtext_l ) .
ob_salv_column ?= ob_salv_columns->get_column( <st_column_ref>-columnnam
e ) .
ob_salv_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
WHEN 'VALUE_NODE_1' .
st_fcat-scrtext_s = st_fcat-scrtext_m = st_fcat-scrtext_l = 'Node Value'
(012) .
<st_column_ref>-r_column->set_short_text( value = st_fcat-scrtext_s ) .

<st_column_ref>-r_column->set_medium_text( value = st_fcat-scrtext_m ) .


<st_column_ref>-r_column->set_long_text( value = st_fcat-scrtext_l ) .
ENDCASE.
ENDLOOP .
DATA: ob_salv_events
TYPE REF TO cl_salv_events_table.
DATA: ob_event_receiver TYPE REF TO cl_event_receiver .
ob_salv_events = ob_salv_table->get_event( ).
CREATE OBJECT ob_event_receiver .
SET HANDLER ob_event_receiver->link_click FOR ob_salv_events .
ob_salv_table->display( ).
ENDFORM.

"display_results

You might also like