2007 Jun 18 10:05 AM
Hey,
Maybe pretty easy one, but i don't see it right away.
I have created my own F4-help with the function : RHP0_POPUP_F4_SEARK. This does exactly what i need, but the option MULTI_SELECT is checked.
How can i assign all values of the table i get back from that function, to my field on my selection screen ?
Kind regards & thanks in advance,
Tom
2007 Jun 18 12:00 PM
here is the sample code for displaying the F4 value in the screen
PROCESS ON VALUE-REQUEST( F4 ) statement
Code to demonstrate how to perform a manual value help(F4) on a particular field using the PROCESS ON VALUE-REQUEST statement and how to return values back to a table control on the screen. For standard screen fields simply move the value to the appropriate screen field name.
Screen flow logic........
PROCESS BEFORE OUTPUT.
*MODULE PBO_MODULE.
PROCESS AFTER INPUT.
*MODULE PAI_MODULE.
PROCESS ON VALUE-REQUEST. "F4
FIELD EKPO-EBELP MODULE help_ekpo.
* populate screen field from within PROCESS ON VALUE-REQUEST(F4) call
*&------------------------------------------------------------------*
*& Module help_responsibility INPUT
*&------------------------------------------------------------------*
* text
*-------------------------------------------------------------------*
MODULE help_ekpo INPUT.
**Transport values to table dynpro/screen table control
DATA: l_stepl LIKE sy-stepl,
l_indx LIKE sy-stepl.
DATA: dynpfields LIKE dynpread OCCURS 5 WITH HEADER LINE.
* Adjust for scroling within table control
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = l_stepl
EXCEPTIONS
stepl_not_found = 0
OTHERS = 0.
l_indx = tc_ekpotable-top_line + l_stepl - 1.
"tc_ekpotable should already have been declared
REFRESH dynpfields.
CLEAR dynpfields.
dynpfields-fieldname = 'EKPO-EBELN'.
dynpfields-fieldvalue = '00010' "wa_ekpo-ebeln.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
dynpfields-fieldname = 'EKPO-EBELP'.
dynpfields-fieldvalue = '00020' "wa_ekpo-ebelp.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SAPLZZ_EKKO' "Program name
dynumb = '0100' "Screen number
TABLES
dynpfields = dynpfields
EXCEPTIONS
OTHERS = 0.
ENDMODULE. " help_ekpo INPUT
reward points if it is usefull ....
Girish
Hi Tom,
In the coding the complete piece of coding should be done in INITIALIZATION event. i.e. fetching the values in the table from the database and then filling them in the select-option.
Like follows :
tables : mara.
select-options: s_matnr for mara-matnr.
INITIALIZATION
s_matnr-sign = 'I'.
s_matnr-option = 'EQ'.
s_matnr-low = '1234'.
append s_matnr.
s_matnr-low = '2345'.
append s_matnr.
s_matnr-low = '3456'.
append s_matnr.
Regards,
Himanshu.
2007 Jun 18 10:09 AM
hi,
CALL FUNCTION 'RHP0_POPUP_F4_SEARK'
EXPORTING
f4 = 'X'
plvar = '01'
otype = 'O'
begda = '19000101'
endda = '99991231'
multi_select = 'X'
easy = 'X'
CHANGING
objid = p1
EXCEPTIONS
cancelled = 1
object_not_valid = 2
error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards,
2007 Jun 18 10:09 AM
Hi,
see the following code.
SELECT-OPTIONS: s_org_id FOR hrp1001-sobid NO INTERVALS.
f4 help for org. id
&----
*& Form f_help
&----
text
----
--> p1 text
<-- p2 text
----
FORM f_help .
DATA : lv_org_id TYPE hrobjid.
CALL FUNCTION 'RHP0_POPUP_F4_SEARK'
EXPORTING
f4 = 'X'
plvar = '01'
otype = 'O'
begda = '19000101'
endda = '99991231'
multi_select = 'X'
easy = 'X'
CHANGING
objid = lv_org_id
EXCEPTIONS
cancelled = 1
object_not_valid = 2
error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
s_org_id-low = lv_org_id.
ENDFORM. " f_help
regards,
Ruchika.
reward if useful...........
2007 Jun 18 10:11 AM
Hi,
U can do as follows :
Say internal table ITAB contains all the values fetched from the table.
and S_OPT1 is the select-option on the field to which values have to be assigned
then.
LOOP AT ITAB.
S_OPT1-SIGN = 'I'.
S_OPT1-OPTION = 'EQ'.
S_OPT1-LOW = ITAB-val1.
APPEND S_OPT1.
CLEAR S_OPT1.
ENDLOOP.
If u need to assign the value table ITAB to the field on the screen, the use FM
F4IF_INT_TABLE_VALUE_REQUEST.
Regards,
Himanshu.
2007 Jun 18 10:25 AM
Thanks Himanshu, that solved my problem almost :). (first i tought it was solved.)
The only problem i still have is : The values are stored in my field, but when i look @ the screen, there is nothing filled in in that field. Is there a solution for?
Thanks,
Kind regards,
Tom
Message was edited by:
Tom Vercauteren
I tought it was solved, but it is not completely...
2007 Jun 18 10:32 AM
Hi Tom,
what are you passing in F4IF_FIELD_VALUE_REQUEST.
pass DYNPPROG = sy-repid.
DYNPNR = sy-dnnr.
pass these two parameter carefully..........
regards,
Ruchika
reward if useful...............
2007 Jun 18 10:33 AM
Hi Tom,
In the coding the complete piece of coding should be done in INITIALIZATION event. i.e. fetching the values in the table from the database and then filling them in the select-option.
Like follows :
tables : mara.
select-options: s_matnr for mara-matnr.
INITIALIZATION
s_matnr-sign = 'I'.
s_matnr-option = 'EQ'.
s_matnr-low = '1234'.
append s_matnr.
s_matnr-low = '2345'.
append s_matnr.
s_matnr-low = '3456'.
append s_matnr.
Regards,
Himanshu.
2007 Jun 18 10:56 AM
No no, i think i didn't made myself clear.
The field stays empty, even after i filled it with all fields of my itab.
After some time i saw the clear statement, wich clears the headerfield, and therefore my field remains empty... If i move the clear statement, as first row in the loop, and after the loop i do a read from the first row of my itab, then i get what i need.
Thank you both !!
2007 Jun 18 10:36 AM
Hi,
see the following code and run it...........
REPORT YTEST_VALUE_REQUEST.
TABLES: VBAK.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
VKORG LIKE VBAK-VKORG,
ERNAM LIKE VBAK-ERNAM,
KUNNR LIKE VBAK-KUNNR,
END OF ITAB.
DATA: W_REPID LIKE SY-REPID,
W_DYNNR LIKE SY-DYNNR.
data: lt_dfies_csit TYPE dfies OCCURS 0.
SELECT-OPTIONS: s_KUNNR FOR VBAK-KUNNR.
*W_REPID = SY-REPID.
*at selection-screen.
*move sy-repid to w_repid.
*move sy-dynnr to w_dynnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_KUNNR-LOW.
SELECT VBELN VKORG ERNAM KUNNR FROM VBAK INTO TABLE ITAB.
data: Kunnr1 type VBAK-KUNNR.
data : IT_RETURN type standard table of DDSHRETVAL initial size 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'KUNNR'
PVALKEY = ' '
DYNPPROG = sy-repid
DYNPNR = sy-dynnr
DYNPROFIELD = 'S_KUNNR-LOW'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = ITAB
FIELD_TAB = lt_dfies_csit
RETURN_TAB = IT_RETURN.
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
regards,
Ruchika
reward if useful.......
2007 Jun 18 10:57 AM
this is my code now :
refresh iv_qid.
LOOP AT it_res_f4_qualid.
CLEAR iv_qid.
iv_qid-SIGN = 'I'.
iv_qid-OPTION = 'EQ'.
iv_qid-LOW = it_res_f4_qualid-SOBID.
APPEND iv_qid.
ENDLOOP.
read table iv_qid into iv_qid index 1.
2007 Jun 18 11:28 AM
Hi Tom,
I tried this.
Hi ,
it does not work perfectly but it works.
First the full code of my sample program, explanation afterwards...
REPORT zzself4 .
TABLES:
vbak.
SELECT-OPTIONS: s_kunnr FOR vbak-kunnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_kunnr-low.
PERFORM f4_kunnr.
&----
*& Form F4_kunnr
&----
FORM f4_kunnr .
DATA:
BEGIN OF lt_f4tab OCCURS 0,
vbeln LIKE vbak-vbeln,
vkorg LIKE vbak-vkorg,
ernam LIKE vbak-ernam,
kunnr LIKE vbak-kunnr,
END OF lt_f4tab,
lt_ddshretval TYPE TABLE OF ddshretval WITH HEADER LINE.
SELECT vbeln vkorg ernam kunnr
INTO CORRESPONDING FIELDS OF TABLE lt_f4tab
FROM vbak
UP TO 10 ROWS "For example
.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'KUNNR'
window_title = 'Select customer(s)'
value_org = 'S'
multiple_choice = 'X'
TABLES
value_tab = lt_f4tab
return_tab = lt_ddshretval
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.
ELSE.
LOOP AT lt_ddshretval.
IF sy-tabix = 1.
s_kunnr = 'IEQ'.
s_kunnr-low = lt_ddshretval-fieldval.
ENDIF.
PERFORM insert_range
USING 'IEQ' lt_ddshretval-fieldval '' CHANGING s_kunnr[].
ENDLOOP.
ENDIF.
ENDFORM. " F4_kunnr
&----
*& Form insert_range
&----
insert selection range - handles any range type "CLI20061218
----
FORM insert_range USING p_signopt TYPE c "#EC CALLED
p_low TYPE any
p_high TYPE any
CHANGING pt_range TYPE table.
FIELD-SYMBOLS:
<range> TYPE ANY,
<sign> TYPE ANY,
<option> TYPE ANY,
<low> TYPE ANY,
<high> TYPE ANY.
DATA:
lv_ref TYPE REF TO data.
CHECK NOT ( p_signopt IS INITIAL AND
p_low IS INITIAL AND
p_high IS INITIAL ).
CREATE DATA lv_ref LIKE LINE OF pt_range.
ASSIGN lv_ref->* TO <range>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'SIGN' OF STRUCTURE <range> TO <sign>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'OPTION' OF STRUCTURE <range> TO <option>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'LOW' OF STRUCTURE <range> TO <low>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'HIGH' OF STRUCTURE <range> TO <high>.
CHECK sy-subrc = 0.
<sign> = p_signopt(1).
<option> = p_signopt+1(2).
<low> = p_low.
<high> = p_high.
READ TABLE pt_range WITH KEY table_line = <range> BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc <> 0.
INSERT <range> INTO pt_range INDEX sy-tabix.
ENDFORM. " insert_range
- I put the whole thing into a form, just for modularization.
- The selection is restricted to 10 rows into the table for F4 selection - lt_f4tab (= local table) just not to loose time when testing
- By testing I found out that I had to fill the first value into the selection range table headerline - otherwise it gets lost.
- The culprit is: The extension button does not get the green color. But if you hit it, all values are shown.
Hope this helps.
Regards,
Clemens
2007 Jun 18 12:00 PM
here is the sample code for displaying the F4 value in the screen
PROCESS ON VALUE-REQUEST( F4 ) statement
Code to demonstrate how to perform a manual value help(F4) on a particular field using the PROCESS ON VALUE-REQUEST statement and how to return values back to a table control on the screen. For standard screen fields simply move the value to the appropriate screen field name.
Screen flow logic........
PROCESS BEFORE OUTPUT.
*MODULE PBO_MODULE.
PROCESS AFTER INPUT.
*MODULE PAI_MODULE.
PROCESS ON VALUE-REQUEST. "F4
FIELD EKPO-EBELP MODULE help_ekpo.
* populate screen field from within PROCESS ON VALUE-REQUEST(F4) call
*&------------------------------------------------------------------*
*& Module help_responsibility INPUT
*&------------------------------------------------------------------*
* text
*-------------------------------------------------------------------*
MODULE help_ekpo INPUT.
**Transport values to table dynpro/screen table control
DATA: l_stepl LIKE sy-stepl,
l_indx LIKE sy-stepl.
DATA: dynpfields LIKE dynpread OCCURS 5 WITH HEADER LINE.
* Adjust for scroling within table control
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = l_stepl
EXCEPTIONS
stepl_not_found = 0
OTHERS = 0.
l_indx = tc_ekpotable-top_line + l_stepl - 1.
"tc_ekpotable should already have been declared
REFRESH dynpfields.
CLEAR dynpfields.
dynpfields-fieldname = 'EKPO-EBELN'.
dynpfields-fieldvalue = '00010' "wa_ekpo-ebeln.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
dynpfields-fieldname = 'EKPO-EBELP'.
dynpfields-fieldvalue = '00020' "wa_ekpo-ebelp.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SAPLZZ_EKKO' "Program name
dynumb = '0100' "Screen number
TABLES
dynpfields = dynpfields
EXCEPTIONS
OTHERS = 0.
ENDMODULE. " help_ekpo INPUT
reward points if it is usefull ....
Girish
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |