Joined: 19 Feb 2008 Posts: 30 Location: Ростов-на-Дону
Posted: Thu Jun 05, 2008 2:14 pm Post subject: ALV tree
Доброго всем дня!
Делаю alv tree в котором выводится складской запас по материалам при этом возникла такая ситуация, при выводе данных по заводу вцелом материал отражается на одном складе, а фактически находится на следующем заводе (по порядку), когда задаю конкретный завод-склад, все нормально. Подскажите в какую сторону смотреть, может кто сталкивался с аналогичной проблемой.
Joined: 19 Feb 2008 Posts: 30 Location: Ростов-на-Дону
Posted: Thu Jun 05, 2008 5:14 pm Post subject:
Code:
sort lt_rezult by palnt sklad manuf sapn.
* add data to tree
data: palnt type lvc_nkey,
sklad type lvc_nkey,
h_manuf type lvc_nkey,
l_last_key type lvc_nkey.
loop at lt_rezult into ls_rezult.
on change of ls_rezult-palnt.
perform add_palnt_line using ls_rezult
''
changing palnt.
endon.
on change of ls_rezult-sklad.
perform add_sklad_line using ls_rezult
palnt
changing sklad.
endon.
on change of ls_rezult-manuf.
perform add_manuf_line using ls_rezult
sklad
changing h_manuf.
endon.
perform add_complete_line using ls_rezult
h_manuf
changing l_last_key.
endloop.
class cl_gui_column_tree definition load.
class cl_gui_cfw definition load.
data tree1 type ref to cl_gui_alv_tree.
data mr_toolbar type ref to cl_gui_toolbar.
include <icon>.
include bcalv_toolbar_event_receiver.
include bcalv_tree_event_receiver.
data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.
data: gt_mard type mard occurs 0, "Output-Table
gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
ok_code like sy-ucomm. "OK-Code
TABLES: T001W, T001L.
SELECT-OPTIONS: so_werks FOR T001W-werks,
so_lgort FOR T001L-lgort.
start-of-selection.
end-of-selection.
call screen 100.
*&---------------------------------------------------------------------*
*& Module PBO OUTPUT
*&---------------------------------------------------------------------*
* process before output
*----------------------------------------------------------------------*
module pbo output.
set pf-status 'MAIN100'.
if tree1 is initial.
perform init_tree.
endif.
call method cl_gui_cfw=>flush.
endmodule. " PBO OUTPUT
*&---------------------------------------------------------------------*
*& Module PAI INPUT
*&---------------------------------------------------------------------*
* process after input
*----------------------------------------------------------------------*
module pai input.
case ok_code.
when 'EXIT' or 'BACK' or 'CANC'.
perform exit_program.
*&---------------------------------------------------------------------*
*& Form build_fieldcatalog
*&---------------------------------------------------------------------*
* build fieldcatalog for structure mard
*----------------------------------------------------------------------*
form build_fieldcatalog.
* get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'MARD'
changing
ct_fieldcat = gt_fieldcatalog.
* change fieldcatalog
data: ls_fieldcatalog type lvc_s_fcat.
loop at gt_fieldcatalog into ls_fieldcatalog.
case ls_fieldcatalog-fieldname.
when 'WERKS' or 'LGORT' or 'MATNR'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
when 'LABST' or 'UMLME' or 'INSME' or 'EINME' or 'SPEME' or 'RETME'.
ls_fieldcatalog-do_sum = 'X'.
endcase.
modify gt_fieldcatalog from ls_fieldcatalog.
endloop.
endform. " build_fieldcatalog
*&---------------------------------------------------------------------*
*& Form build_hierarchy_header
*&---------------------------------------------------------------------*
* build hierarchy-header-information
*----------------------------------------------------------------------*
* -->P_L_HIERARCHY_HEADER strucxture for hierarchy-header
*----------------------------------------------------------------------*
form build_hierarchy_header changing
p_hierarchy_header type treev_hhdr.
endform. " build_hierarchy_header
*&---------------------------------------------------------------------*
*& Form exit_program
*&---------------------------------------------------------------------*
* free object and leave program
*----------------------------------------------------------------------*
form exit_program.
call method tree1->free.
leave program.
endform. " exit_program
*&---------------------------------------------------------------------*
*& Form build_header
*&---------------------------------------------------------------------*
* build table for html_header
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form build_comment using
pt_list_commentary type slis_t_listheader
p_logo type sdydo_value.
data: ls_line type slis_listheader.
*
* LIST HEADING LINE: TYPE H
clear ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree-demo: flight-overview'. "#EC NOTEXT
append ls_line to pt_list_commentary.
* STATUS LINE: TYPE S
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'valid until'. "#EC NOTEXT
ls_line-info = 'January 29 1999'. "#EC NOTEXT
append ls_line to pt_list_commentary.
ls_line-key = 'time'.
ls_line-info = '2.00 pm'. "#EC NOTEXT
append ls_line to pt_list_commentary.
* ACTION LINE: TYPE A
clear ls_line.
ls_line-typ = 'A'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'actual data'. "#EC NOTEXT
append ls_line to pt_list_commentary.
p_logo = 'ENJOYSAP_LOGO'.
endform.
*&---------------------------------------------------------------------*
*& Form create_hierarchy
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form create_hierarchy.
data: ls_mard type mard,
lt_mard type mard occurs 0.
* get data
IF so_werks IS INITIAL AND
so_lgort IS INITIAL.
SELECT * from mard into table lt_mard
UP TO 200 ROWS .
ELSE.
SELECT * from mard into table lt_mard
WHERE werks IN so_werks
AND lgort IN so_lgort.
ENDIF.
sort lt_mard by werks lgort matnr.
* add data to tree
data: l_werks_key type lvc_nkey,
l_lgort_key type lvc_nkey,
l_last_key type lvc_nkey.
loop at lt_mard into ls_mard.
on change of ls_mard-werks.
perform add_werks_line using ls_mard
''
changing l_werks_key.
endon.
on change of ls_mard-lgort.
perform add_lgort_line using ls_mard
l_werks_key
changing l_lgort_key.
endon.
perform add_complete_line using ls_mard
l_lgort_key
changing l_last_key.
endloop.
* this method must be called to send the data to the frontend
call method tree1->frontend_update.
endform. " create_hierarchy
*&---------------------------------------------------------------------*
*& Form add_carrid_line
*&---------------------------------------------------------------------*
* add hierarchy-level 1 to tree
*----------------------------------------------------------------------*
* -->P_LS_mard mard
* -->P_RELEATKEY relatkey
* <-->p_node_key new node-key
*----------------------------------------------------------------------*
form add_werks_line using ps_mard type mard
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_mard type mard.
* 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 = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
append ls_item_layout to lt_item_layout.
endform. " add_carrid_line
*&---------------------------------------------------------------------*
*& Form add_lgort_line
*&---------------------------------------------------------------------*
* add hierarchy-level 2 to tree
*----------------------------------------------------------------------*
* -->P_LS_mard mard
* -->P_RELEATKEY relatkey
* <-->p_node_key new node-key
*----------------------------------------------------------------------*
form add_lgort_line using ps_mard type mard
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_mard type mard.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
append ls_item_layout to lt_item_layout.
endform. " add_connid_line
*&---------------------------------------------------------------------*
*& Form add_cmplete_line
*&---------------------------------------------------------------------*
* add hierarchy-level 3 to tree
*----------------------------------------------------------------------*
* -->P_LS_mard mard
* -->P_RELEATKEY relatkey
* <-->p_node_key new node-key
*----------------------------------------------------------------------*
form add_complete_line using ps_mard type mard
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
append ls_item_layout to lt_item_layout.
endform. " add_complete_line
*&---------------------------------------------------------------------*
*& Form register_events
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form register_events.
* define the events which will be passed to the backend
data: lt_events type cntl_simple_events,
l_event type cntl_simple_event.
* define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_click.
append L_EVENT to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
append L_EVENT to lt_events.
* set Handler
data: l_event_receiver type ref to lcl_tree_event_receiver.
create object l_event_receiver.
set handler l_event_receiver->handle_node_ctmenu_request
for tree1.
set handler l_event_receiver->handle_node_ctmenu_selected
for tree1.
set handler l_event_receiver->handle_item_ctmenu_request
for tree1.
set handler l_event_receiver->handle_item_ctmenu_selected
for tree1.
endform. " register_events
*&---------------------------------------------------------------------*
*& Form change_toolbar
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form change_toolbar.
* get toolbar control
call method tree1->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
* set event-handler for toolbar-control
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
*&---------------------------------------------------------------------*
*& Form init_tree
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_tree.
* create fieldcatalog for structure mard
perform build_fieldcatalog.
* create container for alv-tree
data: l_tree_container_name(30) type c,
l_custom_container type ref to cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
if sy-batch is initial.
create object l_custom_container
exporting
container_name = l_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'. "#EC NOTEXT
endif.
endif.
* create Hierarchy-header
data l_hierarchy_header type treev_hhdr.
perform build_hierarchy_header changing l_hierarchy_header.
* create info-table for html-header
data: lt_list_commentary type slis_t_listheader,
l_logo type sdydo_value.
perform build_comment using
lt_list_commentary
l_logo.
* repid for saving variants
data: ls_variant type disvariant.
ls_variant-report = sy-repid.
* change fieldcatalog
data: ls_fieldcatalog type lvc_s_fcat.
loop at gt_fieldcatalog into ls_fieldcatalog.
case ls_fieldcatalog-fieldname.
when 'PALNT' or 'SKLAD' or 'MANUF' or 'SAPN' .
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
when 'QTY1' or 'TOTL1' or 'QTY2' or 'TOTL2' or 'TOTL3'.
ls_fieldcatalog-do_sum = 'X'.
endcase.
modify gt_fieldcatalog from ls_fieldcatalog.
endloop.
Выбор данных для заполнения структуры
Code:
select * from mchb into table t_mchb
where lvorm ne 'X'
and clabs ne 0
and werks in zavod
and lgort in skl.
select * from mch1 into table it_mch1
for all entries in t_mchb
where matnr = t_mchb-matnr
and charg = t_mchb-charg.
loop at it_mch1.
move it_mch1-cuobj_bm to mch_ob-objek_m .
append mch_ob.
endloop.
select * from ausp into table it_ausp
for all entries in mch_ob
where atinn = '0000000010' and
klart = '023' and
atwrt = 'DZ' and
objek = mch_ob-objek_m.
loop at it_ausp.
clear objek_m.
move it_ausp-objek to objek_m.
*Материалы демо
select * from mch1 into t_mch1
where cuobj_bm = objek_m.
endselect.
*Складские запасы
select * from mchb into table t_mchb
where matnr eq t_mch1-matnr and
charg eq t_mch1-charg and
lvorm ne 'X'
and clabs ne 0
and werks in zavod
and lgort in skl.
loop at t_mchb.
clear lt_rezult.
lt_rezult-palnt = t_mchb-werks.
lt_rezult-sklad = t_mchb-lgort.
*Производитель
clear manuf.
select single atwrt from ausp into manuf
where klart = '001' and
atinn = '0000000025' and
objek = t_mchb-matnr.
lt_rezult-manuf = manuf.
lt_rezult-sapn = t_mchb-matnr.
*Краткий текст материала
select single maktx into mat_txt from makt
where matnr eq t_mchb-matnr
and spras eq 'R' .
lt_rezult-desc = mat_txt.
lt_rezult-qty1 = t_mchb-clabs. " Êîëè÷åñòâî
*Стоимость запаса
select single * into _mbew from mbew
where matnr eq t_mchb-matnr
and bwtar eq t_mchb-charg
and bwkey eq t_mchb-werks.
if sy-subrc eq 0.
clear cena.
clear sum_skl.
cena = _mbew-salk3 / _mbew-lbkum.
sum_skl = t_mchb-clabs * cena.
lt_rezult-totl1 = sum_skl.
endif.
*Определяем признак партии DZ
clear priznac.
select single atwrt from ausp into priznac
where klart = '023' and
atinn = '0000000010' and
objek = it_ausp-objek.
*& Form build_fieldcatalog
*&---------------------------------------------------------------------*
* build fieldcatalog for structure mard
*----------------------------------------------------------------------*
form build_fieldcatalog.
* get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZRND_ALV_DEMO'
changing
ct_fieldcat = gt_fieldcatalog.
* change fieldcatalog
* change fieldcatalog
data: ls_fieldcatalog type lvc_s_fcat.
loop at gt_fieldcatalog into ls_fieldcatalog.
case ls_fieldcatalog-fieldname.
when 'PALNT' or 'SKLAD' or 'MANUF' or 'SAPN' .
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
when 'QTY1' or 'TOTL1' or 'QTY2' or 'TOTL2' or 'TOTL3'.
ls_fieldcatalog-do_sum = 'X'.
endcase.
modify gt_fieldcatalog from ls_fieldcatalog.
endloop.
endform. " build_fieldcatalog
*&---------------------------------------------------------------------*
*& Form build_hierarchy_header
*&---------------------------------------------------------------------*
*& Form build_header
*&---------------------------------------------------------------------*
* build table for html_header
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form build_comment using
pt_list_commentary type slis_t_listheader
p_logo type sdydo_value.
data: ls_line type slis_listheader.
*
* LIST HEADING LINE: TYPE H
clear ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree-demo: flight-overview'. "#EC NOTEXT
append ls_line to pt_list_commentary.
* STATUS LINE: TYPE S
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'valid until'. "#EC NOTEXT
ls_line-info = 'January 29 1999'. "#EC NOTEXT
append ls_line to pt_list_commentary.
ls_line-key = 'time'.
ls_line-info = '2.00 pm'. "#EC NOTEXT
append ls_line to pt_list_commentary.
* ACTION LINE: TYPE A
clear ls_line.
ls_line-typ = 'A'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'actual data'. "#EC NOTEXT
append ls_line to pt_list_commentary.
*& Form create_hierarchy
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form create_hierarchy.
data: ls_rezult TYPE ZRND_ALV_DEMO,
lt_rezult TYPE ZRND_ALV_DEMO OCCURS 0 WITH HEADER LINE.
data: t_mchb TYPE TABLE OF mchb WITH HEADER LINE,
it_mch1 TYPE TABLE OF mch1 WITH HEADER LINE,
t_mch1 TYPE mch1,
it_ausp TYPE TABLE OF ausp WITH HEADER LINE,
_mbew TYPE mbew.
DATA: BEGIN OF mch_ob OCCURS 0,
objek_m TYPE ausp-objek,
END OF mch_ob.
DATA: mat_txt TYPE makt-maktx,
objek_m TYPE mch1-cuobj_bm,
manuf TYPE ausp-atwrt,
cena TYPE mbew-salk3,
sum_skl TYPE mbew-salk3,
priznac TYPE ausp-atwrt.
* get data
select * from mchb into table t_mchb
where lvorm ne 'X'
and clabs ne 0
and werks in zavod
and lgort in skl.
select * from mch1 into table it_mch1
for all entries in t_mchb
where matnr = t_mchb-matnr
and charg = t_mchb-charg.
loop at it_mch1.
move it_mch1-cuobj_bm to mch_ob-objek_m.
append mch_ob.
endloop.
IF NOT mch_ob[] IS INITIAL.
select * from ausp into table it_ausp
for all entries in mch_ob
where objek = mch_ob-objek_m
and atinn = '0000000010'
and klart = '023'
and atwrt = 'DZ'.
ENDIF.
loop at it_ausp.
clear objek_m.
move it_ausp-objek to objek_m.
*Материалы демо
select * from mch1 into t_mch1
where cuobj_bm = objek_m.
EXIT.
endselect.
*Складские запасы
select * from mchb into table t_mchb
where matnr eq t_mch1-matnr and
charg eq t_mch1-charg and
lvorm ne 'X'
and clabs ne 0
and werks in zavod
and lgort in skl.
loop at t_mchb.
clear lt_rezult.
lt_rezult-palnt = t_mchb-werks.
lt_rezult-sklad = t_mchb-lgort.
*Производитель
clear manuf.
select single atwrt from ausp into manuf
where objek = t_mchb-matnr
AND atinn = '0000000025'
AND klart = '001'.
* IF manuf IS INITIAL.
* manuf = sy-tabix.
* ENDIF.
lt_rezult-manuf = manuf.
lt_rezult-sapn = t_mchb-matnr.
*Краткий текст материала
select single maktx into mat_txt from makt
where matnr eq t_mchb-matnr
and spras eq 'R' .
lt_rezult-desc = mat_txt.
lt_rezult-qty1 = t_mchb-clabs. " Eiee?anoai
*Стоимость запаса
select single * into _mbew from mbew
where matnr eq t_mchb-matnr
and bwkey eq t_mchb-werks
and bwtar eq t_mchb-charg.
if sy-subrc eq 0.
clear cena.
clear sum_skl.
cena = _mbew-salk3 / _mbew-lbkum.
sum_skl = t_mchb-clabs * cena.
lt_rezult-totl1 = sum_skl.
endif.
*Определяем признак партии DZ
clear priznac.
select single atwrt from ausp into priznac
where objek = it_ausp-objek
AND atinn = '0000000010'
AND klart = '023'.
lt_rezult-dem = priznac.
lt_rezult-lotn = t_mchb-charg.
append lt_rezult.
endloop.
endloop.
sort lt_rezult by palnt sklad manuf sapn.
* add data to tree
data: palnt type lvc_nkey,
sklad type lvc_nkey,
h_manuf type lvc_nkey,
l_last_key type lvc_nkey.
loop at lt_rezult into ls_rezult.
on change of ls_rezult-palnt.
perform add_palnt_line using ls_rezult
''
changing palnt.
endon.
on change of ls_rezult-sklad.
perform add_sklad_line using ls_rezult
palnt
changing sklad.
endon.
on change of ls_rezult-manuf.
perform add_manuf_line using ls_rezult
sklad
changing h_manuf.
endon.
perform add_complete_line using ls_rezult
h_manuf
changing l_last_key.
endloop.
*&---------------------------------------------------------------------*
*& Form add_sklad_line
*&---------------------------------------------------------------------*
form add_sklad_line using ps_rezult type zrnd_alv_demo
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_rezult type zrnd_alv_demo.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
append ls_item_layout to lt_item_layout.
*&---------------------------------------------------------------------*
*& Form add_manuf_line
*&---------------------------------------------------------------------*
form add_manuf_line using ps_rezult type zrnd_alv_demo
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_rezult type zrnd_alv_demo.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
append ls_item_layout to lt_item_layout.
*&---------------------------------------------------------------------*
*& Form add_cmplete_line
*&---------------------------------------------------------------------*
* add hierarchy-level 3 to tree
*----------------------------------------------------------------------*
*& Form register_events
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form register_events.
* define the events which will be passed to the backend
data: lt_events type cntl_simple_events,
l_event type cntl_simple_event.
* define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_click.
append L_EVENT to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
append L_EVENT to lt_events.
* set Handler
data: l_event_receiver type ref to lcl_tree_event_receiver.
create object l_event_receiver.
set handler l_event_receiver->handle_node_ctmenu_request
for tree1.
set handler l_event_receiver->handle_node_ctmenu_selected
for tree1.
set handler l_event_receiver->handle_item_ctmenu_request
for tree1.
set handler l_event_receiver->handle_item_ctmenu_selected
for tree1.
endform. " register_events
*&---------------------------------------------------------------------*
*& Form change_toolbar
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form change_toolbar.
* get toolbar control
call method tree1->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
* set event-handler for toolbar-control
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.
*& Form init_tree
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_tree.
* create fieldcatalog for structure mard
perform build_fieldcatalog.
* create container for alv-tree
data: l_tree_container_name(30) type c,
l_custom_container type ref to cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
if sy-batch is initial.
create object l_custom_container
exporting
container_name = l_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'. "#EC NOTEXT
endif.
endif.
* create Hierarchy-header
data l_hierarchy_header type treev_hhdr.
perform build_hierarchy_header changing l_hierarchy_header.
* create info-table for html-header
data: lt_list_commentary type slis_t_listheader,
l_logo type sdydo_value.
perform build_comment using
lt_list_commentary
l_logo.
* repid for saving variants
data: ls_variant type disvariant.
ls_variant-report = sy-repid.
Joined: 19 Feb 2008 Posts: 30 Location: Ростов-на-Дону
Posted: Fri Jun 06, 2008 1:16 pm Post subject:
Поле MANUF заполнено всегда. Может есть инфа по какому принципу, потом группируются при выводе даные в структуре (по нодам) или кто-нибудь может объяснить, чтобы в дебаге осмысленно анализировать данные.
Поле MANUF заполнено всегда. Может есть инфа по какому принципу, потом группируются при выводе даные в структуре (по нодам) или кто-нибудь может объяснить, чтобы в дебаге осмысленно анализировать данные.
Вы можете запустить у себя вышеприведенный код и сказать, с ним те же проблемы или нет? Или скидывайте весь ваш код, можно в личку.
Еще бы хорошо, две картинки - ошибочный показ и правильный, когда выбраны завод и склад.
Joined: 19 Feb 2008 Posts: 30 Location: Ростов-на-Дону
Posted: Sat Jun 07, 2008 10:47 am Post subject:
Спасибо всем откликнувшимся!!!
Проблема оказалась, в том, что при смене склада не менялся производитель, поэтому материалы попадали в предыдущий склад, ввел дополнительное условие в on change и все получилось.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.