2008 Jan 03 12:03 PM
Hi all,
i have two fields in selection screen. A and B
In A if i enter excise group i want related values(F4 Help) from j_1iexchdr
i know DYNP_VALUES_READ is used to read the field and F4IF_INT_TABLE_VALUE_REQUEST is used for F4 help.
but i want the full code .
2008 Jan 03 12:07 PM
hi,
try like this
TYPES : BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr, "CUstomer Code
name1 TYPE kna1-name1, "Customer Code
END OF ty_kna1.
DATA : dyfields LIKE dynpread OCCURS 1 WITH HEADER LINE ,
i_kna1 TYPE TABLE OF ty_kna1 WITH HEADER LINE.
DATA : wa_value_tab TYPE ty_kna1.
DATA : value_tab LIKE wa_value_tab OCCURS 0 WITH HEADER LINE.
DATA : field_tab LIKE dfies OCCURS 0 WITH HEADER LINE.
DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.
PARAMETERS:bukrs LIKE rbkp-bukrs OBLIGATORY.
PARAMETERS : kunnr LIKE kna1-kunnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR kunnr.
CHECK NOT bukrs IS INITIAL .
SELECT kna1kunnr kna1name1
INTO TABLE i_kna1
FROM kna1 INNER JOIN vbrk
ON kna1kunnr = vbrkkunag
WHERE vbrk~bukrs = bukrs. "dyfields-fieldvalue.
SORT i_kna1 BY kunnr.
DELETE ADJACENT DUPLICATES FROM i_kna1.
CLEAR : value_tab,field_tab,return_tab.
REFRESH : value_tab,field_tab,return_tab.
field_tab-fieldname = 'KUNNR'.
field_tab-tabname = 'KNA1'.
APPEND field_tab.
field_tab-fieldname = 'NAME1'.
field_tab-tabname = 'KNA1'.
APPEND field_tab.
field_tab-fieldname = 'KUNNR'.
LOOP AT i_kna1 .
value_tab-kunnr = i_kna1-kunnr.
APPEND value_tab.
CLEAR value_tab.
value_tab-name1 = i_kna1-name1.
APPEND value_tab.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = field_tab-fieldname
TABLES
value_tab = value_tab
field_tab = field_tab
return_tab = return_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
kunnr = return_tab-fieldval.
ENDIF.
2008 Jan 03 12:11 PM
try like this.
may be it is helpful to u.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vkorg FOR vbak-vkorg OBLIGATORY,
s_spart FOR vbrp-spart OBLIGATORY,
s_kunnr FOR vbak-kunnr,
s_matnr FOR vbap-matnr,
s_matkl FOR vbap-matkl,
s_auart FOR vbak-auart OBLIGATORY,
s_audat FOR vbak-audat,
s_vbeln FOR vbak-vbeln ,
s_werks FOR vbap-werks.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_auart-low.
SELECT auart
bezei
FROM tvakt
INTO CORRESPONDING FIELDS OF TABLE i_tvakt
WHERE auart LIKE 'OR%'
AND spras EQ 'EN'.
w_repid = sy-repid.
w_dynnr = sy-dynnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'AUART'
dynpprog = w_repid
dynpnr = w_dynnr
dynprofield = 'S_AUART-LOW'
value_org = 'S'
TABLES
value_tab = i_tvakt.
IF sy-subrc <> 0.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_auart-high.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'AUART'
dynpprog = w_repid
dynpnr = w_dynnr
dynprofield = 'S_AUART-HIGH'
value_org = 'S'
TABLES
value_tab = i_tvakt.
IF sy-subrc <> 0.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vbeln-low.
v_repid = sy-repid.
v_dynum = sy-dynnr.
lw_dynpfields-fieldname = 'S_AUART-LOW'.
APPEND lw_dynpfields.
CLEAR lw_dynpfields.
*
lw_dynpfields-fieldname = 'S_AUART-HIGH'.
APPEND lw_dynpfields.
CLEAR lw_dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = v_repid
dynumb = v_dynum
translate_to_upper = 'X'
TABLES
dynpfields = lw_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 TABLE lw_dynpfields WITH KEY fieldname = 'S_AUART-LOW'.
IF sy-subrc IS INITIAL.
MOVE lw_dynpfields-fieldvalue TO s_auart-low.
ENDIF.
READ TABLE lw_dynpfields WITH KEY fieldname = 'S_AUART-HIGH'.
IF sy-subrc IS INITIAL.
MOVE lw_dynpfields-fieldvalue TO s_auart-high.
ENDIF.
*
s_auart-sign = 'I'.
s_auart-option = 'EQ'.
APPEND s_auart.
SELECT vbeln
FROM vbak
INTO TABLE i_f4
WHERE auart IN s_auart.
w_repid = sy-repid.
w_dynnr = sy-dynnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'VBELN'
dynpprog = w_repid
dynpnr = w_dynnr
dynprofield = 'S_VBELN-LOW'
window_title = text-052
value_org = 'S'
TABLES
value_tab = i_f4.
IF sy-subrc <> 0.
ENDIF.
*-->AT SELECTION SCREEN FOR Contract Number High
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vbeln-high.
w_repid = sy-repid.
w_dynnr = sy-dynnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'VBELN'
dynpprog = w_repid
dynpnr = w_dynnr
dynprofield = 'S_VBELN-high'
window_title = text-052
value_org = 'S'
TABLES
value_tab = i_f4.
IF sy-subrc <> 0.
ENDIF.
reward if it is helpful to u.
Regards,
Arpit
2008 Jan 03 2:03 PM
2008 Jan 03 2:07 PM
Hi,
refer the below sample code.
here i have material and material description on selection screen, based on the material number i am getting F4 functionality for material description.
TABLES: mara.
DATA:
BEGIN OF x_matnr OCCURS 0,
COLOR(18) TYPE C,
maktx like makt-maktx,
END OF x_matnr,
begin of x_lifnr occurs 0,
lifnr like lfa1-lifnr,
end of x_lifnr.
DATA:
l_dynprofld TYPE help_info-dynprofld,
l_matnr(7) TYPE c VALUE 'P_COLOR',
l_prog TYPE sy-repid,
l_dynnr TYPE sy-dynnr.
PARAMETERS: p_COLOR(15) TYPE C,
p_maktx like makt-maktx.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_COLOR.
PERFORM f_get_values.
FORM f_get_values.
DATA: i_return LIKE ddshretval OCCURS 0,
i_dynpfields like DYNPREAD occurs 0 with header line,
l_repid like sy-repid.
l_prog = sy-repid.
l_dynnr = sy-dynnr.
l_dynprofld = l_matnr.
X_MATNR-COLOR = 'RED'.
APPEND X_MATNR.
select l~lifnr from lfb1 as l
inner join BSIK
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'COLOR'
dynpprog = l_prog
dynpnr = l_dynnr
dynprofield = l_dynprofld
value_org = 'S'
TABLES
value_tab = x_matnr
return_tab = i_return.
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " F_GET_VALUES
Reward if useful.
Thanks,
Sreeram.
2008 Jan 03 2:16 PM
Hi Vijay,
Before going to see my answer just see ur question. it's pretty simple. i.e.,
i have two fields in selection screen. A and B
In A if i enter excise group i want related values(F4 Help) from j_1iexchdr
i know DYNP_VALUES_READ is used to read the field and F4IF_INT_TABLE_VALUE_REQUEST is used for F4 help.
but i want the full code .
So i downloaded this code from one site but it's already there in ur message list.But it has changes.So see it once.
TYPES : BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr, "CUstomer Code
name1 TYPE kna1-name1, "Customer Code
END OF ty_kna1.
DATA : dyfields LIKE dynpread OCCURS 1 WITH HEADER LINE ,
i_kna1 TYPE TABLE OF ty_kna1 WITH HEADER LINE.
DATA : wa_value_tab TYPE ty_kna1.
DATA : value_tab LIKE wa_value_tab OCCURS 0 WITH HEADER LINE.
DATA : field_tab LIKE dfies OCCURS 0 WITH HEADER LINE.
DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.
PARAMETERS:bukrs LIKE rbkp-bukrs OBLIGATORY.
PARAMETERS : kunnr LIKE kna1-kunnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR kunnr.
CHECK NOT bukrs IS INITIAL .
SELECT kna1kunnr kna1name1
INTO TABLE i_kna1
FROM kna1 INNER JOIN vbrk
ON kna1kunnr = vbrkkunag
WHERE vbrk~bukrs = bukrs. "dyfields-fieldvalue.
SORT i_kna1 BY kunnr.
DELETE ADJACENT DUPLICATES FROM i_kna1.
CLEAR : value_tab,field_tab,return_tab.
REFRESH : value_tab,field_tab,return_tab.
field_tab-fieldname = 'KUNNR'.
field_tab-tabname = 'KNA1'.
APPEND field_tab.
field_tab-fieldname = 'NAME1'.
field_tab-tabname = 'KNA1'.
APPEND field_tab.
field_tab-fieldname = 'KUNNR'.
LOOP AT i_kna1 .
value_tab-kunnr = i_kna1-kunnr.
APPEND value_tab.
CLEAR value_tab.
value_tab-name1 = i_kna1-name1.
APPEND value_tab.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = field_tab-fieldname
TABLES
value_tab = value_tab
field_tab = field_tab
return_tab = return_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
kunnr = return_tab-fieldval.
ENDIF.
the output of the program is having
2 check boxes will come
those are burks and kunnr
remaining job as u know.
i think u understand the way for F4(Help)
If it is useful Reward me.
Regards,
Mani