关于Field Exit 整理的一点资料

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的数据都有效,这是不一定是我们愿意看到的。
   最后就是要记住激活,这样才能保证它生效。
   大家可以做一个例子试试,还是比较简单的。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值