2008 Jan 29 8:44 AM
Hello,
I have an ALV field with F4 help defined, without check table. I need to allow input in this field only possible values from the F4 help. How can I do this? Is there a way to programatically call the F4 help and check the values found ?
2008 Jan 29 9:03 AM
hai.
check this.
See the following ex:
TYPES: BEGIN OF TY_MBLNR,
MBLNR LIKE MKPF-MBLNR,
END OF TY_MBLNR.
DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.
data: it_ret like ddshretval occurs 0 with header line.
At selection-screen on value-request for s_mat-low.
Select MBLNR from mkpf into table it_mblnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'MBLNR'
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_MBLNR
FIELD_TAB =
RETURN_TAB = IT_RET
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_ret index 1.
move it_ret-fieldval to S_mat-low.
ENDIF.
Go through the test program.
REPORT Ztest_HELP .
TABLES : MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_MATNR(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR
FROM MARA
INTO TABLE ITAB
UP TO 10 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATERIAL NUMBER'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = ITAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
regards.
sowjanya.b
2008 Jan 29 9:04 AM
hi dear use field catalog like this
and create help view and attached to this
RES_ID is help view field and ZPP013_004 is the table
if you have any doubts reply me in
nelson.rodrigo@loadstarlk.com
WA_FIELDCAT-FIELDNAME = 'RES_ID' . "Reason - Less Planning
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Reason - Less Plan'.
*-Start of Editable field
WA_FIELDCAT-REF_FIELDNAME = 'RES_ID'.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-REF_TABNAME = 'ZPP013_004'.
*- End of Editable field
WA_FIELDCAT-OUTPUTLEN = 20 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
2008 Jan 29 9:55 AM
Thanks for answers.
But how this changes to the field catalog will enforce only F4 values into my field? I need the F4 help to behave like a check table.
2008 Jan 29 10:05 AM
dear try to understands this program
&----
*& Report ZPP013_UPDATE_REASONS
*&
&----
*&
*&
&----
REPORT ZPP013_UPDATE_REASONS.
************************************************************************
o__ o__ o__ o__ o__ o__ o__ o__ *
.>/) .>/) .>/) .>/) .>/) .>/) .>/) _.>/)*
(_) \(_) (_) \(_) (_) \(_) (_) \(_) (_) \(_) (_) \(_) (_) \(_) (_) \(*
************************************************************************
*----
*
Objective : Update Reason Codes *
Program : Updates Tables ( X ) *
: Outputs List ( X ) *
: Downloads data ( ) *
*
Technical Spec No : FS_PP_013 *
Date Created : 2008-01-23 *
Author : Nelson Rodrigo *
Location : Regent's Court - Sri Lanka *
LDB : N/A *
*
*----
A M E N D M E N T H I S T O R Y *
*----
Who Change ID Reason *
*----
************************************************************************
*----
TABLES : *
*----
*
TABLES : SSCRFIELDS.
TABLES : ZPP013_003.
*
*----
TYPES BEGIN WITH TY_ *
*----
*
TYPE-POOLS : SLIS.
*
*-- Planning Less
TYPES : BEGIN OF TY_ZPP013_003.
INCLUDE STRUCTURE ZPP013_003.
TYPES : KTEXT_UP TYPE CRTX-KTEXT_UP, "Work Center Description
PLN_WGT TYPE P DECIMALS 2, "Plan Weight
END OF TY_ZPP013_003.
*
*-- Production Loss
TYPES : BEGIN OF TY_ZPP013_003_2.
INCLUDE STRUCTURE ZPP013_003.
TYPES : KTEXT_UP TYPE CRTX-KTEXT_UP, "Work Center Description
LOS_QTY TYPE ZPP013_003-GAMNG, "Loss Qty
END OF TY_ZPP013_003_2.
*
*----
CONSTANTS BEGIN WITH C_ *
*----
*
*
*
*----
INTERNAL TABLES BEGIN WITH IT_ *
*----
*
DATA : IT_ZPP013_003 TYPE STANDARD TABLE OF TY_ZPP013_003.
DATA : IT_ZPP013_003_2 TYPE STANDARD TABLE OF TY_ZPP013_003_2.
*
*----
DATA BEGIN WITH V_ *
*----
*
*------ ALV DATA DECLARATIONSs
DATA : FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT LIKE LINE OF IT_FIELDCAT,
IT_HEADER TYPE SLIS_T_LISTHEADER , "List header
WA_HEADER LIKE LINE OF IT_HEADER ,
GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GD_LAYOUT TYPE LVC_S_LAYO,
GD_REPID LIKE SY-REPID,
V_LAYOUT TYPE SLIS_LAYOUT_ALV ,
V_DBCNT TYPE SY-DBCNT,
V_VARIANT LIKE DISVARIANT .
*
*
DATA : ZSTAT TYPE C LENGTH 10.
DATA : PLANT TYPE C LENGTH 4.
DATA : V_DD1 TYPE SY-DATUM. "Demand From Period
DATA : V_DD2 TYPE SY-DATUM. "Demand To Period
DATA : V_ZPCATAGORY TYPE ZPLAN_SECTIONS-ZPCATAGORY.
*
*----
FIELD SYMBOLS BEGIN WITH FS_ *
*----
*
FIELD-SYMBOLS : <FS_ZPP013_003> TYPE TY_ZPP013_003.
FIELD-SYMBOLS : <FS_ZPP013_003_2> TYPE TY_ZPP013_003_2.
*
*----
SELECT OPTIONS / PARAMETERS BEGIN WITH SO_ / BEGIN WITH PR_ *
*----
*
PARAMETERS : PR_RECD TYPE ZPP013_004-RES_ID.
*
*----
I N I T I A L I Z A T I O N *
*----
*
*
*
*----
A T S E L E C T I O N S C R E E N *
*----
*
*
*
************************************************************************
S T A R T O F S E L E C T I O N *
************************************************************************
START-OF-SELECTION.
*
IMPORT V_ZPCATAGORY ZSTAT PLANT V_DD1 V_DD2 FROM MEMORY ID 'ZOVEN'.
*
IF ZSTAT = 'RESLSPLAN'. "For Planning Less
PERFORM ZPP013_DATA_COLLECTION.
PERFORM ZPP013_BUILD_FELDCAT.
PERFORM ZPP013_DISPLAY_FIELDCAT.
ELSEIF ZSTAT = 'RESLSPRDN'. "For Production Loss
PERFORM ZPP013_DATA_COLLECTION_2.
PERFORM ZPP013_BUILD_FELDCAT_2.
PERFORM ZPP013_DISPLAY_FIELDCAT_2.
ENDIF.
*
END-OF-SELECTION.
************************************************************************
E N D O F S E L E C T I O N *
************************************************************************
*
@### Designed by Nelson Rodrigo ###@ *
*
**********************----
E N D O F A B A P
**********************----
*
*
&----
*& Form ZPP013_DATA_COLLECTION
&----
text
----
--> p1 text
<-- p2 text
----
FORM ZPP013_DATA_COLLECTION .
*
DATA : LV_OBJID TYPE CRHD-OBJID.
*
BREAK ITNR.
SELECT *
INTO TABLE IT_ZPP013_003
FROM ZPP013_003
WHERE PLANT EQ PLANT
AND RM_DATE BETWEEN V_DD1 AND V_DD2
AND GAMNG = 0 .
AND MVGR1 EQ V_MVGR.
*
DESCRIBE TABLE IT_ZPP013_003 LINES V_DBCNT.
*
LOOP AT IT_ZPP013_003 ASSIGNING <FS_ZPP013_003>.
*
*----- Work Center Description
SELECT SINGLE OBJID
INTO LV_OBJID
FROM CRHD
WHERE ARBPL EQ <FS_ZPP013_003>-ARBPL
AND WERKS EQ PLANT
AND OBJTY EQ 'A'.
*
SELECT SINGLE KTEXT_UP
INTO <FS_ZPP013_003>-KTEXT_UP
FROM CRTX
WHERE OBJID EQ LV_OBJID
AND OBJTY EQ 'A'
AND SPRAS EQ SY-LANGU.
*
*----- Plan Weight
<FS_ZPP013_003>-PLN_WGT = <FS_ZPP013_003>-RM_PLN_WGT * <FS_ZPP013_003>-GAMNG.
*
ENDLOOP.
*
ENDFORM. " ZPP013_DATA_COLLECTION
*
*
&----
*& Form ZPP013_BUILD_FELDCAT
&----
text
----
--> p1 text
<-- p2 text
----
FORM ZPP013_BUILD_FELDCAT .
*
*
WA_FIELDCAT-FIELDNAME = 'RM_MOD' . "Module
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Module'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'RM_LINE' . "Line
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Line'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'ARBPL' . "Work Center
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'WC Description'.
WA_FIELDCAT-OUTPUTLEN = 12 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'KTEXT_UP' . "Work Center Description
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Work Center'.
WA_FIELDCAT-OUTPUTLEN = 12 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'RM_MOULD' . "Mould
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Mould'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
**
WA_FIELDCAT-FIELDNAME = 'RM_MLD_CAP' . "Per Mould Capaciyt
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Per Mld Capacity'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'GAMNG' . "Plan Quantity
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Plan Quantity'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'PLN_WGT' . "Plan Weight
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Plan Weight'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'RES_ID' . "Reason - Less Planning
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .
WA_FIELDCAT-SELTEXT_M = 'Reason - Less Plan'.
*-Start of Editable field
WA_FIELDCAT-REF_FIELDNAME = 'RES_ID'.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-REF_TABNAME = 'ZPP013_004'.
*- End of Editable field
WA_FIELDCAT-OUTPUTLEN = 20 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
*
ENDFORM. " ZPP013_BUILD_FELDCAT
*
*
&----
*& Form ZPP013_DISPLAY_FIELDCAT
&----
text
----
--> p1 text
<-- p2 text
----
FORM ZPP013_DISPLAY_FIELDCAT .
*
GD_REPID = SY-REPID.
*
*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'ZP013_HEADER'
IS_LAYOUT = V_LAYOUT
IS_VARIANT = V_VARIANT
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_ZPP013_003
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*
ENDFORM. " ZPP013_DISPLAY_FIELDCAT
*
*
*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
*
*BREAK ITNR.
CASE R_UCOMM.
WHEN '&DATA_SAVE'. " Exploring orders with selected materials
*
MODIFY ZPP013_003 FROM TABLE IT_ZPP013_003.
*
IF SY-SUBRC = 0.
MESSAGE 'Successfully Saved' TYPE 'I'.
ENDIF.
ENDCASE.
*
ENDFORM. " ZPP013_DISPLAY_FIELDCAT
*
*
&----
*& Form ZP013_HEADER
&----
text
----
--> p1 text
<-- p2 text
----
FORM ZP013_HEADER .
*
DATA: LV_DATE LIKE SY-DATUM,
LV_PLANT(40) TYPE C,
LV_PRDGP TYPE STRING.
DATA: LV_TYPETXT TYPE STRING.
*
*-- Report Title
IF ZSTAT = 'RESLSPLAN'. "For Planning Less
LV_TYPETXT = 'Update Reason for Less Planning'.
ELSEIF ZSTAT = 'RESLSPRDN'. "For Production Loss
LV_TYPETXT = 'Update Reason for Production Loss'.
ENDIF.
*
*-- Running Plant
LV_PLANT = PLANT.
*
BREAK ITNR.
*-- Product Group
IF V_ZPCATAGORY = 'AIR'.
LV_PRDGP = 'PNEUMATIC'.
ELSEIF V_ZPCATAGORY = 'SOLID'.
LV_PRDGP = 'SOLID'.
ELSEIF V_ZPCATAGORY = 'TRACK'.
LV_PRDGP = 'TRACK'.
ENDIF.
*
REFRESH IT_HEADER.
*
Header Title
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = TEXT-005.
APPEND WA_HEADER TO IT_HEADER.
*
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = LV_TYPETXT.
APPEND WA_HEADER TO IT_HEADER.
*
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Plant : '.
WA_HEADER-INFO = LV_PLANT.
APPEND WA_HEADER TO IT_HEADER.
CLEAR: WA_HEADER.
*
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Product Group : '.
WA_HEADER-INFO = LV_PRDGP.
APPEND WA_HEADER TO IT_HEADER.
CLEAR: WA_HEADER.
*
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Schedule Date : '.
CONCATENATE V_DD16(2) '.' V_DD14(2) '.' V_DD1(4) '- / -'
V_DD26(2) '.' V_DD24(2) '.' V_DD2(4) INTO WA_HEADER-INFO.
APPEND WA_HEADER TO IT_HEADER.
CLEAR: WA_HEADER.
*
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Date : '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO. "todays date
APPEND WA_HEADER TO IT_HEADER.
CLEAR: WA_HEADER.
*
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Time : '.
CONCATENATE SY-UZEIT(2) '.'
SY-UZEIT+2(2) '.'
SY-UZEIT+4(2) INTO WA_HEADER-INFO. "Now Time
APPEND WA_HEADER TO IT_HEADER.
CLEAR: WA_HEADER.
*
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Total Records : '.
WA_HEADER-INFO = V_DBCNT .
APPEND WA_HEADER TO IT_HEADER.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADER.
*
ENDFORM. " ZP013_HEADER
*
*
&----
*& Form ZPP013_DATA_COLLECTION_2
&----
text
----
--> p1 text
<-- p2 text
----
FORM ZPP013_DATA_COLLECTION_2 .
*
DATA : LV_OBJID TYPE CRHD-OBJID.
DATA : LV_WEMNG TYPE ZPP013_003-WEMNG.
*
BREAK ITNR.
SELECT *
INTO TABLE IT_ZPP013_003_2
FROM ZPP013_003
WHERE PLANT EQ PLANT
AND RM_DATE BETWEEN V_DD1 AND V_DD2.
AND MVGR1 EQ V_MVGR.
*
DESCRIBE TABLE IT_ZPP013_003_2 LINES V_DBCNT.
*
LOOP AT IT_ZPP013_003_2 ASSIGNING <FS_ZPP013_003_2>.
*
*----- Work Center Description
SELECT SINGLE OBJID
INTO LV_OBJID
FROM CRHD
WHERE ARBPL EQ <FS_ZPP013_003_2>-ARBPL
AND WERKS EQ PLANT
AND OBJTY EQ 'A'.
*
SELECT SINGLE KTEXT_UP
INTO <FS_ZPP013_003_2>-KTEXT_UP
FROM CRTX
WHERE OBJID EQ LV_OBJID
AND OBJTY EQ 'A'
AND SPRAS EQ SY-LANGU.
*
*----- Loss Qty
<FS_ZPP013_003_2>-LOS_QTY = <FS_ZPP013_003_2>-GAMNG - <FS_ZPP013_003_2>-WEMNG.
*
*----- Delete Unmatch Records
BREAK ITNR.
IF <FS_ZPP013_003_2>-GAMNG = <FS_ZPP013_003_2>-WEMNG.
DELETE IT_ZPP013_003_2 INDEX SY-TABIX.
ENDIF.
*
ENDLOOP.
*
ENDFORM. " ZPP013_DATA_COLLECTION_2
*
*
&----
*& Form ZPP013_BUILD_FELDCAT_2
&----
text
----
--> p1 text
<-- p2 text
----
FORM ZPP013_BUILD_FELDCAT_2 .
*
WA_FIELDCAT-FIELDNAME = 'RM_MOD' . "Module
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Module'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'RM_LINE' . "Line
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Line'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'ARBPL' . "Work Center
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'WC Description'.
WA_FIELDCAT-OUTPUTLEN = 12 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'KTEXT_UP' . "Work Center Description
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Work Center'.
WA_FIELDCAT-OUTPUTLEN = 12 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'RM_MOULD' . "Mould
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Mould'.
WA_FIELDCAT-OUTPUTLEN = 20 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'ORD_NUM' . "Order No
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Order No'.
WA_FIELDCAT-OUTPUTLEN = 20 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'RM_MLD_CAP' . "Per Mould Capacity
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Per Mould Capacity'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'GAMNG' . "Plan Quantity
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Plan Quantity'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'WEMNG' . "Produced Qty
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Produced Qty'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
WA_FIELDCAT-FIELDNAME = 'LOS_QTY'. "Loss Qty
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Loss Qty'.
WA_FIELDCAT-OUTPUTLEN = 10 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
*
WA_FIELDCAT-FIELDNAME = 'RES_ID_LOSS' . "Reason - Production Loss
WA_FIELDCAT-TABNAME = 'IT_ZPP013_003_2' .
WA_FIELDCAT-SELTEXT_M = 'Reason - Loss ProdN'.
*-Start of Editable field
WA_FIELDCAT-REF_FIELDNAME = 'RES_ID'.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-REF_TABNAME = 'ZPP013_004'.
*- End of Editable field
WA_FIELDCAT-OUTPUTLEN = 20 .
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*
*
ENDFORM. " ZPP013_BUILD_FELDCAT_2
*
*
&----
*& Form ZPP013_DISPLAY_FIELDCAT_2
&----
text
----
--> p1 text
<-- p2 text
----
FORM ZPP013_DISPLAY_FIELDCAT_2 .
*
GD_REPID = SY-REPID.
*
*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_USER_COMMAND = 'USER_COMMAND2'
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'ZP013_HEADER'
IS_LAYOUT = V_LAYOUT
IS_VARIANT = V_VARIANT
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_ZPP013_003_2
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*
ENDFORM. " ZPP013_DISPLAY_FIELDCAT
*
*
*
FORM USER_COMMAND2 USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
*
*BREAK ITNR.
CASE R_UCOMM.
WHEN '&DATA_SAVE'. " Exploring orders with selected materials
*
MODIFY ZPP013_003 FROM TABLE IT_ZPP013_003_2.
*
IF SY-SUBRC = 0.
MESSAGE 'Successfully Saved' TYPE 'I'.
ENDIF.
ENDCASE.
*
ENDFORM. " ZPP013_DISPLAY_FIELDCAT_2
2008 Jan 29 12:46 PM
I have defined the fieldcatalog in the same way. I don't understand how you think you can do data validation trough fieldcatalog.
2008 Jan 29 2:53 PM
Hi Marisca,
You need to do a validation in your AT Selection Screen Event to check if user has entered values from the F4 table only.
For example:
SELECT-OPTIONS: s_potobj FOR pernr-orgeh.
In LOAD-OF-PROGRAM.
Get the internal table itab to be displayed in F4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_potobj-low.
Use FM F4IF_INT_TABLE_VALUE_REQUEST to populate F4 Help.
In AT SELECTION-SCREEN.
Validate if user has selected values from F4.
Loop at s_potobj.
Read table itab with key fld1 = s_potobj-low.
if sy-subrc is not initial.
Message 'Select correct value' type 'E'.
endif.
Endloop.
Hope it helps...
Lokesh