09-19-2008 11:52 AM
Hi Experts,
I am using ALV TREE for one of my program . But I am getting a short dump called ' Field Symbols has not been assigned' (GETWA_NOT_ASSIGNED). Can anyone tell me that why this is happening?
Thanks
09-19-2008 11:58 AM
It seems like a Fieldcatalog or Node Related problem
Did you populated the fieldcatalog ..? if possible show your code.
09-19-2008 12:00 PM
09-19-2008 12:01 PM
Hi,
Iam giving u ALV TREE Programme..compare with ur programme . Hope this will help you..
Code :
report z_alv_po_oops_me23n
no standard page heading message-id z9d_alv_oops
line-count 200 line-size 200.
*&--types for t_ekko
types : begin of type_ekko,
ebeln type ebeln, "Purchasing Document Number
bukrs type bukrs, "Company Code
aedat type erdat, "Date on which the record was created
ekorg type ekorg, "Purchasing Organization
end of type_ekko.
*&--types for t_ekpo
types : begin of type_ekpo,
ebeln type ebeln, "Purchasing Document Number
ebelp type ebelp, "Item Number of Purchasing Document
txz01 type txz01, "Short text
ematn type ematnr, "Material number
menge type bstmg, "Purchase order quantity
netpr type bprei,
"Net price in purchasing document (in document currency)
pstyp type pstyp, "Item category in purchasing document
knttp type knttp, "Account assignment category
end of type_ekpo.
*&--types for t_eket
types : begin of type_eket,
ebeln type ebeln, "Purchasing Document Number
ebelp type ebelp, "Item Number of Purchasing Document
etenr type eeten, "Delivery Schedule Line Counter
eindt type eindt, "Item delivery date
end of type_eket.
*&---types for t_podetail
types : begin of type_podetail,
ebeln type ebeln, "Purchasing Document Number
ebelp type ebelp, "Item Number of Purchasing Document
txz01 type txz01, "Short text
ematn type ematnr, "Material number
menge type bstmg, "Purchase order quantity
netpr type bprei,
"Net price in purchasing document (in document currency)
pstyp type pstyp, "Item category in purchasing document
knttp type knttp, "Account assignment category
EBELN type EBELN, "Purchasing Document Number
EBELP type EBELP, "Item Number of Purchasing Document
etenr type eeten, "Delivery Schedule Line Counter
eindt type eindt, "Item delivery date
end of type_podetail.
*&----types
types : type_t_ekko type type_ekko,
type_t_ekpo type type_ekpo,
type_t_eket type type_eket,
type_t_podetail type type_podetail.
*&----internal tables
data : it_ekko type standard table of type_t_ekko,
it_ekpo type standard table of type_t_ekpo,
it_eket type standard table of type_t_eket,
it_podetail type standard table of type_t_podetail.
*&----work areas
data : wa_ekko type type_t_ekko,
wa_ekpo type type_t_ekpo,
wa_eket type type_t_eket,
wa_podetail type type_t_podetail.
*&--data declaration for selection screen
data : w_ebeln type ebeln,
w_aedat type erdat,
w_ekorg type ekorg,
w_bukrs type bukrs,
gd_date1(10), "field to store output date
gd_date2(10). "field to store output date
*&-----data declaration for ok_code.
data : ok_code_0101 like sy-ucomm,
*&-----work area for field catalog
wa_fieldcatalog2 type lvc_s_fcat,
*&-----internal table for field catalog
it_fieldcatalog2 type lvc_t_fcat,
*&-----tree2 for alv tree
tree2 type ref to cl_gui_alv_tree,
*&-----l_tree_container_name
l_tree_container_name(30) type c,
*&-----custom_container
custom_container type ref to cl_gui_custom_container,
*&-----lt_list_commentary
lt_list_commentary type slis_t_listheader,
*&-----l_logo for header
l_logo type sdydo_value,
*&-----ls_line
ls_line type slis_listheader,
*&-----hirarchy header
l_hierarchy_header type treev_hhdr.
data: l_system(12) type c.
data : o_header type ref to cl_salv_form_layout_grid,
o_header_1 type ref to cl_salv_form_layout_grid.
&--
selection-screen begin of block bl1 with frame title text-001.
select-options : s_ebeln for w_ebeln obligatory.
select-options : s_bukrs for w_bukrs.
select-options : s_aedat for w_aedat.
select-options : s_ekorg for w_ekorg.
selection-screen end of block bl1.
&--
*&---validation for ebeln
at selection-screen on s_ebeln.
if s_ebeln[] is initial.
set cursor field 's_ebeln-low'.
message e000. "plz enter po document number
else.
select ebeln into w_ebeln
up to 1 rows
from ekko
where ebeln in s_ebeln.
endselect.
*&---checking for sy-subrc
if sy-subrc <> 0.
set cursor field 's_ebeln-low'.
message e001. "entered document number is invalid
endif.
endif.
*&---validation for bukrs
at selection-screen on s_bukrs.
select bukrs into w_bukrs
up to 1 rows
from t001
where bukrs in s_bukrs.
endselect.
*&---checking for sy-subrc
if sy-subrc <> 0.
set cursor field 's_bukrs-low'.
message e007. "entered company code is invalid
endif.
*&---validation for ekorg
at selection-screen on s_ekorg.
select ekorg into w_ekorg
up to 1 rows
from t024e
where ekorg in s_ekorg.
endselect.
*&---checking for sy-subrc
if sy-subrc <> 0.
set cursor field 's_ekorg-low'.
message e006. "entered purchasing organization is invalid
endif.
*&-----main logic.
start-of-selection.
*&--perform for fetch_detail
perform fetch_detail.
end-of-selection.
call screen 0101.
&----
*& Form fetch_detail
&----
text
----
--> p1 text
<-- p2 text
----
form fetch_detail .
*&--clear work area
clear wa_ekko.
*&--refresh internal table
refresh it_ekko.
*&---populate the data from ekko
select ebeln
bukrs
aedat
ekorg
into table it_ekko
from ekko
where ebeln in s_ebeln and
bukrs in s_bukrs and
aedat in s_aedat and
ekorg in s_ekorg.
*&--checking for sy-subrc
if sy-subrc <> 0.
message e002. "header data doesn't exists
else.
sort it_ekko by ebeln.
endif.
*&--clear work area
clear wa_ekpo.
*&--refresh internal table
refresh it_ekpo.
if it_ekko[] is not initial.
*&----populate the data from ekpo.
select ebeln "Purchasing Document Number
ebelp "Item Number of Purchasing Document
txz01 "Short text
ematn "Material number
menge "Purchase order quantity
netpr "Net price in purchasing document (in document currency)
pstyp "Item category in purchasing document
knttp "Account assignment category
into table it_ekpo
from ekpo
for all entries in it_ekko
where ebeln = it_ekko-ebeln.
*&--checking for sy-subrc
if sy-subrc <> 0.
message e003. "items data doesn't exists
else.
sort it_ekpo by ebeln ebelp.
endif.
endif.
*&--populate the data from eket
if it_ekpo[] is not initial.
select ebeln "Purchasing Document Number
ebelp "Item Number of Purchasing Document
etenr "Delivery Schedule Line Counter
eindt "Item delivery date
into table it_eket
from eket
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln and
ebelp = it_ekpo-ebelp.
*&--checking for sy-subrc
if sy-subrc <> 0.
message e004. "delivery date doesn't exists
else.
sort it_eket by ebeln ebelp.
endif.
endif.
*&-------populate it_podetail
loop at it_ekpo into wa_ekpo.
wa_podetail-ebeln = wa_ekpo-ebeln.
wa_podetail-ebelp = wa_ekpo-ebelp.
wa_podetail-txz01 = wa_ekpo-txz01.
wa_podetail-ematn = wa_ekpo-ematn.
wa_podetail-menge = wa_ekpo-menge.
wa_podetail-netpr = wa_ekpo-netpr.
wa_podetail-pstyp = wa_ekpo-pstyp.
wa_podetail-knttp = wa_ekpo-knttp.
read table it_eket into wa_eket with key ebeln = wa_ekpo-ebeln
ebelp = wa_ekpo-ebelp
binary search.
wa_podetail-eindt = wa_eket-eindt.
append wa_podetail to it_podetail.
clear wa_podetail.
endloop.
endform. " fetch_detail
&----
*& Module STATUS_0101 OUTPUT
&----
text
----
module status_0101 output.
set pf-status 'MENU_ALV_OOPS'.
endmodule. " STATUS_0101 OUTPUT
&----
*& Module SET_ALV OUTPUT
&----
text
----
module set_alv output.
*&---setting the pf-status
case sy-ucomm.
when 'BCK1'.
leave screen.
when 'EXT1'.
leave program.
when others.
endcase.
*&--declaring astructure of type t_podetail
data : it_podetail1 type standard table of type_podetail.
*&---if tree is empty
if tree2 is initial.
l_tree_container_name = 'TREE2'.
*&--sy-batch means program is running at back ground
if sy-batch is initial.
*&----creating the object for the custom_container
create object 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
others = 6
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*&-----creating the object tree2
create object tree2
exporting
parent = custom_container
node_selection_mode =
cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
no_toolbar = ' '
no_html_header = ' '
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
others = 8
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*&---perofrm for hiraechy
perform build_hierarchy_header changing l_hierarchy_header.
*&---perform for html-header
perform build_comment using lt_list_commentary
l_logo.
*&---perform for field catalog.
perform field_catalog.
*&----calling the function to print data
call method tree2->set_table_for_first_display
exporting
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
changing
it_outtab = it_podetail1[]
it_fieldcatalog = it_fieldcatalog2[]
.
*&---create the hirarchy
perform create_hierarchy.
*&---calling the method frontend_method.
call method tree2->frontend_update.
endif.
endif.
endmodule. " SET_ALV OUTPUT
&----
*& Form build_comment
&----
text
----
-->P_LT_LIST_COMMENTARY text
-->P_L_LOGO text
----
form build_comment using p_lt_list_commentary type slis_t_listheader
p_l_logo type sdydo_value.
*DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
*&--list heading line type 'H'.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'rapidigm-fujitsu'.
append ls_line to p_lt_list_commentary.
clear ls_line.
*&--list status line type 'S'.
ls_line-typ = 'S'.
ls_line-key = 'PO DOCUMENT NO:'.
concatenate s_ebeln-low ' TO ' s_ebeln-high into ls_line-info
separated by space.
append ls_line to p_lt_list_commentary.
clear ls_line.
*&--list status line type 'S'.
ls_line-typ = 'S'.
ls_line-key = 'CREATION DATE:'.
write s_aedat-low to gd_date1 mm/dd/yyyy.
write s_aedat-high to gd_date2 mm/dd/yyyy.
concatenate gd_date1 ' TO ' gd_date2 into ls_line-info
separated by space.
append ls_line to p_lt_list_commentary.
clear ls_line.
*&--list status line type 'S'.
ls_line-typ = 'S'.
ls_line-key = 'PURCHASING ORGANIZATION:'.
concatenate s_ekorg-low ' TO ' s_ekorg-high into ls_line-info
separated by space.
append ls_line to p_lt_list_commentary.
clear ls_line.
*&--list status line type 'S'.
ls_line-typ = 'S'.
ls_line-key = 'COMPANY CODE:'.
concatenate s_bukrs-low ' TO ' s_bukrs-high into ls_line-info
separated by space.
append ls_line to p_lt_list_commentary.
clear ls_line.
*&--list status line type 'S'.
ls_line-typ = 'S'.
ls_line-key = 'DATE:'.
ls_line-info = sy-datum.
append ls_line to p_lt_list_commentary.
clear ls_line.
*&--logo
p_l_logo = 'ENJOYSAP_LOGO'.
endform. " build_comment
&----
*& Form field_catalog
&----
text
----
--> p1 text
<-- p2 text
----
form field_catalog .
clear wa_fieldcatalog2 .
refresh it_fieldcatalog2 .
*&-POPULATING THE FIELD EBELN
wa_fieldcatalog2-col_pos = 1. "position of the column
wa_fieldcatalog2-fieldname = 'EBELN'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 10. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'PO DOC NO'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD EBELP
wa_fieldcatalog2-col_pos = 2. "position of the columnt
wa_fieldcatalog2-fieldname = 'EBELP'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 10. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'ITEM NO'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD KNTTP
wa_fieldcatalog2-col_pos = 3. "position of the column
wa_fieldcatalog2-fieldname = 'KNTTP'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 10. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'Acc assig cat'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD PSTYP
wa_fieldcatalog2-col_pos = 4. "position of the column
wa_fieldcatalog2-fieldname = 'PSTYP'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 10. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'Item cat in pur doc'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD EMATN
wa_fieldcatalog2-col_pos = 5. "position of the column
wa_fieldcatalog2-fieldname = 'EMATN'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 18. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'Material number'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD TXZ01
wa_fieldcatalog2-col_pos = 6. "position of the column
wa_fieldcatalog2-fieldname = 'TXZ01'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 40. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'Short text'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD MENGE
wa_fieldcatalog2-col_pos = 7. "position of the column
wa_fieldcatalog2-fieldname = 'MENGE'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 13. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'PO QTY'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD EINDT
wa_fieldcatalog2-col_pos = 8. "position of the column
wa_fieldcatalog2-fieldname = 'EINDT'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKET'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 18. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'Item delivery date'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
*&-POPULATING THE FIELD NETPR
wa_fieldcatalog2-col_pos = 9. "position of the column
wa_fieldcatalog2-fieldname = 'NETPR'. "field name
wa_fieldcatalog2-tabname = 'IT_podetail'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'EKPO'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 11. "output length of the field.
wa_fieldcatalog2-scrtext_l = 'Net price'.
"long key word
append wa_fieldcatalog2 to it_fieldcatalog2.
clear wa_fieldcatalog2.
endform. " field_catalog
&----
*& Form build_hierarchy_header
&----
text
----
<--P_L_HIERARCHY_HEADER text
----
form build_hierarchy_header changing p_l_hierarchy_header type
treev_hhdr.
p_l_hierarchy_header-heading = 'Hierarchy Header'.
p_l_hierarchy_header-tooltip =
'This is the Hierarchy Header !'.
p_l_hierarchy_header-width = 30.
p_l_hierarchy_header-width_pix = ''.
endform. " build_hierarchy_header
&----
*& Form create_hierarchy
&----
text
----
--> p1 text
<-- p2 text
----
form create_hierarchy .
*&---data declaration
data : l_ebeln_key type lvc_nkey,
l_ebelp_key type lvc_nkey ,
l_eindt_key type lvc_nkey. "#EC NEEDED
data : wa_detail type type_podetail.
*&--sorting the it_podetail
sort it_podetail by ebeln ebelp.
loop at it_podetail into wa_podetail.
*&---for every ebeln
at new ebeln.
read table it_podetail into wa_detail with key ebeln =
wa_podetail-ebeln.
if sy-subrc = 0.
call method tree2->add_node
exporting
i_relat_node_key = ' '
i_relationship =
cl_gui_column_tree=>relat_last_child
"here it comes like folder
is_outtab_line = wa_detail
"it takes for every new ebeln
i_node_text = 'PO NO'
importing
e_new_node_key = l_ebeln_key
"it returns the child ie., next node
exceptions
relat_node_not_found = 1
node_not_found = 2
others = 3
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endif.
endat.
*&---for every ebelp
at new ebelp.
clear wa_detail.
read table it_podetail into wa_detail with key ebeln =
wa_podetail-ebeln
ebelp =
wa_podetail-ebelp
binary search.
if sy-subrc = 0.
call method tree2->add_node
exporting
i_relat_node_key = l_ebeln_key
i_relationship =
cl_gui_column_tree=>relat_last_child
"here it comes like folder
is_outtab_line = wa_detail
"it takes for every new ebelP
i_node_text = 'ITEM'
importing
e_new_node_key = l_ebelp_key
"it returns the child ie., next node
exceptions
relat_node_not_found = 1
node_not_found = 2
others = 3
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endif.
endat.
*&---for eindt
clear wa_detail.
read table it_podetail into wa_detail with key ebeln = wa_podetail-ebeln
ebelp = wa_podetail-ebelp
binary search.
if sy-subrc = 0.
call method tree2->add_node
exporting
i_relat_node_key = l_ebelp_key
i_relationship =
cl_gui_column_tree=>relat_last_child
"here it comes like folder
is_outtab_line = wa_detail
"it takes for every new ebeln
i_node_text = 'DATE'
importing
e_new_node_key = l_eindt_key "#EC NEEDED
"it returns the child ie next node
exceptions
relat_node_not_found = 1
node_not_found = 2
others = 3
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endif.
clear wa_detail.
endloop.
endform. " create_hierarchy
Regards,
Deepthi.