‎2011 Apr 07 7:29 AM
hi experts,
i had a requirement to restrict the po no in the selection screen to 3 particular values. I had used F4IF_INT_TABLE_VALUE_REQUEST fm but the problem is that the output comes only using f4 option but when i am entering the values manually it doesn't execute.My coding is as follows:
tables : mseg,ekko, mmim_predoc_org.
DATA IT_MARA TYPE MARA OCCURS 0.
DATA : it_return1 LIKE ddshretval OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ITAB OCCURS 0,
REFID LIKE mmim_predoc_org-REFID,
DATLO LIKE mmim_predoc_org-DATLO,
END OF ITAB.
DATA : BEGIN OF IT_SEARCH_HELP OCCURS 0,
VALUE1 like EKKO-EBELN,
END OF IT_SEARCH_HELP.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: P_doc TYPE ekko-ebeln OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b1.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_doc.
IT_SEARCH_HELP-VALUE1 = '4500002203'.
append it_search_help.
IT_SEARCH_HELP-VALUE1 = '4500002203'.
append it_search_help.
IT_SEARCH_HELP-VALUE1 = '4500002202'.
append it_search_help.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'EBELN'
PVALKEY = ' '
DYNPPROG = 'ZMMI_GRN_SF_FORM1'
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_DOC'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ''
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_SEARCH_HELP
FIELD_TAB =
RETURN_TAB = IT_RETURN1
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.
IF SY-SUBRC = 0.
READ TABLE IT_RETURN1 INDEX 1.
p_doc = it_return1-fieldval.
ENDIF.
perform Print_data.
select * from mmim_predoc_org into corresponding fields of table itab
where REFID = p_doc AND REPID = 'SAPLMIGO'.
*
LOOP AT ITAB.
if not itab-REFID is initial.
perform Print_data.
endif.
ENDLOOP.
&----
*& Form PRINT_DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM PRINT_DATA .
DATA : lv_frmname TYPE tdsfname VALUE 'ZMI_SF_FORM',
lv_fmnam TYPE rs38l_fnam.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lv_frmname
IMPORTING
fm_name = lv_fmnam
EXCEPTIONS
no_form = 1
no_function_module = 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.
CALL FUNCTION lv_fmnam
EXPORTING
p_doc = p_doc
TABLES
IT_MARA = IT_MARA
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
regards
pawan.
‎2011 Apr 07 7:55 AM
Hi
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_doc. Is triggered only when you press F4 on p_Doc button,
If you want the same functionality on Enter write the same code under event.
AT SELECTION-SCREEN ON P_doc.
Regards
sachin
‎2011 Apr 07 8:16 AM
hi sachin,
i tried using ur solution of calling it once again under event at selection-screen on p_doc but after that it when i run using f8 it only shows the options but doesn't execute.
regards,
pawan.
‎2011 Apr 07 8:51 AM
Hi,
AT SELECTION-SCREEN ON P_doc. do not write your code for F4 help
under this even validate your input.
Regards.
Bikas
‎2011 Apr 07 9:56 AM
Hi
To restrict this during execution put check SY-UCOMM NE ONLI then only execute the code.
‎2011 Apr 07 9:11 AM