Академический Документы
Профессиональный Документы
Культура Документы
Graphics (Lesson-1)
The key function modules used when calling a bar chart as a window:
1. GRAPH_SET_CUA_STATUS – Set graphics GUI status and allows creating application-specific
menu entries.
2. GRAPH_RECEIVE – Enables you to wait for user input.
The key function modules used when calling a bar chart as a control:
1. BARCHART_CREATE – Calls bar chart as a control
INCLUDE sgrccnst.
INCLUDE lbarccon.
INCLUDE barcdata.
graph_profile-prf_gruppe = gruppe.
graph_profile-prf_name = name.
graph_profile-prf_index = index.
EXPORTING
start = '01.01.2012;'
end = '31.12.2012;'.
IMPORTING
id = chart.
EXPORTING
chart_id = chart
width = 4000.
boxes-id = 1.
boxes-type = bc_const-row_box.
boxes-chart_id = chart.
boxes-form_type = 'B1'.
boxes-color_type = 'B0'.
APPEND boxes.
box_vals-id = boxes-id.
box_vals-fl = '0'.
APPEND box_vals.
positions-obj_id = boxes-id.
positions-obj_type = bc_const-box_object.
positions-chart_id = chart.
positions-row_number = 0.
APPEND positions.
EXPORTING
fl = bc_const-chart_title_box
id = chart
val = val.
EXPORTING
size = 100
start = '01.01.2012;'
unit = '5'
IMPORTING
id = section.
EXPORTING
chart_id = chart
color_type = 'R1'
section_id = section
unit = '5'.
EXPORTING
chart_id = chart
color_type = 'R2'
section_id = section
unit = '3'.
box_vals
positions
USING chart.
node_vals
positions
USING chart.
DO.
EXPORTING
confirm = space
profile = graph_profile
stat = stat
TABLES
boxes = boxes
box_vals = box_vals
deletions = deletions
links = links
link_vals = link_vals
nodes = nodes
node_vals = node_vals
positions = positions.
IMPORTING
mcode = m_typ
EXCEPTIONS
inv_communication = 1
no_batch = 2.
EXIT.
ENDIF.
CASE m_typ.
WHEN sgrc_const-m_typ_d.
EXIT.
WHEN sgrc_const-m_typ_i.
IMPORTING
graph_cmd = graph_cmd
TABLES
boxes = boxes
box_vals = box_vals
deletions = deletions
nodes = nodes
node_vals = node_vals
positions = positions
links = links
link_vals = link_vals
EXCEPTIONS
inv_winid = 1.
abap_cmd = graph_cmd.
ENDCASE.
ENDDO.
id TYPE i
format
color
text
row TYPE i.
boxes-id = id.
boxes-type = bc_const-row_box.
boxes-chart_id = chart.
boxes-form_type = format.
boxes-color_type = color.
APPEND boxes.
box_vals-id = boxes-id.
box_vals-fl = '0'.
box_vals-val = text.
APPEND box_vals.
positions-obj_id = boxes-id.
positions-obj_type = bc_const-box_object.
positions-chart_id = boxes-chart_id.
positions-row_number = row.
APPEND positions.
ENDFORM.
ENDFORM.
nodes-id = 1.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '12.01.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '27.06.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '00'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 1.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 2.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '02.02.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '25.07.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '01'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 2.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 3.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '01.04.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '25.09.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '02'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 3.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 4.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '11.02.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '11.07.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '00'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 4.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 5.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '01.05.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '11.12.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '01'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 5.
APPEND positions.
ENDFORM.
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
REPORT zbarchartcontrol.
INCLUDE sgrccnst.
INCLUDE lbarccon.
INCLUDE barcdata.
INCLUDE <ctldef>.
this_dynnr = '100'.
this_repid = sy-repid.
EXPORTING
owner_repid = this_repid
dynnr = this_dynnr
CHANGING
handle = barc_ocx.
graph_profile-prf_gruppe = gruppe.
graph_profile-prf_name = name.
graph_profile-prf_index = index.
EXPORTING
start = '01.01.2012;'
end = '31.12.2012;'.
IMPORTING
id = chart.
EXPORTING
chart_id = chart
width = 4000.
boxes-type = bc_const-row_box.
boxes-chart_id = chart.
boxes-form_type = 'B1'.
boxes-color_type = 'B0'.
APPEND boxes.
box_vals-id = boxes-id.
box_vals-fl = '0'.
APPEND box_vals.
positions-obj_id = boxes-id.
positions-obj_type = bc_const-box_object.
positions-chart_id = chart.
positions-row_number = 0.
APPEND positions.
EXPORTING
fl = bc_const-chart_title_box
id = chart
val = val.
EXPORTING
size = 100
start = '01.01.2012;'
unit = '5'
IMPORTING
id = section.
EXPORTING
chart_id = chart
color_type = 'R1'
section_id = section
unit = '5'.
EXPORTING
chart_id = chart
color_type = 'R2'
section_id = section
unit = '3'.
box_vals
positions
USING chart.
node_vals
positions
USING chart.
TABLES
all_boxes = all_boxes
all_box_vals = all_box_vals
all_links = all_links
all_link_vals = all_link_vals
all_nodes = all_nodes
all_node_vals = all_node_vals
all_positions = all_positions
boxes = boxes
box_vals = box_vals
deletions = deletions
links = links
link_vals = link_vals
nodes = nodes
node_vals = node_vals
positions = positions.
id TYPE i
format
color
text
row TYPE i.
boxes-id = id.
boxes-type = bc_const-row_box.
boxes-chart_id = chart.
boxes-form_type = format.
boxes-color_type = color.
APPEND boxes.
box_vals-id = boxes-id.
box_vals-fl = '0'.
box_vals-val = text.
APPEND box_vals.
positions-obj_id = boxes-id.
positions-obj_type = bc_const-box_object.
positions-chart_id = boxes-chart_id.
positions-row_number = row.
APPEND positions.
ENDFORM.
ENDFORM.
nodes-id = 1.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '12.01.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '27.06.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '00'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 1.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 2.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '02.02.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '25.07.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '01'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 2.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 3.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '01.04.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '25.09.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '02'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 3.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 4.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '11.02.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '11.07.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '00'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 4.
APPEND positions.
*----------------------------------------------------------------------*
nodes-id = 5.
nodes-chart_id = chart.
APPEND nodes.
node_vals-id = nodes-id.
node_vals-chart_id = nodes-chart_id.
node_vals-fl = '1'.
node_vals-val = '01.05.2012;'.
APPEND node_vals.
node_vals-fl = '2'.
node_vals-val = '11.12.2012;'.
APPEND node_vals.
node_vals-fl = bc_const-add_layer.
node_vals-val = '01'.
APPEND node_vals.
positions-obj_id = nodes-id.
positions-obj_type = bc_const-node_object.
positions-chart_id = nodes-chart_id.
positions-row_number = 5.
APPEND positions.
ENDFORM.
EXPORTING
abap_cmd = abap_cmd
confirm = 'X'
profile = graph_profile
stat = stat
status_text = status_text
control_handle = barc_ocx
TABLES
boxes = boxes
box_vals = box_vals
deletions = deletions
links = links
link_vals = link_vals
nodes = nodes
node_vals = node_vals
positions = positions
EXCEPTIONS
err_in_profile = 1
inv_profile =2
inv_winid = 3.
ENDMODULE.
ENDMODULE.
save_ok_code = ok_code.
CLEAR ok_code.
CASE save_ok_code.
WHEN 'EXIT'.
PERFORM end_100.
WHEN 'QUIT'.
PERFORM end_100.
WHEN 'BACK'.
PERFORM end_100.
WHEN OTHERS.
IF save_ok_code(4) = sgrc_const-event
OR save_ok_code(4) = sgrc_const-shell_event.
PERFORM user_command.
ELSE. "function Code
handle = barc_ocx
function_code = save_ok_code
IMPORTING
return = retval.
IF retval = 0.
PERFORM user_command.
IF abap_cmd = bc_const-get_selection
OR abap_cmd = bc_const-get_overlap
OR abap_cmd = bc_const-get_settings
OR abap_cmd = bc_const-get_color.
EXPORTING
abap_cmd = abap_cmd
stat = stat
control_handle = barc_ocx.
PERFORM user_command.
ENDIF.
ELSE.
ENDIF.
ENDIF.
ENDCASE.
ENDMODULE.
FORM end_100.
EXPORTING
control_handle = barc_ocx
at_control_destroy = sgrc_const-yes.
h_control = barc_ocx
EXCEPTIONS
OTHERS = 1.
SET SCREEN 0.
LEAVE SCREEN.
ENDFORM.
FORM user_command.
EXPORTING
control_handle = barc_ocx
IMPORTING
graph_cmd = graph_cmd
graph_cmd_info = graph_cmd_info
gr_sel_field = gr_sel_field
layer_type = layer_kind
settings = settings
symboltype = symboltype
TABLES
boxes = boxes
box_vals = box_vals
deletions = deletions
links = links
link_vals = link_vals
nodes = nodes
node_vals = node_vals
positions = positions
EXCEPTIONS
inv_winid = 1.
CLEAR: abap_cmd,
status_text.
CASE graph_cmd.
WHEN bc_const-ask_for_delete.
abap_cmd = graph_cmd.
WHEN bc_const-ask_for_scaleleft.
abap_cmd = graph_cmd.
WHEN bc_const-ask_for_scaleright.
abap_cmd = graph_cmd.
WHEN bc_const-ask_for_back.
abap_cmd = graph_cmd.
WHEN bc_const-ask_for_quit.
abap_cmd = graph_cmd.
WHEN bc_const-ask_for_exit.
abap_cmd = graph_cmd.
ENDCASE.
graph_cmd = graph_cmd
TABLES
all_boxes = all_boxes
all_box_vals = all_box_vals
all_links = all_links
all_link_vals = all_link_vals
all_nodes = all_nodes
all_node_vals = all_node_vals
all_positions = all_positions
boxes = boxes
box_vals = box_vals
deletions = deletions
links = links
link_vals = link_vals
nodes = nodes
node_vals = node_vals
positions = positions.
ENDFORM.
///////////////////////////////////////////////////////////////////////////////////////////////////////
Lesson -2 will teach you all about Bar Chart Profile & making an interactive planning board.
Manish Meshram
Nov 10, 2013 8:30 AM
Can you share where is 2nd lesson link on portal.
Regards
Manis
Looking at Author's content list, it is clear that lesson 2 does not exist.
Regards
Manish
nilesh shrivastava
Dec 2, 2012 5:17 AM