Skip to Content
author's profile photo Former Member
Former Member

Problem in ALV Tree

Hello Friends,

I am using ALV Tree to display a report.

In this report for a particular input.2 nodes are cerated.

On clicking on the 2nd node the details for the same are shown .

However on clicking the 1st node , the system automatically logs off closing all the SAP sessions and even the SAP Logon pad.

Suppose i am on executing the program on development server,even the sessions of test server are closed.

Can anyone please help me in this.....

its a bit urgent.

i am attaching my code for reference.

REPORT ZPRPROUTOPERATIONS1 .

tables : mapl,t001w,zroutpromast.

TYPE-POOLS: slis,kkblo.

include <icon>.

data : it_zrouteledtl like zrouteledtl occurs 0 with header line.

data : it_zeledtl type zeledtl occurs 0 with header line.

data : conv_sec(5) type c value '0.036'.

types : begin of it_output2,

Srno like zrouteledtl-srno,

srno1 type p decimals 8,

subgid like zrouteledtl-subgid,

subopn like zrouteledtl-subopn,

movetype type zeledtl-movetype,

DESC type zeledtl-description,

Add_desc like zrouteledtl-DESCRIPTION,

Freq type p decimals 2,

div_freq type p decimals 2,

men type p decimals 2,

offline(3),

CT type p decimals 2,

CW type p decimals 2,

Ideal_ct type p decimals 2,

ideal_cw type p decimals 2,

A_trg type p decimals 2,

b_Trg type p decimals 2,

g_Trg type p decimals 2,

p_Trg type p decimals 2,

m_Trg type p decimals 2,

t_Trg type p decimals 2,

i_Trg type p decimals 2,

Autocycle type p decimals 2,

online_time type p decimals 2,

offline_time type p decimals 2,

online_p_time type p decimals 2,

offline_p_time type p decimals 2,

end of it_output2.

*types : begin of it_output3,

  • Srno like zrouteledtl-srno,

  • mop_gid like zroutdetails-MOP_GID,

  • MOp_opn like zroutdetails-MOP_OPN,

  • sub_gid like zpromast-subgid,

  • subopn like zpromast-subopn,

  • DESC like zpromast-description,

  • Add_desc like zroutdetails-ADD_INFO,

  • Freq type p decimals 2,

  • batch type p decimals 2,

  • mix type p decimals 2,

  • offline(3),

  • CT type p decimals 2,

  • CW type p decimals 2,

  • Ideal_ct type p decimals 2,

  • ideal_cw type p decimals 2,

  • A_trg type p decimals 2,

  • b_Trg type p decimals 2,

  • g_Trg type p decimals 2,

  • p_Trg type p decimals 2,

  • m_Trg type p decimals 2,

  • t_Trg type p decimals 2,

  • i_Trg type p decimals 2,

  • Autocycle type p decimals 2,

  • online_time type p decimals 2,

  • offline_time type p decimals 2,

  • online_p_time type p decimals 2,

  • offline_p_time type p decimals 2,

  • end of it_output3.

data : it_output type it_output2 occurs 0 with header line,

it_output1 type it_output2 occurs 0 with header line,

it_emptytab type standard table of it_output2 INITIAL SIZE 0.

data : a_trg type f,b_trg type f,g_trg type f,p_trg type f,m_trg type f,t_trg type f,i_trg type f,

autocycle type f,online_p_time type f,offline_p_time type f.

data : ch1 type c,ch2.

DATA: ok_code like sy-ucomm, "OK-Code

save_ok like sy-ucomm.

data : ct_fieldcat type KKBLO_T_FIELDCAT.

*ALV data declarations

DATA: fieldcatalog TYPE lvc_t_fcat WITH HEADER LINE.

DATA: gd_fieldcat TYPE lvc_t_fcat,

gd_tab_group TYPE slis_t_sp_group_alv,

gd_layout TYPE slis_layout_alv.

*ALVtree data declarations

CLASS cl_gui_column_tree DEFINITION LOAD.

CLASS cl_gui_cfw DEFINITION LOAD.

DATA: gd_tree TYPE REF TO cl_gui_alv_tree,

gd_hierarchy_header TYPE treev_hhdr,

gd_report_title TYPE slis_t_listheader,

gd_logo TYPE sdydo_value,

gd_variant TYPE disvariant.

*Create container for alv-tree

DATA: gd_tree_container_name(30) TYPE c,

gd_custom_container TYPE REF TO cl_gui_custom_container.

*data mr_toolbar type ref to cl_gui_toolbar. "Add to top include

selection-screen begin of block start with frame title text-001.

select-options: p_gid for zroutpromast-mop_gid obligatory no-extension no intervals,

p_opn for zroutpromast-mop_opn obligatory no-extension no intervals,

p_werks for t001w-werks obligatory no-extension no intervals.

selection-screen end of block start.

*selection-screen begin of block detail with frame title text-002.

*parameter : radio1 radiobutton group dept default 'X',

  • radio2 radiobutton group dept.

*selection-screen end of block detail.

include ZTEST_TOOLBAR_EVENT_RECEIVER.

start-of-selection.

  • ALVtree setup data

PERFORM data_retrieval.

PERFORM build_fieldcatalog.

PERFORM build_layout.

PERFORM build_hierarchy_header CHANGING gd_hierarchy_header.

PERFORM build_report_title USING gd_report_title gd_logo.

PERFORM build_variant.

  • Display ALVtree report

call screen 100.

&----


*& Form data_retrieval

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM data_retrieval .

select * from zrouteledtl into table it_zrouteledtl where mop_gid in p_gid and

mop_opn in p_opn

and werks in p_werks.

if sy-subrc ne 0.

message i001(0) with 'No Records Found'.

leave program.

endif.

select * from zeledtl into table it_zeledtl for all entries in it_zrouteledtl

where subgid = it_zrouteledtl-subgid

and subopn = it_zrouteledtl-subopn

and werks = it_zrouteledtl-werks.

loop at it_zeledtl.

it_output1-srno = it_zeledtl-srno.

it_output1-srno1 = it_zeledtl-srno.

it_output1-subgid = it_zeledtl-subgid.

it_output1-subopn = it_zeledtl-subopn.

it_output1-movetype = it_zeledtl-movetype.

it_output1-desc = it_zeledtl-DESCRIPTION.

it_output1-freq = it_zeledtl-frequency.

it_output1-div_freq = it_zeledtl-div_freq.

it_output1-men = it_zeledtl-men.

it_output1-offline = it_zeledtl-offline1.

it_output1-ct = it_zeledtl-cy_time * conv_sec.

it_output1-cw = it_zeledtl-wc_time * conv_sec.

it_output1-ideal_ct = it_zeledtl-cy_trg_time * conv_sec.

it_output1-ideal_cw = it_zeledtl-wc_trg_time * conv_sec.

if it_zeledtl-men = 0.

it_output-autocycle = it_zeledtl-cy_time * conv_sec.

endif.

if it_zeledtl-men ne 0 and it_zeledtl-offline1 eq 'NO'

and ( it_zeledtl-movetype eq 'A' or it_zeledtl-movetype eq 'C' ).

case it_zeledtl-movetype.

when 'A'.

if it_zeledtl-SIM_AUTO = 'TRUE'.

ch2 = 0.

else.

ch2 = 1.

endif.

it_output-online_p_time = ( it_zeledtl-autocycle * ch2 * conv_sec ) * it_zeledtl-frequency / it_zeledtl-div_freq.

when 'C'.

if it_zeledtl-sim5 = 'TRUE'.

ch1 = 0.

else.

ch1 = 1.

endif.

it_output-online_p_time = ( it_zeledtl-index5 * it_zeledtl-par_freq5 * ch1

  • it_zeledtl-frequency * 10 ) / it_zeledtl-div_freq .

endcase.

elseif it_zeledtl-men ne 0 and it_zeledtl-offline1 eq 'YES'

and ( it_zeledtl-movetype eq 'A' or it_zeledtl-movetype eq 'C' ).

case it_zeledtl-movetype.

when 'A'.

if it_zeledtl-SIM_AUTO = 'TRUE'.

ch2 = 0.

else.

ch2 = 1.

endif.

it_output1-offline_p_time = ( it_zeledtl-autocycle * ch2 * conv_sec ) * it_zeledtl-frequency / it_zeledtl-div_freq.

when 'C'.

if it_zeledtl-sim5 = 'TRUE'.

ch1 = 0.

