2011年9月23日

在ABAP的SQL语句中写Oracle Hints

①用过的两个写法:
  1、指定使用全表扫描:%_HINTS ORACLE 'FULL(table_name)'
  2、指定索引:%_HINTS ORACLE 'INDEX(table_name index_name)'
  其他Oracle Hints的写法可以参见这篇文章:Oracle Hint的用法
  在SQL语句优化过程中,经常会用到hint。
  ②Using secondary indexes
  Consider the following example:
  SELECT * FROM SPFLI
  %_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'
  .......
  ENDSELECT.In the above example, 001 is the secondary index of the table SPFLI. It's a well-known fact that the efficient way of retrieving data from the database tables is by using secondary indexes. Many database vendors provide the optimizer hints for the same. From SAP v4.5, optimizer hints can be provided by the %_HINTS parameter. This is dependent on the database systems that support optimizer hints. The point to be noted here is these optimizer hints are not standardized by the SQL standards. Each database vendor is free to provide the optimizer hints.
  Now to know which index to use for our table:
  1. Go to SE11 and there specify the table name
  2. Now from the menu, goto --> indexes
  3. select the required index.
  Now suppose that the identifier 001 represents a non-unique secondary index comprising of the columns CITYFROM and CITYTO. The index name should be defined as:
  ~
  like SPFLI~001 in the above example.The sequence of fields in the WHERE condition is of no relevance in using this optimizers index. If you specify hints incorrectly, ABAP ignores them but doesn't return a syntax error or runtime error.
  The code was written in R/3 4.6C.
  Code
  Consider the following example:
  REPORT Suresh_test.
  TABLES: spfli.
  DATA : t_spfli LIKE spfli OCCURS 0 WITH HEADER LINE.
  SELECT * FROM spfli
  INTO TABLE t_spfli
  %_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'.
  LOOP AT t_spfli.
  WRITE :/ t_spfli.
  ENDLOOP.
  ③ABAP--如何在SELECT语句中指定索引(example)
  report z_generic_test_program .
  tables: csks. start-of-selection.
  select * up to 10 rows from csks
  where kokrs <> space and
  kostl <> space %_hints oracle 'index(csks"J")'.
  write: / csks. endselect.
  ④Control over FOR ALL ENTRIES Hints
  Under the heading Database Interface Hints, Note 129385 describes the options you have for influencing the database interface by entering hints. The hints are evaluated in the database interface itself and are not passed on to the database. Starting with kernel Release 4.6B all the above mentioned FOR ALL ENTRIES parameters can be set via such a hint for a single statement. In the example:
  SELECT * FROM [..] FOR ALL ENTRIES IN [..] WHERE [..]
  %_HINTS ORACLE '&prefer_in_itab_opt 1&&prefer_fix_blocking -1&'.
  This way, the boolean parameter 'prefer_in_itab_opt' is explictly set and the boolean parameter 'prefer_fix_blocking' is set to its default value. FOR ALL ENTRIES hints, like hints are generally only used as a a corrective device in

posted @ 2011-09-23 15:58 highmayor 阅读(27) 评论(0) 编辑

2011年7月25日

Screen numbers

Screen numbers greater than 9000 are reserved for SAP customers. Screen numbers 1000 through 1010 are reserved for the maintenance screens of ABAP Dictionary tables and the standard selection screens of reports.

 

选择屏幕编号范围:1000-1999
录入屏幕编号范围:1-999
子屏幕编号范围:3000-4999

 

在HR中你只能定义9000以上的屏幕号。

posted @ 2011-07-25 15:50 highmayor 阅读(7) 评论(0) 编辑

2011年6月17日

ABAP 培训笔记 part 7

子屏幕
 
 
建立步骤:
1.       先建立一个新的程序以存放子屏幕screen type ---subscreen
2.       在主程序屏幕中 建立子屏幕区域(名称一定要大写)
3.       在屏幕的PBO中 调用子屏幕
        call subscreen [屏幕区域名] including ‘[子屏幕程序名]’ ‘[子屏幕号]’.
4.       在PAI中 调用子屏幕区域
Call subscreen [屏幕区域名].
 
   可能每一个事业部 有一个SAP系统,
   不同的程序适合不同的事业部
机会!!!!(子屏幕没出现)--- 没把握住机会….. 从新建立,成功了..
 
