09-19-2006 7:43 PM
Hello All,
I have a VALUE_TAB internal table (<b>it_mngrp_mncod</b>) with 3 fileds. After selecting a row in F4 pop up, I need to get all the three column values. In return_tab I am getting only the last field, which is the value of CODE in it_mngrp_mncod. Is there any way to select the entire row in F4 pop up?
Here is the piece of my code:
&----
*& Report ZCK_TEST
*&
REPORT zck_test.
TABLES: viqmel, viqmfe.
CALL SCREEN 101.
*& Module code_pf4_i15 INPUT
*&----
MODULE code_pf4_i15 INPUT.
DATA: BEGIN OF it_mngrp_mncod OCCURS 0,
kurztext TYPE qtxt_code,
codegruppe TYPE qcodegrp,
code TYPE qcode,
END OF it_mngrp_mncod.
DATA: it_returntab LIKE ddshretval OCCURS 0 WITH HEADER LINE.
DATA: it_fieldtab LIKE dfies OCCURS 0 WITH HEADER LINE.
DATA p_field TYPE fieldname.
GET CURSOR FIELD p_field .
PERFORM code_pf4_f40 USING p_field.
ENDMODULE. " code_pf4_i15 INPUT
*&----
*& Form code_pf4_f40
*&----
FORM code_pf4_f40 USING p_field.
PERFORM get_f4_values CHANGING p_field.
ENDFORM. " code_pf4_f40
*& Form GET_F4_VALUES
*&----
FORM get_f4_values CHANGING p_field.
DATA: field1 TYPE fieldname,
field2 TYPE fieldname.
DATA: p_katalogart TYPE qkatart.
SPLIT p_field AT '-' INTO field1 field2.
IF field2 = 'OTGRP' OR field2 = 'OTEIL'.
p_katalogart = 'B'.
ELSEIF field2 = 'FEGRP' OR field2 = 'FECOD'.
p_katalogart = 'C'.
ELSEIF field2 = 'URGRP' OR field2 = 'URCOD'.
p_katalogart = '5'.
ELSEIF field2 = 'MNGRP' OR field2 = 'MNCOD'.
p_katalogart = 'A'.
ELSEIF field2 = 'TASK_CODEGRP' OR field2 = 'TASK_CODE' OR field2 =
'TXT_TASKCD'.
p_katalogart = '2'.
ENDIF.
SELECT codegruppe code INTO CORRESPONDING FIELDS OF TABLE
it_mngrp_mncod FROM qpcd WHERE katalogart = p_katalogart.
LOOP AT it_mngrp_mncod.
SELECT SINGLE kurztext
FROM qpct
INTO it_mngrp_mncod-kurztext
WHERE katalogart = p_katalogart
AND codegruppe = it_mngrp_mncod-codegruppe
AND code = it_mngrp_mncod-code.
MODIFY it_mngrp_mncod FROM it_mngrp_mncod TRANSPORTING kurztext.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = p_field
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
value_org = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
value_tab = it_mngrp_mncod
field_tab = it_fieldtab
return_tab = it_returntab
DYNPFLD_MAPPING =
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.
READ TABLE it_returntab INDEX 1.
MOVE it_returntab-fieldval TO p_field.
ENDFORM. " GET_F4_VALUES
&----
*& Module user_command_101 INPUT
&----
text
----
MODULE user_command_101 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " user_command_101 INPUT
&----
*& Module status_101 OUTPUT
&----
text
----
MODULE status_101 OUTPUT.
SET PF-STATUS '0101'.
ENDMODULE. " status_101 OUTPUT
09-20-2006 1:57 AM
Hi,
Paste following code as-is just before ENDIF. Then it should work fine.
data: w_dynpro_field type dynpread.
data: t_dynpro_field type standard table of dynpread.
refresh: t_dynpro_field.
move: sy-repid to d020s-prog,
sy-dynnr to d020s-dnum.
move: 'VIQMFE-OTEIL' to w_dynpro_field-fieldname,
viqmfe-oteil to w_dynpro_field-fieldvalue.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = d020s-prog
dynumb = d020s-dnum
tables
dynpfields = t_dynpro_field
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
Hope this helps...
Thanks,
Murali
09-19-2006 7:51 PM
before call the funtion call, populate the internal table it_returntab with three field names.
it_returntab-feildname = 'MATNR'.
append it_returntab.
it_returntab-feildname = 'ERDAT'.
append it_returntab.
it_returntab-feildname = 'MEINS'.
append it_returntab.
and pass the it_returntab to the fucntion module.
Call function 'F4IF_INT_TABLE_VALUE_REQUEST'
........
........
clear it_returntab.
READ TABLE it_returntab INDEX 1.
if it_returntab-fieldname = 'MATNR'.
MOVE it_returntab-fieldval TO p_field1.
elseif it_returntab-fieldname = 'MATNR'.
MOVE it_returntab-fieldval TO p_field2.
it_returntab-fieldname = 'MATNR'.
MOVE it_returntab-fieldval TO p_field3.
endif.
09-19-2006 7:52 PM
09-19-2006 9:37 PM
Thank you Rich,
I have one more issue. I have two fields on screen next to each other 1) <b>viqmfe-otgrp</b> and 2) <b>viqmfe-oteil</b>. I have POV module for <b>viqmfe-otgrp</b>, and when I select a line in F4 pop up box, the screen element <b>viqmfe-oteil</b> also has to be updated with <b>it_mngrp_mncod-code</b>. But Only screen field <b>viqmfe-otgrp</b> is getting populated for me.I hope you understand my issue.
Here is the code:
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = field2 "p_field
value_org = 'S'
display = h_display
TABLES
value_tab = it_mngrp_mncod
return_tab = it_returntab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
READ TABLE it_returntab INDEX 1.
IF field2 = 'OTGRP'.
READ TABLE it_mngrp_mncod WITH KEY code = it_returntab-fieldval.
viqmfe-otgrp = it_mngrp_mncod-codegruppe. <b>" this works fine</b>
<b>viqmfe-oteil = it_mngrp_mncod-code. " not getting updated</b>
ENDIF.
09-19-2006 9:44 PM
Rich,
The second field is also getting updated after I press ENTER key. But can we achieve this without ENTER key?
Thanks,
Chandni
09-19-2006 9:49 PM
09-19-2006 10:04 PM
Yes..it does. But the result is same even after commenting the line <b>field viqmfe-oteil .</b>
Thanks Rich
Chandni
09-19-2006 10:55 PM
09-19-2006 8:46 PM
Hello Chandni
If you can uniquely identify your entries in the F4 itab then Rich's proposal is a straightforward and simple solution.
The more general approach is to use call back parameters (see FM documentation for parameter <b>CALLBACK_FORM</b>). The FORM routine gives you the description of the search help (complex structure <b>SHLP_DESCR</b>). There you have to modify the tree entries in FIELDPROP: set <b>FIELDPROP-SHLPOUTPUT = 'X'</b>.
Now, if you have set three fields as EXPORTING parameter then the function module will return three entries for each selected F4 entry.
Regards
Uwe
09-20-2006 1:57 AM
Hi,
Paste following code as-is just before ENDIF. Then it should work fine.
data: w_dynpro_field type dynpread.
data: t_dynpro_field type standard table of dynpread.
refresh: t_dynpro_field.
move: sy-repid to d020s-prog,
sy-dynnr to d020s-dnum.
move: 'VIQMFE-OTEIL' to w_dynpro_field-fieldname,
viqmfe-oteil to w_dynpro_field-fieldvalue.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = d020s-prog
dynumb = d020s-dnum
tables
dynpfields = t_dynpro_field
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
Hope this helps...
Thanks,
Murali
09-21-2006 10:26 PM
Hi Murali,
'DYNP_VALUES_UPDATE' worked for me very well for two screen elements. Now, I want similar to this happen in a table control. I tried the FM but it is populating other field in a different row in table control. Any idea?
Thanks,
Chandni