else.

ch1 = 1.

endif.

it_output-offline_p_time = ( it_zeledtl-index5 * it_zeledtl-par_freq5 * ch1

  • it_zeledtl-frequency * 10 ) / it_zeledtl-div_freq .

endcase.

endif.

it_output1-a_trg = it_zeledtl-TARGET_A * conv_sec.

it_output1-b_trg = it_zeledtl-target_B * conv_sec.

it_output1-g_trg = it_zeledtl-TARGET_G * conv_sec.

it_output1-p_trg = it_zeledtl-TARGET_P * conv_sec.

it_output1-M_trg = it_zeledtl-TARGET_M * conv_sec.

it_output1-t_trg = it_zeledtl-TARGET_T * conv_sec.

it_output1-i_trg = it_zeledtl-TARGET_I * conv_sec.

append it_output1.

endloop.

sort it_output1 ascending by subgid subopn srno1.

clear ch1.

loop at it_zrouteledtl.

move-corresponding it_zrouteledtl to it_output.

select single description from zpromast into it_output-desc

where subgid = it_zrouteledtl-subgid and

subopn = it_zrouteledtl-subopn and

werks in p_werks.

it_output-add_desc = it_zrouteledtl-description.

it_output-freq = it_zrouteledtl-frequency.

it_output-div_freq = it_zrouteledtl-div_freq.

it_output-men = it_zrouteledtl-men.

it_output-ct = it_zrouteledtl-cy_time * conv_sec.

it_output-cw = it_zrouteledtl-wc_time * conv_sec.

it_output-ideal_ct = it_zrouteledtl-cy_trg_time * conv_sec.

it_output-ideal_cw = it_zrouteledtl-wc_trg_time * conv_sec.

if it_zrouteledtl-offline1 = '1'.

it_output-offline = 'No'.

else.

it_output-offline = 'Yes'.

endif.

append it_output.

endloop.

loop at it_output.

if it_output-offline = 'Yes'.

ch1 = 0.

else.

ch1 = 1.

endif.

loop at it_output1 where subgid = it_output-subgid and

subopn = it_output-subopn.

a_trg = A_trg + it_output1-A_trg.

b_Trg = b_Trg + it_output1-b_Trg.

g_Trg = g_Trg + it_output1-g_Trg.

p_Trg = p_Trg + it_output1-p_Trg.

m_Trg = m_Trg + it_output1-m_Trg.

t_Trg = t_Trg + it_output1-t_Trg.

i_Trg = i_Trg + it_output1-i_Trg.

autocycle = autocycle + it_output1-Autocycle.

online_p_time = online_p_time + it_output1-online_p_time.

offline_p_time = offline_p_time + it_output1-offline_p_time.

endloop.

