2014 Jul 14 6:45 AM
Hi all,
i have already searched about it on SCN but not get any thread where i can resolve my problem so here i am posting it, i have created a screen in which i have provided F4 help, in this F4 help i am showing name and associated number of employeees, when ever user picks any values from F4 help i wants to capture the associated number from the screen, for this what i have done till now is.
I have created a F4 help and when user enters the values, i have used a PAI event to capture the corresponding values by using translation like shown below. Here ztable-rm_name is the screen field for which F4 help has been provided, and emp_code is the value i have to capture.
MODULE NUMBER INPUT.
IF ZTABLE-RM_NAME IS NOT INITIAL.
IF IT_ZINCEN IS NOT INITIAL.
SORT IT_ZINCEN BY RM_NAME.
LOOP AT it_zincen INTO wa_zincen.
TRANSLATE wa_zincen-RM_NAME TO UPPER CASE.
wa_zincen1-rm_name = wa_zincen-rm_name.
wa_zincen1-emp_code = wa_zincen-emp_code.
APPEND wa_zincen1 TO it_zincen1.
ENDLOOP.
READ TABLE it_zincen1 INTO wa_zincen1 WITH KEY RM_NAME = ZSDPROJECT1-RM_NAME.
IF SY-SUBRC = 0.
EMP_CODE5 = WA_ZINCEN1-EMP_CODE.
ENDIF.
As you can see that i am fetching the emp_code through it_zincen1 which i have already got through the database and it contains the list of all employees
and its associated numbers, the problem which i am getting is that , while fetching the data by passing rm_name it will provide the emp_code of first matching rm_name, so it will give an ambiguity in result , if there will be more than one employee in the database.
So, i am looking for any other approach, that will give consistent result , i have done it through DYNP_VALUES_READ also, but not getting proper result, please if someone has the idea about how to achieve it, please tell me the solution.
Thanks in advance.
Hi all,
i have already searched about it on SCN but not get any thread where i can resolve my problem so here i am posting it, i have created a screen in which i have provided F4 help, in this F4 help i am showing name and associated number of employeees, when ever user picks any values from F4 help i wants to capture the associated number from the screen, for this what i have done till now is.
I have created a F4 help and when user enters the values, i have used a PAI event to capture the corresponding values by using translation like shown below. Here ztable-rm_name is the screen field for which F4 help has been provided, and emp_code is the value i have to capture.
MODULE NUMBER INPUT.
IF ZTABLE-RM_NAME IS NOT INITIAL.
IF IT_ZINCEN IS NOT INITIAL.
SORT IT_ZINCEN BY RM_NAME.
LOOP AT it_zincen INTO wa_zincen.
TRANSLATE wa_zincen-RM_NAME TO UPPER CASE.
wa_zincen1-rm_name = wa_zincen-rm_name.
wa_zincen1-emp_code = wa_zincen-emp_code.
APPEND wa_zincen1 TO it_zincen1.
ENDLOOP.
READ TABLE it_zincen1 INTO wa_zincen1 WITH KEY RM_NAME = ZSDPROJECT1-RM_NAME.
IF SY-SUBRC = 0.
EMP_CODE5 = WA_ZINCEN1-EMP_CODE.
ENDIF.
As you can see that i am fetching the emp_code through it_zincen1 which i have already got through the database and it contains the list of all employees
and its associated numbers, the problem which i am getting is that , while fetching the data by passing rm_name it will provide the emp_code of first matching rm_name, so it will give an ambiguity in result , if there will be more than one employee in the database.
So, i am looking for any other approach, that will give consistent result , i have done it through DYNP_VALUES_READ also, but not getting proper result, please if someone has the idea about how to achieve it, please tell me the solution.
Thanks in advance.
2014 Jul 14 6:53 AM
2014 Jul 14 7:29 AM
Hi Rajesh,
its not what my need is, i wants that if someone puts the employee name in one input screen, in background i need to capture its number, not in the screen itself.
Let me clear, please see this screenshot, in which i have provided F4 help for RM_NAME, in the F4 help it is showing rm_name with its code, while choosing rm_name it will fetch rm_name in my screen and the code associated with it , i wants to capture it in my program itself, and i am looking for the same solution.
In simple meaning, if user choose rm_name i have to get its code in background not on screen, i hope you understand my requirement properly.
2014 Jul 14 7:59 AM
Hi,
As u re saying There are more than 1 records for same name,So Their is no way to Know which is exactly Same Code for selected Name.Alternatively save Code in any parameter at the Screen Event or Use Internal Table to Save Code and Name Respectively and Further Use this parameter or Table in your background processing.
Regards
2014 Jul 14 8:29 AM
Hi Somandra,
could you please tell me in details, this is the reason why i have confusion because if user will select any name the data will come to my screen, but if i will fetch these values from an internal table having all the records then it will fetch the first matching records for employee code and it may be a faulty result, so i can't use it.
Any other suggestion will be appreciated.
2014 Jul 14 8:36 AM
Hi,
Refer to the link given by Rajesh, Declare an Internal Table (or parameter if Single Value) and Save the user selected record in that & later use when u require this internal table (or parameter).
2014 Jul 14 8:53 AM
Hi,
i have done as suggested in given lnk, now i am getting data as shown below.
I have my data in T_RETURN as shown below.
Fieldname Recordpos Fieldval Retfield
F001 001 Name rm_name
F002 001 Code emp_code
plesae tell me how can i take the Code from above data.
2014 Jul 14 9:46 AM
This is the code i have written in my program, please tell me what is wrong with this code
MODULE GET_VALUES INPUT.
IF ZSDPROJECT1-TYPE IS NOT INITIAL.
IF ZSDPROJECT1-TYPE = '1'.
SELECT EMP_CODE
DOJ
NAME
FROM ZDST INTO TABLE IT_ZDST.
SORT IT_ZDST BY EMP_CODE NAME.
DELETE ADJACENT DUPLICATES FROM IT_ZDST COMPARING EMP_CODE NAME.
s_mapping-fldname = 'F0001'.
s_mapping-dyfldname = 'NAME'.
APPEND s_mapping TO t_mapping.
CLEAR s_mapping.
s_mapping-fldname = 'F0002'.
s_mapping-dyfldname = 'EMP_CODE'.
APPEND s_mapping TO t_mapping.
CLEAR s_mapping.
IF IT_ZDST[] IS NOT INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'NAME'
* PVALKEY = ' '
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'ZSDPROJECT1-RM_NAME'
* STEPL = 0
WINDOW_TITLE = 'Select the Value'
* VALUE = ' '
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = IT_ZDST
* FIELD_TAB =
RETURN_TAB = T_RETURN
DYNPFLD_MAPPING = T_MAPPING
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ENDMODULE.
2014 Jul 14 10:25 AM
Hi,
Now Define Workarea for T_Return Say S_Return and a Variable Say Code (or Internal Table ).
Just Before Ur ENDMODULE Write.
read table T_return into S_return with key fieldname = 'F0002'.
if sy-subrc eq 0.
code = S_return-fIELDVAL.
endif.
Code Variable holds Your Desired Code , Which u can use later,If Ur selection screen allows more than one name as input,then append this code along with name to some internal table .
Regards:
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |