Wednesday, August 27, 2014
You all know that function module F4IF_INT_TABLE_VALUE_REQUEST is used to display F4 help / Search help for PARAMETERS or SELECT-OPTIONS. But for SELECT-OPTIONS, you may need to enter multiple single values. To avoid multiple times opening F4 help, Use MULTIPLE_CHOICE parameter in the exporting parameters of F4IF_INT_TABLE_VALUE_REQUEST which will open check box for each record on F4 help.
Follow the sample program which illustrates the same.
F4 help screen
After values are selected.
Follow the sample program which illustrates the same.
REPORT ZTEST_F4_MULTICHOICE. TABLES: P0001. TYPES: BEGIN OF TY_PERNRS, PERNR TYPE P0001-PERNR, ENDDA TYPE P0001-ENDDA, BEGDA TYPE P0001-BEGDA, ENAME TYPE P0001-ENAME, END OF TY_PERNRS. DATA: IT_MARK TYPE DDSHMARKS, WA_MARK LIKE LINE OF IT_MARK, IT_PERNRS TYPE STANDARD TABLE OF TY_PERNRS, WA_PERNRS TYPE TY_PERNRS. SELECT-OPTIONS: S_PERNR FOR P0001-PERNR NO INTERVALS. AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PERNR-LOW. PERFORM F4_FOR_PERNR USING 'S_PERNR-LOW'. *&---------------------------------------------------------------------* *& Form F4_FOR_PERNR *&---------------------------------------------------------------------* FORM F4_FOR_PERNR USING P_SEL_FIELD. TYPES: LTY_DYNPREAD TYPE DYNPREAD, LTY_RET_TAB TYPE DDSHRETVAL, LTY_DFIES TYPE DFIES. DATA: LT_DYNPREAD TYPE STANDARD TABLE OF LTY_DYNPREAD, LT_RET_TAB TYPE STANDARD TABLE OF LTY_RET_TAB, LT_DFIES TYPE STANDARD TABLE OF LTY_DFIES. DATA: LS_DYNPREAD TYPE LTY_DYNPREAD, LS_RET_TAB TYPE LTY_RET_TAB, LS_DFIES TYPE LTY_DFIES. DEFINE F4_FIELDS. LS_DFIES-FIELDNAME = &1. LS_DFIES-INTLEN = &2. LS_DFIES-LENG = &3. LS_DFIES-OUTPUTLEN = &4. LS_DFIES-OFFSET = &5. LS_DFIES-SCRTEXT_S = &6. LS_DFIES-SCRTEXT_M = &7. LS_DFIES-SCRTEXT_L = &8. LS_DFIES-REPTEXT = &9. APPEND LS_DFIES TO LT_DFIES. CLEAR LS_DFIES. END-OF-DEFINITION. F4_FIELDS: 'PERNR' '16' '16' '16' '000' 'PERNR' 'PERNR' 'PERNR' 'PERNR', 'ENDDA' '16' '16' '16' '016' 'ENDDA' 'ENDDA' 'ENDDA' 'ENDDA', 'BEGDA' '16' '16' '16' '032' 'BEGDA' 'BEGDA' 'BEGDA' 'BEGDA', 'ENAME' '80' '80' '80' '048' 'ENAME' 'ENAME' 'ENAME' 'ENAME'. SELECT DISTINCT * FROM PA0001 INTO CORRESPONDING FIELDS OF TABLE IT_PERNRS WHERE ENAME NE SPACE AND BEGDA LE SY-DATUM AND ENDDA GE SY-DATUM. SORT IT_PERNRS. DELETE ADJACENT DUPLICATES FROM IT_PERNRS COMPARING ALL FIELDS. SY-DYNNR = 1000. * PERFORM INIT_FIELD_TAB CHANGING LT_DFIES. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING RETFIELD = 'PERNR' DYNPPROG = SY-REPID DYNPNR = SY-DYNNR DYNPROFIELD = P_SEL_FIELD VALUE_ORG = 'S' MULTIPLE_CHOICE = 'X' MARK_TAB = IT_MARK TABLES FIELD_TAB = LT_DFIES VALUE_TAB = IT_PERNRS RETURN_TAB = LT_RET_TAB. * CLEAR S_pernr[]. DATA LV_VALUE TYPE SHVALUE_D. CLEAR IT_MARK. LOOP AT LT_RET_TAB INTO LS_RET_TAB . READ TABLE IT_PERNRS INTO WA_PERNRS WITH KEY PERNR = LS_RET_TAB-FIELDVAL. IF SY-SUBRC EQ 0. WA_MARK = SY-TABIX. APPEND WA_MARK TO IT_MARK. CLEAR WA_MARK. ENDIF. LV_VALUE = LS_RET_TAB-FIELDVAL. AT FIRST. S_PERNR-LOW = LV_VALUE. S_PERNR-SIGN = 'I'. S_PERNR-OPTION = 'EQ'. APPEND S_PERNR. CLEAR S_PERNR. ENDAT. S_PERNR-LOW = LS_RET_TAB-FIELDVAL. S_PERNR-SIGN = 'I'. S_PERNR-OPTION = 'EQ'. APPEND S_PERNR. CLEAR S_PERNR. ENDLOOP. CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'. ENDFORM. " F4_FOR_PERNR
Points to note
- Once you select values from F4 help, RETURN_TAB will return selected values. Populated Select-Option table with selected values.
- Use function module SAPGUI_SET_FUNCTIONCODE which refreshes the selection-screen.This module simulates user input in the command field. This enables you to run screen sequences without user input.
Output
Selection ScreenF4 help screen
After values are selected.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Sending email with pdf attachment
- ABAP - Step by step tutorial on Smart Forms - Template Node
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
Hi
ReplyDeleteI started my new agency and was looking for this kind of informative post right from the first day ! Glad that you could help me now.
Regards
Digital Marketing Services
Hi
ReplyDeleteThese were extremely easy to understand and grasp. I was going looking for such kind of articles from a very long time. Glad that I could find this atleast now. Keep going and nice stuffs indeed !
Regards
Digital Marketing Training
helpfull
ReplyDeletehttps://www.carejunk.in/
duplicates are getting in while selection
ReplyDeleteGet 50 Free Spins at Casino Roll
ReplyDeleteCasino Roll has been around since 2007, 타이 산 카지노 making it the longest-running online 마틴 게일 casino in the UK. With an online m2슬롯 poker site, this site is 커뮤니티 사이트 not 슬롯가입쿠폰