`
guanhuaing
  • 浏览: 1193500 次
文章分类
社区版块
存档分类
最新评论

MM--关于MM06E005增强的激活Note

 
阅读更多

You can use the sample source code attached here to recognize the basic functions of the exit. This example is, however, only one of many options that are offered by the customer enhancement.
The sample source code includes the following functions:

  • Supply of an additional field on header level
  • Supply of an additional field on item level
  • Derivation of a field on item level from the copied reference document


Now, in order to be able to use the sample source code, you must create field ZZFLAG on the header level of the document and field ZZFIELD on the item level.
Double-click on Include table CI_EKKODB
Enter the following values:

  • NameComponent type DType Length DecPlace Short text
  • ZZFLAGCHAR1CHAR101-digit indicator


Save and activate the include table.

Double-click on Include table CI_EKPODB
Enter the following values:

  • NameComponent type DType Length DecPlace Short Text
  • ZZFIELD CHAR1CHAR101-digit indicator


Save and activate the include table.

In order to activate the sample source code, you additionally have to carry out the following changes on screens 0101 and 0111.

    1. Screen 0101: Create the following fields:

"Checkbox"Name: EKKO_CI-ZZFLAG

    2. Screen 0111: Create the following fields:

"Input/output field"Name: EKPO_CI-ZZFIELD

"Pushbutton"Name: BUTTON

FctCode: ZZDETERMINE


The following assignments apply to the sample source code:
EXIT_SAPMM06E_006-->ZXM06F36
EXIT_SAPMM06E_007-->ZXM06F38
EXIT_SAPMM06E_008-->ZXM06F37
EXIT_SAPMM06E_009-->ZXM06F39
EXIT_SAPMM06E_016-->ZXM06F41
EXIT_SAPMM06E_017-->ZXM06F42
EXIT_SAPMM06E_018-->ZXM06F40

Copy the source code from the attachment and insert it into the corresponding function modules. Save and activate the function modules.
Create the following variables in the corresponding TOP include in order not to get any syntax errors:

*
* INCLUDE ZXM06TOP
*
data: gl_aktyp type c,
gl_no_screen type c,
gl_rekko like ekko,
gl_ekko_ci like ekko_ci,
gl_ekpo_ci like ekpo_ci,
gl_ekpo like ekpo,
gl_ucomm like sy-ucomm.

types: begin of ekpo_tab,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
ekpo like ekpo,
end of ekpo_tab.

data:gt_ref_ekpo_tab type table of ekpo_tab.

Save and activate the TOP include.

On header level, you can now store a character, X or space, via field ZZFLAG on the database with the document and read it also again.
On item level, you can fill field ZZFIELD with a one-digit value and save it with the document. If you copy this document, the system displays an additional function button on tab page "Customer data". If you press this button, the value of the reference document is copied to field ZZFIELD.

If you want to store the source code as sample source code in your system, start Transaction SMOD. Enter MM06E005 as an enhancement. Select "Components". Press "Change". Position the cursor on the corresponding module and choose "Sample code". Create the corresponding include and copy the source code from the note. Save the include. Note that, of course, syntax errors may occur when you check components. This is because the includes of the sample code are not integrated into a program but rather are completely independent and, therefore, do not have any relationship to each other either. For this reason, only save the include and do not activate or check it. The sample code has to be copied into the corresponding function modules in order to become active.
If you use the user exit in the new purchase order, it is not guaranteed that the customer screen is always processed. To make sure that possible required fields are checked, include a corresponding message into the EXIT_SAPMM06E_012. This screen is always processed.

相关代码:

*----------------------------------------------------------------------*<script><!--mce:0--></script>
*   INCLUDE ZXM06F36                                                   *<script><!--mce:1--></script>
*----------------------------------------------------------------------*<script><!--mce:2--></script><script><!--mce:3--></script>*<script><!--mce:4--></script>
* store transaction type for later modification of screen attributes<script><!--mce:5--></script>
*<script><!--mce:6--></script>
gl_aktyp = i_trtyp.<script><!--mce:7--></script><script><!--mce:8--></script>gl_no_screen = i_no_screen.<script><!--mce:9--></script><script><!--mce:10--></script><script><!--mce:11--></script>*<script><!--mce:12--></script>
* store current state of customer data in ekko_ci (structure for screen)<script><!--mce:13--></script>
*<script><!--mce:14--></script>
ekko_ci  = i_ci_ekko.<script><!--mce:15--></script><script><!--mce:16--></script>*<script><!--mce:17--></script>
* store reference document<script><!--mce:18--></script>
*<script><!--mce:19--></script>
if i_rekko-ebeln ne gl_rekko-ebeln and<script><!--mce:20--></script>
   not i_rekko-ebeln is initial    and<script><!--mce:21--></script>
   gl_rekko-ebeln is initial.<script><!--mce:22--></script><script><!--mce:23--></script>   ekko_ci-zzflag = i_rekko-zzflag.<script><!--mce:24--></script><script><!--mce:25--></script>   gl_rekko = i_rekko.<script><!--mce:26--></script><script><!--mce:27--></script>endif.<script><!--mce:28--></script>
*----------------------------------------------------------------------*<script><!--mce:29--></script>
*   INCLUDE ZXM06F37                                                   *<script><!--mce:30--></script>
*----------------------------------------------------------------------*<script><!--mce:31--></script><script><!--mce:32--></script>*<script><!--mce:33--></script>
* e_ci_ekko is the returning parameter<script><!--mce:34--></script>
* gl_ekko_ci : values stored at PBO<script><!--mce:35--></script>
*<script><!--mce:36--></script><script><!--mce:37--></script>e_ci_ekko        = gl_ekko_ci.<script><!--mce:38--></script><script><!--mce:39--></script>*<script><!--mce:40--></script>
* ekko_ci contains the actual values of the Dynpro fields<script><!--mce:41--></script>
* e_ci_update is only set if you really want the fields<script><!--mce:42--></script>
* on the Dynpro to be saved. You must set it then to 'X'<script><!--mce:43--></script>
* the field ekko_ci-zzflag will here only be saved if there<script><!--mce:44--></script>
* was a change and the transaction is not in display mode<script><!--mce:45--></script>
*<script><!--mce:46--></script><script><!--mce:47--></script>if gl_ekko_ci-zzflag ne ekko_ci-zzflag.<script><!--mce:48--></script>
  e_ci_ekko-zzflag = ekko_ci-zzflag.<script><!--mce:49--></script>
  if gl_aktyp ne 'A'.<script><!--mce:50--></script>
    e_ci_update = 'X'.<script><!--mce:51--></script>
  endif.<script><!--mce:52--></script>
endif.<script><!--mce:53--></script>
*----------------------------------------------------------------------*<script><!--mce:54--></script>
*   INCLUDE ZXM06F38                                                   *<script><!--mce:55--></script>
*----------------------------------------------------------------------*<script><!--mce:56--></script><script><!--mce:57--></script>*<script><!--mce:58--></script>
* store ekko to gl_ekko<script><!--mce:59--></script>
*<script><!--mce:60--></script>
move-corresponding i_ekko to gl_ekko_ci.<script><!--mce:61--></script>
*----------------------------------------------------------------------*<script><!--mce:62--></script>
*   INCLUDE LXM06F39                                                   *<script><!--mce:63--></script>
*----------------------------------------------------------------------*<script><!--mce:64--></script><script><!--mce:65--></script>clear: ekko_ci,<script><!--mce:66--></script>
       ekpo_ci,<script><!--mce:67--></script>
       gl_no_screen,<script><!--mce:68--></script>
       gl_aktyp,<script><!--mce:69--></script>
       gl_ekko_ci,<script><!--mce:70--></script>
       gl_rekko,<script><!--mce:71--></script>
       gl_ekpo,<script><!--mce:72--></script>
       gl_ucomm.<script><!--mce:73--></script><script><!--mce:74--></script>refresh: gt_ref_ekpo_tab.<script><!--mce:75--></script>
*----------------------------------------------------------------------*<script><!--mce:76--></script>
*   INCLUDE ZXM06F40                                                   *<script><!--mce:77--></script>
*----------------------------------------------------------------------*<script><!--mce:78--></script>
*<script><!--mce:79--></script>
* move stored global values back to the returning structure<script><!--mce:80--></script>
*<script><!--mce:81--></script><script><!--mce:82--></script>e_ci_ekpo        = gl_ekpo_ci.<script><!--mce:83--></script><script><!--mce:84--></script>*<script><!--mce:85--></script>
* in case the Button was clicked the value of ekpo_ci-zzfield<script><!--mce:86--></script>
* will be taken from the copied PO<script><!--mce:87--></script>
*<script><!--mce:88--></script><script><!--mce:89--></script>if i_ucomm = 'ZZDETERMINE'.<script><!--mce:90--></script><script><!--mce:91--></script>  data: ls_ref_ekpo like line of gt_ref_ekpo_tab.<script><!--mce:92--></script><script><!--mce:93--></script>*<script><!--mce:94--></script>
* gt_ref_ekpo_tab contains all positions of the copied PO<script><!--mce:95--></script>
*<script><!--mce:96--></script><script><!--mce:97--></script>  read table gt_ref_ekpo_tab into ls_ref_ekpo<script><!--mce:98--></script>
      with key ebelp = gl_ekpo-ebelp.<script><!--mce:99--></script><script><!--mce:100--></script>  if sy-subrc is initial.<script><!--mce:101--></script><script><!--mce:102--></script>    ekpo_ci-zzfield = ls_ref_ekpo-ekpo-zzfield.<script><!--mce:103--></script><script><!--mce:104--></script>  endif.<script><!--mce:105--></script><script><!--mce:106--></script>else.<script><!--mce:107--></script><script><!--mce:108--></script>*<script><!--mce:109--></script>
* return the function code of the Screen. This code will be handled<script><!--mce:110--></script>
* in the SAP program. It can only be handled if you use SAP function<script><!--mce:111--></script>
* codes<script><!--mce:112--></script>
*<script><!--mce:113--></script><script><!--mce:114--></script>  e_ucomm = i_ucomm.<script><!--mce:115--></script>
endif.<script><!--mce:116--></script><script><!--mce:117--></script>*<script><!--mce:118--></script>
* ekko_ci contains the actual values of the Dynpro fields<script><!--mce:119--></script>
* e_ci_update is only set if you really want the fields<script><!--mce:120--></script>
* on the Dynpro to be saved. You must set it then to 'X'<script><!--mce:121--></script>
* the field ekko_ci-zzfield will here only be saved if there<script><!--mce:122--></script>
* was a change and the transaction is not in display mode<script><!--mce:123--></script>
*<script><!--mce:124--></script><script><!--mce:125--></script>if gl_ekpo_ci-zzfield ne ekpo_ci-zzfield.<script><!--mce:126--></script>
  e_ci_ekpo-zzfield = ekpo_ci-zzfield.<script><!--mce:127--></script>
  if gl_aktyp ne 'A'.<script><!--mce:128--></script>
    e_ci_update = 'X'.<script><!--mce:129--></script>
  endif.<script><!--mce:130--></script>
endif.<script><!--mce:131--></script>
*----------------------------------------------------------------------*<script><!--mce:132--></script>
*   INCLUDE ZXM06F41                                                   *<script><!--mce:133--></script>
*----------------------------------------------------------------------*<script><!--mce:134--></script><script><!--mce:135--></script>
data: ls_ref_ekpo like line of gt_ref_ekpo_tab.<script><!--mce:136--></script><script><!--mce:137--></script>
*<script><!--mce:138--></script>
* store transaction type for later modification of screen attributes<script><!--mce:139--></script>
*<script><!--mce:140--></script>
gl_aktyp = i_aktyp.<script><!--mce:141--></script><script><!--mce:142--></script>
gl_no_screen = i_no_screen.<script><!--mce:143--></script><script><!--mce:144--></script><script><!--mce:145--></script>
*<script><!--mce:146--></script>
* store current state of customer data in ekko_ci (structure for screen)<script><!--mce:147--></script>
*<script><!--mce:148--></script>
ekpo_ci  = i_ci_ekpo.<script><!--mce:149--></script><script><!--mce:150--></script>
gl_ekpo = i_ekpo.<script><!--mce:151--></script><script><!--mce:152--></script>
if not i_rekpo-ebeln is initial and<script><!--mce:153--></script>
   not i_ekpo-ebelp is initial.<script><!--mce:154--></script><script><!--mce:155--></script>
  clear ls_ref_ekpo.<script><!--mce:156--></script><script><!--mce:157--></script>
  read table gt_ref_ekpo_tab into ls_ref_ekpo<script><!--mce:158--></script>
      with key ebelp = i_ekpo-ebelp.<script><!--mce:159--></script><script><!--mce:160--></script>
  if ls_ref_ekpo-ekpo-ebeln ne i_rekpo-ebeln and<script><!--mce:161--></script>
     ls_ref_ekpo-ekpo-ebelp ne i_rekpo-ebelp.<script><!--mce:162--></script><script><!--mce:163--></script>
     ls_ref_ekpo-ebelp = i_ekpo-ebelp.<script><!--mce:164--></script>
     ls_ref_ekpo-ekpo = i_rekpo.<script><!--mce:165--></script><script><!--mce:166--></script>
     if sy-subrc is initial.<script><!--mce:167--></script>
       modify gt_ref_ekpo_tab from ls_ref_ekpo index sy-tabix.<script><!--mce:168--></script>
     else.<script><!--mce:169--></script>
       append ls_ref_ekpo to gt_ref_ekpo_tab.<script><!--mce:170--></script>
     endif.<script><!--mce:171--></script><script><!--mce:172--></script>
  endif.<script><!--mce:173--></script><script><!--mce:174--></script>
endif.<script><!--mce:175--></script>
*----------------------------------------------------------------------*<script><!--mce:176--></script>
*   INCLUDE ZXM06F42                                                   *<script><!--mce:177--></script>
*----------------------------------------------------------------------*<script><!--mce:178--></script><script><!--mce:179--></script>
move-corresponding i_ekpo to gl_ekpo_ci.<script><!--mce:180--></script>
gl_ekpo = i_ekpo.<script><!--mce:181--></script>

note number:407975

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics