‎2012 Feb 23 6:48 AM
Hi all,
This is my first post in SDN.
I have created one ZTABLE with four Key fields.Also I have generated Table Maintenance generator for the same.
Now the requirement is something like this:
select hierarchy type(from listbox) from first column, my second column listbox should show values based upon the selection done in hierarchy type column.While creating NEW ENTRIES in Table Maintenance Generator I have achieved this by assiging function code to my first listbox and in PBO (inside loop) deleting values from internal table before calling function module 'VRM_SET_VALUES'.
But when I try to edit values by going in change mode from SM30 my second lisbox is not showing appropriate values in listbox.I am again deleting values in PBO(inside loop,based on ok code of change).
module get_hierarchy_codes output.
data : lv_htype type zhtype,
lv_name type vrm_id.
ok_code = sy-ucomm.
if ok_code = 'AEND'.
refresh gt_htype.
call function 'GET_DOMAIN_VALUES'
exporting
domname = 'ZHTYPE'
text = 'X'
FILL_DD07L_TAB = ' '
tables
values_tab = gt_htype
VALUES_DD07L =
exceptions
no_values_found = 1
others = 2.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
clear : lv_htype, gv_seqn.
lv_htype = extract+7(2).
case lv_htype.
when 'PT'.
gv_seqn = '0001'.
delete gt_htype where valpos = 0001
or valpos = 0003
or valpos = 0004.
when 'PA'.
gv_seqn = '0004'.
delete gt_htype where valpos le gv_seqn.
when 'IT'.
gv_seqn = '0003'.
delete gt_htype where valpos le gv_seqn.
when 'IA'.
gv_seqn = '0004'.
delete gt_htype where valpos le gv_seqn.
when 'RG'.
gv_seqn = '0005'.
delete gt_htype where valpos le gv_seqn.
when 'ZN'.
gv_seqn = '0006'.
delete gt_htype where valpos le gv_seqn.
when 'NS'.
gv_seqn = '0007'.
delete gt_htype where valpos le gv_seqn.
when 'DH'.
gv_seqn = '0008'.
delete gt_htype where valpos le gv_seqn.
when 'BH'.
gv_seqn = '0009'.
delete gt_htype where valpos le gv_seqn.
endcase.
refresh lt_list.
loop at gt_htype into gs_htype.
ls_value-key = gs_htype-domvalue_l.
ls_value-text = gs_htype-ddtext.
append ls_value to lt_list.
clear : ls_value, gs_htype.
endloop.
lv_name = 'zotc_heirmain1-hptyp'.
*Set the table in screen field
call function 'VRM_SET_VALUES'
exporting
id = lv_name
values = lt_list
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
MODIFY IT_ZMATTB FROM ZMATTB INDEX SY-TABIX.
endif.
endmodule. " GET_HIERARCHY_CODES OUTPUT
‎2012 Feb 23 6:49 AM
I have also searched SDN but didnt get satisfactory answers.
http://forums.sdn.sap.com/thread.jspa?messageID=4463164#4463164
http://forums.sdn.sap.com/thread.jspa?messageID=5135115#5135115