‎2009 Feb 16 12:26 PM
hi,
I have two fields,plant and location.
based on the plant selection,the location f4 should get..
how to read the selected plant in at selection-screen on value-request for location??..
Thanks
Sri
‎2009 Feb 16 12:29 PM
hi....
THIS IS A WORKING EXAMPLE...YOU CAN GO LIKE THIS WITH YOUR REQUIRED FIELDS
TABLES:
sflight.
PARAMETERS:
p_conn TYPE sflight-connid,
p_carr TYPE sflight-carrid.
DATA:
w_field TYPE dfies-fieldname.
TYPES:
BEGIN OF type_s_carr,
carrid TYPE sflight-carrid,
END OF type_s_carr.
DATA:
t_table TYPE
STANDARD TABLE
OF type_s_carr
WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_carr.
SELECT carrid
FROM sflight
INTO TABLE t_table
UP TO 1 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
ddic_structure = ' '
retfield = 'CARRID'
pvalkey = ' '
dynpprog = ' '
dynpnr = ' '
dynprofield = ' '
stepl = 0
window_title =
value = ' '
value_org = 'C'
multiple_choice = ' '
display = ' '
callback_program = ' '
callback_form = ' '
mark_tab =
importing
user_reset =
tables
value_tab = t_table
field_tab =
return_tab =
dynpfld_mapping =
exceptions
parameter_error = 1
no_values_found = 2
OTHERS = 3
REGARDS
‎2009 Feb 16 12:29 PM
Hi,
*internal table made to populate the value of werks when pressing f4
DATA: BEGIN OF IT_FINAL OCCURS 0,
WERKS TYPE MARC-WERKS,
END OF IT_FINAL.
data: IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH header line.
parameters: p_werks(10) type c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
select werks from marc
into table IT_FINAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'WERKS' "field of internal table
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_FINAL
* FIELD_TAB =
RETURN_TAB = IT_RETURN
Thanks,
Krishna
‎2009 Feb 16 12:30 PM
Hi,
Function module will decrease with performance of your program because Function group will be loaded into your program's memory at runtime.
Try these codes:
at selectION-screen ON VALUE-REQUEST FOR FIELDNAME.
*&---------------------------------------------------------------------*
*& Form object_f4help
*&---------------------------------------------------------------------*
* Provides the possible values for pa_obj
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM object_f4help.
* Refresh the internal table. This helps in reusing these tables and variables in * other subroutines.
CLEAR: tb_dynpfields,
tb_object_range.
REFRESH: tb_dynpfields,
tb_object_range.
* Define Internal tables.
DATA: tb_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE.
* Define constants.
CONSTANTS: co_retfield TYPE dfies-fieldname VALUE 'OBJECT',
co_dynprog LIKE sy-repid
VALUE '/DCSEA/Z_AIS_NUM_RESET_PAJERO',
co_s TYPE c VALUE 'S',
co_field(27) TYPE c VALUE 'PA_OBJ'.
* Assigning the values of program name and screen to the variables.
wf_dyname = sy-repid. " PROGRAM NAME
wf_dynumb = sy-dynnr. " SCREEN NUMBER
wf_dynpro = co_field.
* Move the field name to tb_dynpfields.
MOVE 'PA_WERKS' TO
tb_dynpfields-fieldname.
APPEND tb_dynpfields.
* Read screen field values before PAI field transport. This FM is used for dynamically * reading a value from the selection screen field .
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = wf_dyname
dynumb = wf_dynumb
TABLES
dynpfields = tb_dynpfields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Read the tbale tb_dynpfields to read the dynamic value of pa_werks
READ TABLE tb_dynpfields INDEX 1.
IF sy-subrc = 0.
wf_werks = tb_dynpfields-fieldvalue.
ENDIF.
* Populate the table tb_object_range. Make sure that we filter out null values as it * might appear on the screen.
SELECT werks object
INTO TABLE tb_object_range
FROM zais_mmg
WHERE werks EQ wf_werks
and object NE ' '.
* Sorting is always done before dlete adjacent duplicate.
sort tb_object_range.
* This will delete all duplicate entries. Or else when you press F4, it will display * the duplicates also.
delete adjacent duplicates from tb_object_range comparing object.
* F4 help also returning the value to be displayed in internal table. If the internal table is empty, it will display the message saying 'Values are not found'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = co_retfield
dynpprog = co_dynprog
dynpnr = sy-dynnr
dynprofield = wf_dynpro
value_org = co_s
TABLES
value_tab = tb_object_range
EXCEPTIONS
parameter_error = 1
no_values_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.
ENDFORM. " object_f4helpOR,
PARAMETERS: Bukrs TYPE spfli-carrid,
name1 TYPE spfli-carrid.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR name1.
CALL SCREEN 100 STARTING AT 10 5
ENDING AT 50 10.
MODULE value_list OUTPUT.
SUPPRESS DIALOG.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
SET PF-STATUS space.
NEW-PAGE NO-TITLE.
select single bukrs from <Databasetable> into <ITAB>-BUkrs
where name1 = name1.
Write : / Itab-bukrs.
hide bukrs.
Endselect.
ENDMODULE.
AT LINE-SELECTION.
CHECK NOT name1 IS INITIAL.
LEAVE TO SCREEN 0.
‎2009 Feb 16 12:32 PM
‎2009 Feb 16 12:32 PM
Hi
Please check this sample program
demo_dynpro_dropdown_listbox.
‎2009 Feb 16 12:39 PM
let me tell u clearly..
for the plant i mentioned it as p_werks type t001w-werks.(f4 comes default without any coding)
data:g_lgort type lgort_d.
for location select-options: s_lgort for g_lgort no-extension no intervals.
now i had selected a plant 1100 in the screen.
then f4 should come for the location only for the plant 1100.
now how should i read it while selecting location data from too1L?..
‎2009 Feb 16 12:38 PM
Hi Sri,
First create a search-help for the second field(location) and this Search help use Plant field as a Import parameter and location as Export Parameter.
This way you will get the Location according the plant .
Thanks
Pinaki
‎2009 Feb 16 12:41 PM
Hi,
use this function modile
HELP_START
or
HELP_VALUES_GET_WITH_TABLE
Regards
Kiran
‎2009 Feb 16 12:54 PM
‎2009 Feb 16 1:06 PM
Hi, Sri.
Please Test the following Sample Code. I have test and it is working fine as your requirement,
TABLES: t001w, t001l.
SELECT-OPTIONS p_werks FOR t001w-werks NO-EXTENSION NO INTERVALS.
SELECT-OPTIONS g_lgort FOR t001l-lgort NO-EXTENSION NO INTERVALS.
DATA: i_return TYPE ddshretval OCCURS 0 WITH HEADER LINE,
c TYPE c VALUE 'S'.
* Search Help for LGORT
AT SELECTION-SCREEN ON VALUE-REQUEST FOR g_lgort-low.
TYPES: BEGIN OF t_lgort,
lgort LIKE t001l-lgort,
END OF t_lgort.
DATA: it_lgort TYPE STANDARD TABLE OF t_lgort WITH HEADER LINE.
SELECT DISTINCT lgort
INTO CORRESPONDING FIELDS OF TABLE it_lgort
FROM t001l
WHERE werks = p_werks-low.
SORT it_lgort BY lgort.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'P_WERKS'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_WERKS'
value_org = c
TABLES
value_tab = it_lgort
return_tab = i_return.and one thing more don't forget to Press the enter Button after enter the Plant.
Please Reply if any Issue.
Kind Regards,
Faisal
‎2009 Feb 16 12:42 PM
Hi,
just call like this...
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
EXPORTING
fieldname = 'WERKS'
tabname = 'T001W'
title_in_values_list = 'Select a value'
IMPORTING
select_value = lc_werks
TABLES
fields = ltab_fields
valuetab = ltab_values
EXCEPTIONS
field_not_in_ddic = 01
more_then_one_selectfield = 02
no_selectfield = 03.
Regards
Kiran
‎2009 Feb 16 1:29 PM
parameters: p_werks type t001l-werks obligatory memory id pw,
p_lgort type t001l-lgort.
this is what i did..
Thanks
Sri