https://www.sdn.sap.com/irj/scn/thread?messageID=7240781#7240781
Follow this:
- check data element of your field
- go to SE37 and create a function group of your choice
- run the program RSMODPRF
- type your data element and run it
- the system has to create FM for the field exit. It already suggests the name. Do not change it, just create that one.
- assign your previously created Function Group
- don't change the interface of the FM: input and output must be handled here in order to transport data to/from screen. Here you can check it the field fullfills your requirement
IF input = ...
MESSAGE 'Wrong input' TYPE 'E'. "message type E will restart PAI and field will be input ready again
ENDIF.
"at the end you must use this
output = input. "to transport data
- now using menu BACK function go back to program RSMODPRF and activate your field exit (+Fieldexit -> Activate+).
- Don't forget to activate your FG and FM too.
This procedure will activate Global field exit, if you want to create a local one, use the same program but Assing a screen and program to that data element.
==========================
Thanks Marcin Pciak for your Reply.
I am using for KOSTL field.
What i will declare in Import/ Export Tab.
1. I tried with INPUT type KOSTL / OUTPUT type KOSTL. Is it correct ?
2. Also i want for perticular screen & perticular program.
===========================
1) Not necessary but correct
2) Run the program RSMODPRF, leave the fields initial and execute it. This will show all field exits
Now you can see your field as GLOBAL one. To change it to LOCAL follow the steps below:
- Select data element for KOSTL and press Assign Prog/Screen
- Type your program and screen number. For field exit input field, type number of the local fieldexit (i.e.1 as we don't have any other, max 36)
- System again will expect to create FM (this time for LOCAL fieldexit). Do same steps as for GLOBAL fm creation
- Activate FM and FG
- Go back to fieldexit overview, select once again KOSTL and choose from menu Field->Activate
- Run the program with the field and observe the results
Note!
- LOCAL fieldexit can only be created once GLOBAL one is created. So unfortunatelly these 2 procedures must be completed. Though GLOBAL one is not used anymore, don't remove FM for it. System needs it for some internal purposes.
- Do not use any of these command inside this FM: BREAK-POINT, CALL, SUBMIT, COMMIT/ROLLBACK, STOP, REJECT, MESSAGE type W/I
================================================================================
http://hi.baidu.com/gary_c/blog/item/a94d08ef0cf9e233adafd5b3.html
text enhancement字段出口
常用的查找方法
方法一、通過CMOD
列舉出來的可能并不多,如下圖
方法二、通過報表 RSMODPRF
Tcode:SE38 ,輸入報表名
執行後,花啦啦地看到一大堆了,
上面工具欄的是配置設定程式或螢幕 和 編輯函數(Function Module)
下面分别是字段名、狀态、程式名、螢幕,其中狀态必須是活動狀态(ACTIVE)才能生效
操作方法:
配置設定字段到螢幕中 選中字段,點Assign prog./screen
編輯函數 選中字段,點Edit FM
如下圖是編輯函數界面
具體的代碼如下,僅供參考。。。
FUNCTION field_exit_charg_d.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(INPUT)
*" EXPORTING
*" REFERENCE(OUTPUT)
*"----------------------------------------------------------------------
output = input.
*****湖南石油移動類型與批次增強 7007.6.13 begin ******
* "output = input.
IF sy-mandt <> '800'.
DATA: li_bwart LIKE rm07m-bwart,
li_sobkz LIKE rm07m-sobkz.
GET PARAMETER ID 'BWA' FIELD li_bwart.
* MESSAGE e398(00) WITH li_bwart i_sobkz input.
* 不差別特殊庫存了
************************************************************************
* *
*先處理有兩種批次的 OWN CUSTOMER
IF li_bwart EQ '561' OR li_bwart EQ 'Y21'.
IF input NE 'OWN' AND input NE 'CUSTOMER' AND input NE space .
MESSAGE e398(00) WITH
'移動類型' li_bwart '不可對應評估類型' input.
ENDIF.
*隻有一種狀态 OWN
ELSEIF ( li_bwart EQ '101' OR li_bwart EQ '161' OR
li_bwart EQ 'R21' OR li_bwart EQ '411' OR
li_bwart EQ '301' OR li_bwart EQ '401' OR
li_bwart EQ '421' OR li_bwart EQ '403' OR
li_bwart EQ '321' OR li_bwart EQ '309' OR
li_bwart EQ '311' OR li_bwart EQ '351' OR
li_bwart EQ '261' OR li_bwart EQ '917' OR
li_bwart EQ '977' OR li_bwart EQ '979' OR
li_bwart EQ '551' OR li_bwart EQ '969' OR
li_bwart EQ '971' OR li_bwart EQ 'Y03' OR
li_bwart EQ 'Y05' OR li_bwart EQ 'Y09' OR
li_bwart EQ 'Y11' OR li_bwart EQ 'Y13' OR
li_bwart EQ 'Y17' OR li_bwart EQ 'Y19' OR
li_bwart EQ 'Y23' OR
li_bwart EQ '553' OR li_bwart EQ '601' OR
li_bwart EQ '681' OR li_bwart EQ '685' OR
li_bwart EQ '691' OR li_bwart EQ '653' OR
li_bwart EQ 'ZI3' OR li_bwart EQ '201' ).
IF input NE 'OWN' AND input NE space .
MESSAGE e398(00) WITH
'移動類型' li_bwart '不可對應評估類型' input.
ENDIF.
*隻有一種狀态 CUSTOMER
ELSEIF ( li_bwart EQ 'Y71' OR li_bwart EQ 'Y73' ).
IF input NE 'CUSTOMER' AND input NE space .
MESSAGE e398(00) WITH
'移動類型' li_bwart '不可對應評估類型' input.
ENDIF.
*隻有一種狀态 UNPICKED
ELSEIF ( li_bwart EQ 'Z29' OR li_bwart EQ 'Z2A' OR
li_bwart EQ 'Y83' OR li_bwart EQ 'Y85' ).
IF input NE 'UNPICKED' AND input NE space .
MESSAGE e398(00) WITH
'移動類型' li_bwart '不可對應評估類型' input.
ENDIF.
*隻有一種狀态 UNPICKED_S
ELSEIF ( li_bwart EQ 'Y75' OR li_bwart EQ 'Y77' OR
li_bwart EQ 'Y79' OR li_bwart EQ 'Y81' ).
IF input NE 'UNPICKED_S' AND input NE space .
MESSAGE e398(00) WITH
'移動類型' li_bwart '不可對應評估類型' input.
ENDIF.
ENDIF.
* *
************************************************************************
ENDIF.
*****湖南石油移動類型與批次增強 2007.6.13 end ******
ENDFUNCTION.
================================================
http://myx.spaces.live.com/Blog/cns!566D6205634069FF!4143.entry
SAP Field Exits
From 4.6c onwards, Field exits will no more be supported by SAP. They removed the function of field exit but they had given lot of flexibility through userexit.
However, if you still required it, here is how to activate it :-
First called up transaction CMOD.
Then called up transaction PRFB.
or
Activation of the field exits and assignment of the dynpros can also be carried out using program RSMODPRF. For this purpose, the program must be started without parameters (input fields remain blank). If required, new field exits can be created using program RSMODPRF (see the program documentation).
http://www.sap-basis-abap.com/sapab014.htm
=================================================
http://blog.chinaunix.net/u1/59700/showart_1094046.html
ABAP總結之十一,Enhancement(5)--Field Exits Field Exits,我想了一下還是單獨拿出來寫一下比較好。
雖然技術上來講有點像Customer Exits(兩者都是通過function來實作出口的),但是其原理和用途又有很大不同,而且Field Exits,SAP在4.6之後就不再支援了,如果沒有用過這個技術,想要用,還要重新啟動PRD才行,很麻煩,是以這裡隻是做個介紹性來談談這種出口方式。
大家可以在SE38裡,運作程式RSMODPRF來尋找已經存在的Field Exits,同時也可以進入Field Exits的管理界面。
還有一種方法,就是在CMODZ界面,在T-CODE欄中鍵入PRFB也可以進入Field Exits的管理界面。
Field Exit->Create 就可以建立一個Field Exits,隻要有相應的Data Element在資料庫中存在,就能建立出針對這個Data Element的Field Exits。同時會要生成一個FIELD_EXIT_開頭的function,用以做相應的增強。裡面有兩個參數,Input和Output,這兩個參數是固定的,不能修改。Input是将螢幕字段的值傳到出口程式,而Output則是傳出。
出口程式中,有些ABAP語句是受限制的
call screen, call dialog, call transaction, submit
commit work, rollback work
communication receive
exit from step-loop
message i, message w
stop, reject
是以也種出口的功能帶來了限制。同時,debug是field exit會被忽略,是以對糾錯來說也是一個不利,你隻能做單元測試,而不能做內建測試。
要對Field Exits做得更細,那就要給它配置設定,程式及其對應的螢幕号,否則你做出來的就是全局的,對于用到你所定義的Element的資料都有效,這是不一定是我們願意看到的。
最後就是要記住激活,這樣才能保證它生效。
大家可以做一個例子試試,還是比較簡單的。