10-18-2007 9:11 AM
Hi,
In my screen, i have 2 fields, object_id and load_id. I need to get the load_id base on the object_id. For example, if object_id: 001 is selected, A01, A02, A03 of load_id will be shown for selection in the search help.
Will appreciate if codes are provided. Thanks.
10-18-2007 9:23 AM
Hi Cheryl,
As PAI is not being triggered in your case, You can do this by dynamically reading the contents By calling the function module 'Dynp_read_value' and passing the
'object_id' field.
So now as you have the the value of objec_id, read internal table which contians the possible values of load_id and delete the entries which does not satisy ur criteria.
Provide a popup for ur F4 help for load_id.
Code snippet is give below.
Write this code in the F4 help for i_load field...
t_dynp-fielname = 'W_OBJID'.
T_dynp will have the dynamic field name.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
tables
dynpfields = t_dynp
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
UNDEFIND_ERROR = 7
OTHERS = 8
.
Then read the table content
READ TABLE t_dynp INTO fs_dynp WITH KEY fieldname = 'W_OBJID'..
IF sy-subrc EQ 0.
w_objid = fs_dynp-fieldvalue.
suppose the table for popup has 10 entries and of which only two correspond to you need.
Delete from t_table where objid NE w_objid.
Now pass this table to function module REUSE_ALV_POPUP_TO_SELECT
Fill the field catalog accordingly
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = pv_title
I_SELECTION = c_x
I_ZEBRA = c_x
I_SCREEN_START_COLUMN = 30
I_SCREEN_START_LINE = 5
I_SCREEN_END_COLUMN = 110
I_SCREEN_END_LINE = 25
I_SCROLL_TO_SEL_LINE = ''
I_TABNAME = pv_tabname
IT_FIELDCAT = t_fcat_popup
IMPORTING
ES_SELFIELD = FS_SEL_FIELD
TABLES
T_OUTTAB = pt_table
EXCEPTIONS
PROGRAM_ERROR = 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.
ELSE.
pv_selrow = fs_sel_field-tabindex.
ENDIF. " IF sy-subrc NE 0.
NOTE.. all the obove has to be written in On Value request for load_dl
Hope this solves ur problem
Thanks and regards
Satya
10-18-2007 9:33 AM
Hi Cheryl
You can try this logic,
data : i_dynread type standard table of dynpread,
wa_dynread type dynpread.
data : v_object_id type any.
DATA : i_return TYPE STANDARD TABLE OF ddshretval,
wa_return TYPE ddshretval.
wa_dynread-fieldname = 'P_OBJECT_ID'. " Screen field name for Object ID
append wa_dynread to i_dynread.
call function 'DYNP_VALUES_READ'.
exporting
DYNAME = sy-repid
DYNUMB = sy-dynnr
tables
dynpfields = i_dynread.
read table i_dynread into wa_dynread with key fieldname = 'P_OBECT_ID'.
if sy-subrc = 0.
v_object_id = wa_dynread- fieldvalue.
endif.
Here get the load ID's corresponding to the object ID as got before in variable v_Object_id from the resp. master table. Populate those Load Id's to say internal table I_LOAD and LOAD_ID field name is 'LOAD' in this internal table
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'LOAD'
PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
value_org = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
value_tab = i_LOAD
FIELD_TAB =
return_tab = i_return
DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 0
no_values_found = 0
OTHERS = 0
.
READ TABLE i_return INTO wa_return INDEX 1.
IF sy-subrc = 0.
P_LOAD_ID = wa_return-fieldval. " P_LOAD_ID is the screen fieldname for LOAD ID
ENDIF.
~Ranganath
Reward points for all useful answers !!