it_output-autocycle = ( autocycle * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-a_trg = ( a_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-b_trg = ( b_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-g_trg = ( g_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-p_trg = ( p_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-m_trg = ( m_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-t_trg = ( t_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-i_trg = ( i_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-online_time = ( it_output-ct - it_output-autocycle ) * ch1.

it_output-offline_time = ( it_output-ct - it_output-cw ) + it_output-autocycle.

it_output-online_p_time = ( online_p_time * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

it_output-offline_p_time = ( offline_p_time * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.

clear : a_trg,b_trg,g_trg,p_trg,m_trg,t_trg,i_trg,online_p_time,offline_p_time,ch1,ch2,it_zeledtl,

autocycle,online_p_time,offline_p_time,zroutpromast.

modify it_output.

endloop.

ENDFORM. " data_retrieval

&----


*& Form build_fieldcatalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM build_fieldcatalog .

  • Please not there are a number of differences between the structure of

  • ALVtree fieldcatalogs and ALVgrid fieldcatalogs.

  • For example the field seltext_m is replace by scrtext_m in ALVtree.

DATA: COL_POS TYPE I VALUE 0.

fieldcatalog-fieldname = 'SRNO'.

fieldcatalog-SCRTEXT_L = 'Sr No.'.

fieldcatalog-SCRTEXT_m = 'Sr No.'.

fieldcatalog-SCRTEXT_s = 'Sr No.'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'SUBGID'. "Field name in itab

fieldcatalog-SCRTEXT_L = 'Sub Opn GID'. "Column text

fieldcatalog-SCRTEXT_m = 'Sub Opn GID'. "Column text

fieldcatalog-SCRTEXT_s = 'Sub Opn GID'. "Column text

fieldcatalog-col_pos = COL_POS. "Column position

fieldcatalog-outputlen = 15. "Column width

fieldcatalog-emphasize = 'X'. "Emphasize (X or SPACE)

fieldcatalog-key = 'X'. "Key Field? (X or SPACE)

  • fieldcatalog-do_sum = 'X'. "Sum Column?

  • fieldcatalog-no_zero = 'X'. "Don't display if zero

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'SUBOPN'.

fieldcatalog-SCRTEXT_L = 'Sub Opn'.

fieldcatalog-SCRTEXT_m = 'Sub Opn'.

fieldcatalog-SCRTEXT_s = 'Sub Opn'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-emphasize = 'X'. "Emphasize (X or SPACE)

fieldcatalog-key = 'X'. "Key Field? (X or SPACE)

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'MOVETYPE'.

fieldcatalog-SCRTEXT_L = 'Movetype'.

fieldcatalog-SCRTEXT_m = 'Movetype'.

fieldcatalog-SCRTEXT_s = 'Movetype'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'DESC'.

fieldcatalog-SCRTEXT_L = 'Description'.

fieldcatalog-SCRTEXT_m = 'Description'.

fieldcatalog-SCRTEXT_s = 'Description'.

fieldcatalog-outputlen = 600.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'ADD_DESC'.

fieldcatalog-SCRTEXT_L = 'Add. Description'.

fieldcatalog-SCRTEXT_m = 'Add. Description'.

fieldcatalog-SCRTEXT_s = 'Add. Description'.

fieldcatalog-outputlen = 100.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'FREQ'.

fieldcatalog-SCRTEXT_L = 'Frequency'.

fieldcatalog-SCRTEXT_m = 'Frequency'.

fieldcatalog-SCRTEXT_s = 'Frequency'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'DIV_FREQ'.

fieldcatalog-SCRTEXT_L = 'Div Freq'.

fieldcatalog-SCRTEXT_m = 'Div Freq'.

fieldcatalog-SCRTEXT_s = 'Div Freq'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'MEN'.

fieldcatalog-SCRTEXT_L = 'Men'.

fieldcatalog-SCRTEXT_m = 'Men'.

fieldcatalog-SCRTEXT_s = 'Men'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat..

CLEAR fieldcatalog.

  • COL_POS = COL_POS + 1.

  • fieldcatalog-fieldname = 'BATCH'.

  • fieldcatalog-SCRTEXT_L = 'Batch/Div Freq'.

  • fieldcatalog-SCRTEXT_m = 'Batch/Div Freq'.

  • fieldcatalog-SCRTEXT_s = 'Batch/Div Freq'.

  • fieldcatalog-outputlen = 15.

  • fieldcatalog-col_pos = COL_POS.

  • APPEND fieldcatalog TO gd_fieldcat.

  • CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'OFFLINE'.

fieldcatalog-SCRTEXT_L = 'Offline'.

fieldcatalog-SCRTEXT_m = 'Offline'.

fieldcatalog-SCRTEXT_s = 'Offline'.

fieldcatalog-outputlen = 6.

fieldcatalog-col_pos = COL_POS.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'CT'.

fieldcatalog-SCRTEXT_L = 'Cycle Time'.

fieldcatalog-SCRTEXT_m = 'Cycle Time'.

fieldcatalog-SCRTEXT_s = 'Cycle Time'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'CW'.

fieldcatalog-SCRTEXT_L = 'Work Content'.

fieldcatalog-SCRTEXT_m = 'Work Content'.

fieldcatalog-SCRTEXT_s = 'Work Content'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'IDEAL_CT'.

fieldcatalog-SCRTEXT_L = 'Ideal CT'.

fieldcatalog-SCRTEXT_m = 'Ideal CT'.

fieldcatalog-SCRTEXT_s = 'Ideal CT'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'IDEAL_CW'.

fieldcatalog-SCRTEXT_L = 'Ideal CW'.

fieldcatalog-SCRTEXT_m = 'Ideal CW'.

fieldcatalog-SCRTEXT_s = 'Ideal CW'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'A_TRG'.

fieldcatalog-SCRTEXT_L = 'Target A'.

fieldcatalog-SCRTEXT_m = 'Target A'.

fieldcatalog-SCRTEXT_s = 'Target A'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'B_TRG'.

fieldcatalog-SCRTEXT_L = 'Target B'.

fieldcatalog-SCRTEXT_m = 'Target B'.

fieldcatalog-SCRTEXT_s = 'Target B'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'G_TRG'.

fieldcatalog-SCRTEXT_L = 'Target G'.

fieldcatalog-SCRTEXT_m = 'Target G'.

fieldcatalog-SCRTEXT_s = 'Target G'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'P_TRG'.

fieldcatalog-SCRTEXT_L = 'Target P'.

fieldcatalog-SCRTEXT_m = 'Target P'.

fieldcatalog-SCRTEXT_s = 'Target P'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'M_TRG'.

fieldcatalog-SCRTEXT_L = 'Target M'.

fieldcatalog-SCRTEXT_m = 'Target M'.

fieldcatalog-SCRTEXT_s = 'Target M'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'T_TRG'.

fieldcatalog-SCRTEXT_L = 'Target T'.

fieldcatalog-SCRTEXT_m = 'Target T'.

fieldcatalog-SCRTEXT_s = 'Target T'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'I_TRG'.

fieldcatalog-SCRTEXT_L = 'Target I'.

fieldcatalog-SCRTEXT_m = 'Target I'.

fieldcatalog-SCRTEXT_s = 'Target I'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'AUTOCYCLE'.

fieldcatalog-SCRTEXT_L = 'AutoCycle'.

fieldcatalog-SCRTEXT_m = 'AutoCycle'.

fieldcatalog-SCRTEXT_s = 'AutoCycle'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'ONLINE_TIME'.

fieldcatalog-SCRTEXT_L = 'Online Time'.

fieldcatalog-SCRTEXT_m = 'Online Time'.

fieldcatalog-SCRTEXT_s = 'Online Time'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'OFFLINE_TIME'.

fieldcatalog-SCRTEXT_L = 'Offline Time'.

fieldcatalog-SCRTEXT_m = 'Offline Time'.

fieldcatalog-SCRTEXT_s = 'Offline Time'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'ONLINE_P_TIME'.

fieldcatalog-SCRTEXT_L = 'Online Process Time'.

fieldcatalog-SCRTEXT_m = 'Online Process Time'.

fieldcatalog-SCRTEXT_s = 'Online Process Time'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

COL_POS = COL_POS + 1.

fieldcatalog-fieldname = 'OFFLINE_P_TIME'.

fieldcatalog-SCRTEXT_L = 'Offline Process Time'.

fieldcatalog-SCRTEXT_m = 'Offline Process Time'.

fieldcatalog-SCRTEXT_s = 'Offline Process Time'.

fieldcatalog-outputlen = 15.

fieldcatalog-col_pos = COL_POS.

fieldcatalog-do_sum = 'X'.

APPEND fieldcatalog TO gd_fieldcat.

CLEAR fieldcatalog.

ENDFORM. " build_fieldcatalog

&----


*& Form build_layout

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM build_layout .

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

gd_layout-totals_text = 'Totals'(201).

gd_layout-totals_only = 'X'.

  • gd_layout-f2code = 'DISP'. "Sets fcode for when double

  • "click(press f2)

gd_layout-zebra = 'X'.

  • gd_layout-group_change_edit = 'X'.

  • gd_layout-header_text = 'helllllo'.

ENDFORM. " build_layout

&----


*& Form build_hierarchy_header

&----


  • text

----


  • <--P_GD_HIERARCHY_HEADER text

----


FORM build_hierarchy_header CHANGING

p_hierarchy_header TYPE treev_hhdr.

p_hierarchy_header-heading = 'Drill Down For Detail'(022).

p_hierarchy_header-tooltip = 'This is the Hierarchy Header !'(014).

p_hierarchy_header-width = 30.

p_hierarchy_header-width_pix = ''.

ENDFORM. " build_hierarchy_header

&----


*& Form build_report_title

&----


  • text

----


  • -->P_GD_REPORT_TITLE text

  • -->P_GD_LOGO text

----


FORM build_report_title using

pt_report_title TYPE slis_t_listheader

pa_logo TYPE sdydo_value.

DATA: ls_line TYPE slis_listheader,

ld_date(10) TYPE c,

string1 type string,string2 type string.

  • List Heading Line(TYPE H)

  • concatenate 'Material: ' p_matnr-low into string1 separated by space.

CLEAR ls_line.

ls_line-typ = 'H'.

ls_line-key = 'MOST Operation'.

concatenate p_gid-low p_opn-low into string2 separated by space.

ls_line-info = string2.

APPEND ls_line TO pt_report_title.

ls_line-typ = 'S'.

ls_line-key = 'Text'.

select single DESCRIPTION from zroutpromast into string1 where mop_gid = p_gid-low

and mop_opn = p_opn-low

and werks = p_werks-low.

ls_line-info = string1.

APPEND ls_line TO pt_report_title.

*

  • ls_line-typ = 'S'.

  • ls_line-key = 'Routing Counter:'.

  • ls_line-info = counter.

  • APPEND ls_line TO pt_report_title.

  • Status Line(TYPE S)

ld_date(2) = sy-datum+6(2).

ld_date+2(1) = '/'.

ld_date3(2) = sy-datum4(2).

ld_date+5(1) = '/'.

ld_date+6(4) = sy-datum(4).

ls_line-typ = 'S'.

ls_line-key = 'Date'.

ls_line-info = ld_date.

APPEND ls_line TO pt_report_title.

  • Action Line(TYPE A)

  • CLEAR ls_line.

  • ls_line-typ = 'A'.

  • CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space.

  • APPEND ls_line TO pt_report_title.

ENDFORM. " build_report_title

&----


*& Form build_variant

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM build_variant .

gd_variant-report = sy-repid.

ENDFORM. " build_variant

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'STATUS1'.

SET TITLEBAR 'ZTITLE'.

IF gd_tree IS INITIAL.

  • Create ALVtree (must be performed within screen PBO module)

PERFORM create_alvtree_container.

PERFORM create_object_in_container.

PERFORM create_empty_alvtree_control.

perform change_toolbar.

PERFORM create_alvtree_hierarchy.

ENDIF.

CALL METHOD cl_gui_cfw=>flush.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when 'EXIT' or 'BACK' or 'CANC'.

call method gd_tree->free.

leave program.

when others.

call method cl_gui_cfw=>dispatch.

endcase.

clear ok_code.

call method cl_gui_cfw=>flush.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form create_alvtree_container

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM create_alvtree_container .

gd_tree_container_name = 'SCREEN_CONTAINER'.

create object gd_custom_container

exporting

container_name = gd_tree_container_name

exceptions

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

if sy-subrc <> 0.

message x208(00) with 'ERROR'.

endif.

ENDFORM. " create_alvtree_container

&----


*& Form create_object_in_container

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM create_object_in_container .

create object gd_tree

exporting

parent = gd_custom_container

node_selection_mode = cl_gui_column_tree=>node_sel_mode_single

item_selection = 'X'

no_html_header = ''

no_toolbar = ''

exceptions

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

illegal_node_selection_mode = 5

failed = 6

illegal_column_name = 7.

if sy-subrc <> 0.

message x208(00) with 'ERROR'.

endif.

ENDFORM. " create_object_in_container

&----


*& Form create_empty_alvtree_control

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM create_empty_alvtree_control .

CLEAR: it_emptytab.

REFRESH: it_emptytab.

CALL METHOD gd_tree->set_table_for_first_display

EXPORTING

is_hierarchy_header = gd_hierarchy_header

it_list_commentary = gd_report_title

  • i_logo = gd_logo

  • i_background_id = 'ALV_BACKGROUND'

i_save = 'A'

is_variant = gd_variant

CHANGING

it_outtab = it_emptytab "Must be empty

it_fieldcatalog = gd_fieldcat.

ENDFORM. " create_empty_alvtree_control

&----


*& Form create_alvtree_hierarchy

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM create_alvtree_hierarchy .

data: ls_sflight type sflight,

lt_sflight type sflight occurs 0.

data: ld_mop_gid_key type lvc_nkey,

ld_mop_opn_key type lvc_nkey.

loop at it_output.

perform add_ekko_node using it_output

''

changing ld_mop_gid_key.

loop at it_output1 where subgid eq it_output-subgid

and subopn eq it_output-subopn.

perform add_ekpo_line using it_output1

ld_mop_gid_key

changing ld_mop_opn_key.

endloop.

endloop.

  • calculate totals

call method gd_tree->update_calculations.

  • this method must be called to send the data to the frontend

call method gd_tree->frontend_update.

ENDFORM. " create_alvtree_hierarchy

&----


*& Form add_ekko_node

&----


  • text

----


  • -->P_IT_OUTPUT text

  • -->P_2478 text

  • <--P_LD_MOP_GID_KEY text

----


FORM add_ekko_node USING ps_output like it_output

VALUE(p_relate_key)

CHANGING p_node_key.

data: ld_node_text type lvc_value,

ls_sflight type sflight.

data : text128(128).

  • Set item-layout

concatenate ps_output-subgid ps_output-subopn into text128 separated by space.

data: lt_item_layout type lvc_t_layi,

ls_item_layout type lvc_s_layi.

ls_item_layout-t_image = '@3P@'.

ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.

ls_item_layout-style = cl_gui_column_tree=>style_default.

ld_node_text = text128.

append ls_item_layout to lt_item_layout.

  • Add node

call method gd_tree->add_node

exporting

i_relat_node_key = p_relate_key

i_relationship = cl_gui_column_tree=>relat_last_child

i_node_text = ld_node_text

is_outtab_line = ps_output

it_item_layout = lt_item_layout

importing

e_new_node_key = p_node_key.

ENDFORM. " add_ekko_node

&----


*& Form add_ekpo_line

&----


  • text

----


  • -->P_IT_OUTPUT1 text

  • -->P_LD_MOP_GID_KEY text

  • <--P_LD_MOP_OPN_KEY text

----


FORM add_ekpo_line USING Ps_OUTPUT1 like it_output1

value(p_relate_key)

CHANGING p_node_key.

data: ld_node_text type lvc_value,

ls_sflight type sflight.

data : text128(128).

concatenate ps_output1-srno ps_output1-movetype into text128 separated by space.

  • Set item-layout

data: lt_item_layout type lvc_t_layi,

ls_item_layout type lvc_s_layi.

ls_item_layout-t_image = '@3P@'.

ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.

ls_item_layout-style = cl_gui_column_tree=>style_default.

ld_node_text = text128.

append ls_item_layout to lt_item_layout.

  • Add node

call method gd_tree->add_node

exporting

i_relat_node_key = p_relate_key

i_relationship = cl_gui_column_tree=>relat_last_child

i_node_text = ld_node_text

is_outtab_line = ps_output1

it_item_layout = lt_item_layout

importing

e_new_node_key = p_node_key.

ENDFORM. " add_ekpo_line

&----


*& Form change_toolbar

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM change_toolbar .

  • get toolbar control

call method gd_tree->get_toolbar_object

importing

er_toolbar = mr_toolbar.

check not mr_toolbar is initial.

  • add seperator to toolbar

call method mr_toolbar->add_button

exporting

fcode = ''

icon = ''

butn_type = cntb_btype_sep

text = ''

quickinfo = 'This is a Seperator'. "#EC NOTEXT

  • add Standard Button to toolbar (for Delete Subtree)

call method mr_toolbar->add_button

exporting

fcode = 'EXPORT' "Function code of button

icon = '@49@' "Icon ID (see )

butn_type = cntb_btype_button "Button type

text = '' "Button text

quickinfo = 'Download To Excel'. "Quick info text

  • add Dropdown Button to toolbar (for Insert Line)

  • call method mr_toolbar->add_button

  • exporting

  • fcode = 'INSERT_LC' "Function code of button

  • icon = '@17@' "Icon ID (see )

  • butn_type = cntb_btype_dropdown "Button type

  • text = '' "Button text

  • quickinfo = 'Insert Line'. "Quick info text

  • set event-handler for toolbar-control

data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.

create object toolbar_event_receiver.

set handler toolbar_event_receiver->on_function_selected

for mr_toolbar.

set handler toolbar_event_receiver->on_toolbar_dropdown

for mr_toolbar.

ENDFORM. " change_toolbar

Edited by: Darshan Shah on Jan 2, 2008 1:31 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 07:24 AM

    Gui patch was not available on my pc

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.