选项卡 tabstrip control
 
   选项卡分两种: 点击按钮不出现对应的子屏幕(没有实际价值) 和 点击按钮出现子屏幕
   注意 选项卡组成部分,  按钮 屏幕区域 内容(子屏幕)
    建立tabstrip control步骤:
1.       先选择 tabstrip控件
2.       为控件起名(大写)
3.      为按钮控件起名 并填写重要参数
  fctcode = TAB1.   (该按钮的OK_CODE)
Ref. Field [区域名](引用区域) 
(重点)fctype 变为P
            p:local gui function(TAB下载在本地增加效率)空格:到了服务器
4.       建立其他按钮控件
5.       controls 定义tabstrip : controls  tabstrip  type  tabstrip.
6.       在PBO区域中加入子程序  call subscreen [区域名] including ‘[子屏幕程序名]’ ‘[屏幕号]’
7.       PBI 中 放入call subscreen sub3.
8.       在PBO中写入 显示MODULE 语句: module tabstrip_display.
9.        TAB中的按钮标题 tabstrip-activetab (tab活动的标题)
     定义 一个data dynnr type sy-dynnr.(系统所指的页面)
      Case tabstrip-activetab.
       When ‘TAB1’.
         Dynnr = ‘101’.
       When ‘TAB2’.
         Dynnr = ‘102’.
      When others.
         Dynnr = ‘101’.
      tabstrip-activetab = ‘TAB1’.
                 Endcase.
10.   当点击 按钮 的时候 要在PAI执行程序
     Case ok_code.
      When ‘TAB1’ or ‘TAB2’.
         Tabstrip-activetab = OK_CODE.
 
     End case.
       又出现机会了!!!!  SUB2跑出来了
 
Table control
使用向导 可以非常简便
在layout中使用 table control向导
Name of table control  建立名称
Table name  dictionary table EKPO
Internal program table (内表)it_EKPO
 
 Output only 仅仅输出
  Scroll 可以是滚动的
 
Set includes所包含的地方
 
 
输出后 没有数据
 
数内表的行数 需要用describe table it_ekpp lines tab_con-lines.
通过行数建立table control
需要添家
loop内表之前
Select * from ekpo into corresponding fields of  table it_ekpo.
 
Table control 运作原理
  要想显示数据  先从数据库表中把数据放到数据库内表中
然后屏幕 逐行 出现 数据.
 
填充过程
 
又有机会了~~~  做向导时  不出现tablecontrol
 
当拉动数值滚动条时 会跳到下一屏幕 如果停留在 本屏幕 就可以拉动了
 
 
 
SAP系统实现的形式
Business Engineer tools
Customizing定制:A1 带有模板的R/3 实施要比普通R/3要便宜
Personalization 个性化设定
 
技术人员 自行开发
Modification(修订)---更改系统程序---
Enhancement (增强)----增加系统功能
Customer development (用户开发)---自行开发报表
 
尽可能不修订(需要后期升级)
尽可能多使用系统功能
 
蓝图阶段  一般不进入ABAP
 
业务顾问实力 取决于 跟过的项目  
ABAP 程序员 实力取决于 开发的时间
 
实施SAP现要先培训一些精英用户---关键用户.
业务顾问的前身---关键用户.
 
学生刚到的时候 就是关键用户.’
 
深圳的公司SD的业务 非常复杂 MM会较为轻松
 
关键用户 给  一般用户授课.
 
业务顾问 和 关键用户 编写 操作手册
 
沟通的能力 还耐心!!!!!!!!!
 
ABAP---业务顾问----项目经理
 
先接到功能设计书 和业务顾问沟通
 
会计基础知识
 
英语!!!!!!!!!!!!!!!口语!!!!!!!!!!!!!!!!

posted @ 2011-06-17 09:11 highmayor 阅读(52) 评论(0) 编辑

2011年6月7日

更改选择屏幕的GUI STATUS---RS_SET_SELSCREEN_STATUS

REPORT ZEXAMPLE.

DATA: BEGIN OF P_EXTAB OCCURS 0,

        FCODE LIKE SY-PFKEY,

      END OF P_EXTAB.

PARAMETERS P_FCODE LIKE SY-PFKEY.

P_EXTAB-FCODE = P_FCODE.

APPEND P_EXTAB.

INITIALIZATION.

CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'

     EXPORTING

          P_STATUS  = 'Z_SELSCREEN'"自定义的GUI STATUS

     TABLES

          P_EXCLUDE = P_EXTAB

     EXCEPTIONS

          OTHERS    1.

IF SY-SUBRC EQ 0.

  WRITE:/ 'FUNCTION', P_FCODE, 'HAS BEEN DISABLED'.

ELSE.

  WRITE:/ 'COULD NOT DISABLE', P_FCODE.

ENDIF.

posted @ 2011-06-07 16:02 highmayor 阅读(34) 评论(0) 编辑

隐藏标准选择屏幕的执行按钮

关键字: abap
CONSTANTS cns_exec(4)   TYPE  c       VALUE 'ONLI'.
DATA      td_exclude    TYPE TABLE OF sy-ucomm.

PARAMETER p_1 TYPE lifnr.

AT SELECTION-SCREEN OUTPUT.
  APPEND cns_exec TO td_exclude.
  CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
    EXPORTING
      p_status  = sy-pfkey
    TABLES
      p_exclude = td_exclude.

posted @ 2011-06-07 16:01 highmayor 阅读(25) 评论(0) 编辑

2011年5月13日

SAP秀才-FI速成手册

http://scola.wang.blog.163.com/blog/static/886636482009481471613/

posted @ 2011-05-13 15:25 highmayor 阅读(37) 评论(0) 编辑

2011年3月15日

FOR ALL ENTRIES的效率问题

摘要: 今天与jgtang82讨论FOR ALL ENTRIES与JOIN问题 SAP的数据字典对FOR ALL ENTRIES的封装也并不那么聪明。 关于效率问题,恰好有个不错的文章 记下来,以后可以备考 FOR ALL ENTRIES vs DB2 JOIN http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912 All abap programers and most of the dba's that support abap programmers are familiar with t阅读全文

posted @ 2011-03-15 09:20 highmayor 阅读(62) 评论(0) 编辑

2011年2月24日

SAP学习笔记(HR Develepment学习笔记1)

摘要: SAP HR一般会有很多开发。而这个模块数据的特点也让它的开发和其它模块有些不同。HR的所有数据都是以信息类型来保存的,每个信息类型的数据都和时间段紧密相连。HR开发一般使用sap提供的Logic database pnp.用起来也非常简单。只需要在新建程序时,加上pnp。然后在程序里加上Tables: PERNR.需要用到哪些信息类型加上就可以了。 比如我需要用到个人数据(2)这个信息类型的数据。那么程序就这样写:view plaincopy to clipboardprint?TABLES:PERNR. INFOTYPES:0002. GETPERNR. PROVIDE*FROMP0001阅读全文

posted @ 2011-02-24 08:21 highmayor 阅读(106) 评论(0) 编辑

2011年1月10日

程序间的调用

摘要: 一,同步调用从一个程序同步调用其他的ABAP程序,有2种方式:1,调用程序被打断,当被调用程序执行完毕之后,调用程序继续执行。如:CALL FUNCTION <function>SUBMIT <program> AND RETURNCALL TRANSACTION <tcode>使用CALL FUNCTION ‘AAA’调用FM的时候,相应的FUNCTION GROUP被加载到调用程序所在的internal session。当FM执行完毕,接着执行调用程序。FUNCTION GROUP和其GLOBAL DATA会一直保存在这个internal session直到调用程序结束。当调用程序再次调用阅读全文

posted @ 2011-01-10 11:12 highmayor 阅读(29) 评论(0) 编辑

2010年12月31日

abap技术问题中文

摘要: 问题一:锁对象(Lock Object)和 FM(Function Module)激活锁定对象时,产生的 FM 的名字是什么?答案:首先要在 ABAP 字典中创建锁对象,然后才能在 ABAP 程序中设锁。创建锁对象时,系统会自动生成两个 FM 来进行锁管理。用于设锁的 FM 为: ENQUEUE_<锁对象名>。它用于在锁表(Lock Table)中生成一个锁项(Lock Entry)。若设锁不成功的话,就会在 Return 中反映出来。用于释放锁的 FM 为:DEQUEUE_<锁对象名>。它用于从锁表中删除一个锁项。在 ABAP 程序中,只需使用 "CALL FUNCITION ..." 语句阅读全文

posted @ 2010-12-31 11:54 highmayor 阅读(56) 评论(0) 编辑