2008 Nov 25 2:33 PM
Hi Gurus,
I have a table control in my requirement. suppose it has the fields Plant and material. now the requirement is that..... if the user enters plant.. then only the corresponding materials for that plant should be required.
i have done all the coding for the above requirement also:
process on value-request.
* Module for F4 help on Plant.
field wa_audit-werks module f4_plant.
* Module for F4 help on Material
field wa_audit-matnr module f4_material.
Now the F4 help also comes quite well...... but now my actual requirement is.. if the user selects the plant from the F4 values........ then without pressing any user command if he goes to the material F4 help, then iam not getting the actual f4 help which is required for me. iam getting all the materials(not restricted to the plant)...... it is due to the fact that until any user-command is pressed on the screen, the plant value entered on the screen is not populated into the reference field in the prog which is inturn used to retreive the materials(for F4).
so can anyone suggest me how to proceed further.......
2008 Nov 25 3:38 PM
there is a function module 'DYNP_VALUES_READ'.. use it to read the value in the field
data: dynfields type table of dynpread with header line.
* Here add the fields that you want to read from
* the screen
dynfields-fieldname = 'WA_AUDIT-WERKS'.
append dynfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-REPID
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = dynfields.
.
The value of the field F4FIELD will be there in dynfields-fieldvalue.
NOw use this value to pass to your F4 for materials module..
Regards,
Suzie
Edited by: Suzie on Nov 25, 2008 4:39 PM
2008 Nov 25 3:38 PM
there is a function module 'DYNP_VALUES_READ'.. use it to read the value in the field
data: dynfields type table of dynpread with header line.
* Here add the fields that you want to read from
* the screen
dynfields-fieldname = 'WA_AUDIT-WERKS'.
append dynfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-REPID
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = dynfields.
.
The value of the field F4FIELD will be there in dynfields-fieldvalue.
NOw use this value to pass to your F4 for materials module..
Regards,
Suzie
Edited by: Suzie on Nov 25, 2008 4:39 PM
2008 Nov 25 3:41 PM
Hi,
this reads the data of the normal screen values.. but not the table control values specific to a single row..
in a table control.. if i chhose a specific row, then the data should be fetched for that specific row only.. which is not possible by your above solution. in a table control , i cannot have the field name for each and every row.. so i cannot use the above FM to read the dynpro table control values
if still it can be.. plz suggest
Edited by: chaitanya on Nov 25, 2008 9:12 PM
2008 Nov 25 3:43 PM
see this example....
&----
*& Report ZVALUE_HELP
*&
&----
*&
*&
&----
report zvalue_help.
data: v_plant type werks_d.
data: begin of t_marc occurs 0,
material type matnr,
werks type werks_d,
end of t_marc.
parameters: plant type werks_d,
material type matnr.
at selection-screen on value-request for material.
data:
l_dynfieldtab like dynpread occurs 1,
l_dynfieldtab_wa like dynpread,
l_repid like sy-repid,
l_dynnr like sy-dynnr.
move : sy-repid to l_repid,
sy-dynnr to l_dynnr.
move selected entry to screen
fill internal table with screen fields
clear l_dynfieldtab.
refresh l_dynfieldtab.
move 'PLANT' to l_dynfieldtab_wa-fieldname.
append l_dynfieldtab_wa to l_dynfieldtab.
call function 'DYNP_VALUES_READ'
exporting
dyname = l_repid
dynumb = l_dynnr
TRANSLATE_TO_UPPER = ' '
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
tables
dynpfields = l_dynfieldtab
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.
if sy-subrc <> 0.
message i711(qp). "internal error: system. adm.
else.
read table l_dynfieldtab into l_dynfieldtab_wa index 1.
v_plant = l_dynfieldtab_wa-fieldvalue.
endif.
select matnr werks into table t_marc
from marc
where werks = v_plant.
*--local data declaration
data: lv_retfield type dfies-fieldname, " Field Name
lv_maxline type i, " Maximum no of records
lt_return_tab like ddshretval occurs 0 with header line.
lv_retfield = 'MATERIAL'.
*--Calling the function module for F4 help.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = lv_retfield
value_org = 'S'
tables
value_tab = t_marc[]
return_tab = lt_return_tab
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
read table lt_return_tab index 2.
material = lt_return_tab-fieldval.
endif.
2008 Nov 25 3:45 PM
Hi venkat, this reads the data of the screen fields. but not the specific row of the table control....
if ur solution still solve my issue.. plz elobarate me...
2008 Nov 25 3:46 PM
Chaitanya
You have ti rigger some even inorder to read the value entered for the plant.
Instead of doing it with F4 ,you can try it with some button on your screen .once you click on that button
you can fetch the list of materials for that plant.
Regards
Neha
2008 Nov 26 6:52 AM
Hi all.... does anybody suugest a solution for my issue.. stated above.. Thanks...
2008 Nov 26 7:13 AM
In module pools , every thing works on user commands..and with out that I donot think
you can proceed..
I think user has to give an enter after selecting the value....
2008 Nov 26 7:18 AM
Hi Chaitanya,
This can be achieved.
use dynp_values_read
you will get all the screen field values.
use the GET CURSOR key word to get the current cursor position and the corresponding PLANT value.
pass this to the F4 Help of MATNR.
i earlier have implemented this .
regards
Ramchander Rao.K
2008 Nov 26 7:47 AM
Hi ramchander.. using the FM DYNP_VALUES_READ, iam getting the values of the single screen field elements, but the values entered in the table control are not retreived by the above FM.. i ahve tried this also.. but if still if ur solution solves my issue.. plz check and confirm...
2009 Jan 15 3:16 PM
2009 Jan 15 3:47 PM
Hi..
The issue is not solved..
In a table control, until user command or some action is performed, we cannot get the field value of any of the fields...
If u get some solution.. please let me know..
Regards,
Chaitanya
2009 Jan 15 4:01 PM
Hi chaitanya,
If you want to read a specific row of a table control.
Add a single character field to the internal table say pick(1)
Then go to the layout of the screen and in the table control settings, and tick the check box, w/SelColumn and give the value as itab-pick
Save the settings activate and then in the PAI, write a statement modify itab index tc_tab-current_line.
Now, the selected row of your itab will alone have the field value 'X'.
i hope this helps.
2009 Jan 19 12:43 PM
Hi Frisky,
I tried with ur suggestion, but cudn't find any progress..
Let me explain my situn to u...
In my table control ihave some fileds.. now i have Written ON PROCESS-VALUE-REQUEST's for F4 help for some of the fields. now corresponding to the Plant and Material fields on the Table control : When i enter the Plant and press F4 on Material( without pressing any user-command like 'Enter'), then i should get the materils corresponding to the plant entered only... so i need the screen value of the Plant on the Table control.
Now as the Logic goes, the data in the table control is read once the PAI of the screen is triggered. so only when the Some Event of PAI is triggered only, i can get the value of Plant for retreiving the corresponding materials. " BUT WHEN I ENTER THE PLANT & PRESS F4 ON MATERIAL , THEN THE
ON PROCESS-VALUE-REQUEST EVENT IS TRIGGERED ( So PAI is not triggered, so Plant value is not stored in the Internal table of the Table Control, so i cud not get value of the plant entered on the screen). SO IS THERE ANY WAY TO CAPTURE THE VALUES IN THE TAB CNTRL BEFORE PAI IS TRIGGERED. ( any FM's like 'DYNP_VALUES_READ' which can read the data in tab cntrl).
Hope u have understood my issue. plz advice me if u have some solution.
Regards,
Chaitanya. L
2009 Feb 07 4:44 PM
Hi,
When using a table control the F4 help is added in "dictionary attributes" of this field, in the field corresponding to "search help ". You can build a help in SE11 transaction, and add the logic in the exit function of the help.
Regards,
2009 Feb 08 4:07 AM
>
SO IS THERE ANY WAY TO CAPTURE THE VALUES IN THE TAB CNTRL BEFORE PAI IS TRIGGERED. ( any FM's like 'DYNP_VALUES_READ' which can read the data in tab cntrl).
Hello Chaitanya,
just before calling the FM 'DYNP_VALUES_READ' call the FM 'DYNP_GET_STEPL' which returns the current loop index(relative) and then pass the vaule of the current loop index returned by 'DYNP_GET_STEPL' to the FM 'DYNP_VALUES_READ'.
As an alternative, as suggested in one of the previous replies, you can also use the GET CURSOR statement to fetch the value of current loop index.
DATA:
it_dynpfields TYPE STANDARD TABLE OF dynpread,
wa_dynpfields TYPE dynpread,
w_stepl LIKE sy-stepl.
CLEAR it_dynpfields.
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = w_stepl
EXCEPTIONS
stepl_not_found = 1
OTHERS = 2.
wa_dynpfields-stepl = w_stepl.
wa_dynpfields-fieldname = 'ITAB-COL1'.
APPEND wa_dynpfields TO it_dynpfields.
CLEAR wa_dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = it_dynpfields.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2008 Nov 26 7:27 AM
Hi,
i had the similear requirement and i solved in the following way:
here i was suppose to display employee number for particular plant, where user enters plant number the look for employee number
process on value-request.
field v_pernr module pernr_f4.
module pernr_f4 input.
if t001w-werks is not initial.
select pernr werks emp_name desig
from zps_emp
into table it_emp
where werks = t001w-werks.
else.
select pernr
werks
emp_name
desig
from zps_emp
into table it_emp.
endif.
endif.
sort it_emp by pernr.
program = sy-repid.
dynnum = sy-dynnr.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'PERNR'
dynpprog = program
dynpnr = dynnum
dynprofield = 'V_PERNR'
value_org = 'S'
tables
value_tab = it_emp[]
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.
endmodule. " pernr_f4 INPUT
Edited by: Naseeruddin on Nov 26, 2008 8:35 AM
2008 Nov 26 7:32 AM
Hi,
i had the similear requirement and i solved in the following way:
process on value-request.
field v_pernr module pernr_f4.
module pernr_f4 input.
if t001w-werks is not initial.
select pernr
werks
emp_name
desig
from zps_emp
into table it_emp
where werks = t001w-werks.
else.
select pernr
werks
emp_name
desig
from zps_emp
into table it_emp.
endif.
*endif.
sort it_emp by pernr.
program = sy-repid.
dynnum = sy-dynnr.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'PERNR'
dynpprog = program
dynpnr = dynnum
dynprofield = 'V_PERNR'
value_org = 'S'
tables
value_tab = it_emp[]
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.
endmodule. " pernr_f4 INPUT
2009 Feb 08 4:51 AM
Hi
I had a requirement where on entering value in first column of table control automatically remaining columns got filled.
For that I created a search help using SE11 containing all the three columns and attached it to the first column. Now when I entered a value in first column using search help, remaining cols got filled automatically.
Hope this helps
Regards,
Jayanthi.K
2009 Feb 08 6:50 AM
hi,
have u declared teh same data type in the program also.which FM ur using for F4..is it F4_INT_...then in the attributes ,the ret_tab will defenitley return the field value u selected.U do one more checkin in the module pool screen,whether in the attribites(small popo for screen elemnet)the type is given as ur required type.