星期五, 六月 25, 2010

(fixed)如何清空/删除 SAP MMC SYSLOG?


如何清空/删除 SAP MMC SYSLOG?

清空文件:usr\sap\<SID>\DVEBMGS00\log\SLOG00.LOG
使用Ultraedit 打开文件删除里面的所有内容保存空文件即可



如何清空/删除 SAP MMC SYSLOG?

如何清空/删除 SAP MMC SYSLOG?

清空文件:usr\sap\<SID>\DVEBMGS00\log\SLOG00.LOG

ABAP 动态定义select help

主要利用了,AT SELECTION-SCREEN ON  VALUE-REQUEST
编写自己的 trigger POV 事件.更加灵活

*&---------------------------------------------------------------------*
*& Report  Z_SEARCH_HELP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  Z_SEARCH_HELP NO STANDARD PAGE HEADING.

TABLES: pa0001.
parameters: ppernr type pa0001-pernr .

DATA: i_return TYPE ddshretval OCCURS WITH HEADER LINE,
      TYPE VALUE 'S'.

* Search Help for Ppernr-low
AT SELECTION-SCREEN ON  VALUE-REQUEST   for ppernr.
 message 'request value?' type 'I'.
  TYPES: BEGIN OF t_pernr,
    pernr LIKE pa0001-pernr,
    ename LIKE pa0001-ename,
  END OF t_pernr.

  DATA: it_pa0001 TYPE STANDARD TABLE OF t_pernr WITH HEADER LINE.

  SELECT pernr ename from pa0001
    INTO CORRESPONDING FIELDS OF TABLE it_pa0001
    where pa0001~endda = '99991231' .
*    WHERE zsdo~kunnr IN sokunnr.

  DELETE it_pa0001 WHERE pernr = '00000000'.
  SORT it_pa0001 BY pernr.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = 'PERNR'
      dynpprog    = sy-repid
      dynpnr      = sy-dynnr
      dynprofield = 'PERNR'
      value_org   = c
    TABLES
      value_tab   = it_pa0001
      return_tab  = i_return.

如何在用户登录时sap时自动执行一特定程序

sap提供了两种方法t.
1)SE37然后如图操作
使用函数 'NAVIGATION_SET_START_TCODE' ,用该函数可以设置用户和一个TCODE,该TCODE当用户登录sap系统后就可以自动执行。sap对应的程 序:ADMIN_SET_START_TRANSACTION_FO




2)使用用户出口(user Exit)
该用户出口的模块名称是:SUSR0001,你可以在该单元里增加你的代码进行相应的控制。.
SAP用户登录增强示例
* Transaction CMOD -> Utiliteis -> SAP Enhancements
* Exit Name SUSR0001
* Double click EXIT_SAPLSUSF_001
* Double click ZXUSRU01
* Insert -> include zsesschk.
** zsesschk limits the number of login sessions per user
* in a certain client
* It runs from user exit SUSR0001 after the SAP Login
* n-1 is the number of concurrent sessions allowed
TABLES: UINFO.
DATA: N TYPE I VALUE 2.              "Upper limit of login sessions
DATA: OPCODE TYPE X VALUE 2, I TYPE I, A(60).
DATA: BEGIN OF BDC_TAB1 OCCURS 5.
        INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDC_TAB1.
DATA: BEGIN OF USR_TABL OCCURS 10.
        INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
* Exclude Limit login by Users
IF  SY-UNAME <> 'XXX'
AND SY-UNAME <> 'XXX'.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
  ID 'TAB' FIELD USR_TABL-*SYS*.
LOOP AT USR_TABL.
  IF SY-UNAME = USR_TABL-BNAME AND SY-MANDT = USR_TABL-MANDT.
    I = I + 1.
  ENDIF.
ENDLOOP.
IF I >= N.
A = 'You have already '.
A+17(2) = I - 1.
A+19(25) = 'login sessions in client '.
A+44(4) = SY-MANDT.
  CALL FUNCTION 'POPUP_TO_INFORM'
       EXPORTING
            TITEL = 'UNSUCCESSFUL LOGIN'
            TXT1  = A
            TXT2  = 'You are not allowed to log in'.
  MOVE: 'SAPMSSY0' TO BDC_TAB1-PROGRAM,
          '120' TO BDC_TAB1-DYNPRO,
          'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/nex' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  CALL TRANSACTION 'SM04' USING BDC_TAB1 MODE 'N'.
ENDIF.
ENDIF.

星期一, 六月 14, 2010

Emacs Lisp 如何配置. macrs 文件 c-x -c-f

(add-to-list 'load-path "D:/slime-2010-06-13")
(setq inferior-lisp-program "d:\\sbcl\\1.0.37\\sbcl.exe")
(require 'slime)
(slime-setup)

(add-to-list 'load-path "D:\\color-theme-6.6.0")
(require 'color-theme)
(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)
     (color-theme-hober)))

星期六, 六月 12, 2010

Lisp 提示在read之后才出来

(defun ask-number ()
(format t "Please enter a number. ")
(let ((val (read)))
(if (numberp val)
val
(ask-number))))

(defvar val)
(setf val (ask-number))
(defparameter *s* (open "f:\\temp\\mytest.txt" :direction :output :if-does-not-exist :create :if-exists :append))
(format *s* "your input:~A~%" val)
(close *s*)

原因:
format 需要输出一个新行后,才会刷新,所以,加入~%

(format t "Please enter a number. ~%")

星期五, 六月 04, 2010

ABAP处理所有异常

语法,


TRY.

  ...                       " TRY block (application coding)

CATCH cx_... cx_... ...

    ...                     " CATCH block (exception handler)

CATCH cx_... cx_... ...

    ...                     " CATCH block (exception handler)

  ...

  CLEANUP.

    ...                     " CLEANUP block (cleanup context)

ENDTRY.

如果想处理所有异常,使用

catch cx_root.


  1. A TRY block, in which exceptions can occur.
    This exception block consists of all the statements between the TRY and the CATCH statement.
  2. One or more CATCH blocks for catching exceptions.
    These exception blocks are initiated with CATCH and ended with a further CATCH, CLEANUP, or ENDTRY.
  3. A CLEANUP block for cleanup work after the exceptions have been caught.
    This statement block is initiated by CLEANUP and ended with ENDTRY. A TRY-ENDTRY structure must not contain more than one CLEANUP block in precisely this position.

星期一, 五月 31, 2010

LISP CDR 和 CAR意思

(在第一台实作 Lisp 语言的机器上, CAR 与 CDR 指令分别表示"Contents of Address Register" 及"Contents of Decrement Register"。
而 cons 就是透过这两个缓存器而实作的。) Cons 很容易使用:

星期五, 五月 28, 2010

如何在Java Mail中是用Log4j来记录Java Mail Debug 信息?的

Java Mail 的debug信息非常丰富,包含了同服务器完整的协议过程,
但是这个debug是直接输出到System.out的,需要用 >>来截获。

不过Java Mail 提供了setDebugOut(PrintStream)的接口,
就用这个可以实现 Java Mail和 log4j的联合使用

首先编写一个PrintStream的类做一个Bridge 同  Log4j


package com.email;

import java.io.IOException;
import java.io.OutputStream;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.log4j.*;
/**
 *
 * @author U253MIS038
 */
public class LoggingOutputStream extends OutputStream
{

    protected boolean hasBeenClosed = false;

    protected byte[] buf;

    protected int count;

    private int bufLength;

    public static final int DEFAULT_BUFFER_LENGTH = 2048;

    protected Logger logger;

    protected Level level;

    private LoggingOutputStream()
    {

    }



    public LoggingOutputStream(Logger log, Level level)
            throws IllegalArgumentException {
        if (log == null) {
            throw new IllegalArgumentException("cat == null");
        }
        if (level == null) {
            throw new IllegalArgumentException("priority == null");
        }

        this.level = level;
        logger = log;
        bufLength = DEFAULT_BUFFER_LENGTH;
        buf = new byte[DEFAULT_BUFFER_LENGTH];
        count = 0;
    }



    public void close()
    {
        flush();
        hasBeenClosed = true;
    }



    public void write(final int b) throws IOException
    {
        if (hasBeenClosed) {
            throw new IOException("The stream has been closed.");
        }

        if (count == bufLength)
        {
            final int newBufLength = bufLength + DEFAULT_BUFFER_LENGTH;
            final byte[] newBuf = new byte[newBufLength];

            System.arraycopy(buf, 0, newBuf, 0, bufLength);

            buf = newBuf;
            bufLength = newBufLength;
        }

        buf[count] = (byte) b;
        count++;
    }



    public void flush()
    {
        if (count == 0)
        {
            return;
        }


        if (count == 1 && ((char) buf[0]) == '\n')
        {
            reset();
            return;
        }
        final byte[] theBytes = new byte[buf.length];
        System.arraycopy(buf, 0, theBytes, 0, count);
        logger.log(level, new String(theBytes));
        reset();
    }


    private void reset()
    {
             count = 0;
    }

}


2,然后再调用Java Mail中使用如下方法实现了定向

            static Logger log  = Logger.getLogger( email.class );
            Properties props = System.getProperties();
               
            config = new PropertiesConfiguration(PROP_FILE);
            String mailip = config.getString("EMAIL_SERVER_IP");       
            props.put("mail.smtp.host", mailip);

            Session session = Session.getInstance(props, null);
            session.setDebugOut(new PrintStream(new  LoggingOutputStream(Logger.getRootLogger(),Level.DEBUG), true));
                        session.setDebug(enableDebug);

星期一, 五月 24, 2010

java 如何确定一个对象是否数组?

Java array reflection: isArray vs. instanceof

那个方法好呢?

if(obj.getClass().isArray()) {}

and

if(obj instanceof Object[]) {}

In general, use the instanceof operator to test whether an object is an array.

At the JVM level, the instanceof operator translates to a specific "instanceof" byte code, which is highly optimized in most JVM implementations.

The reflective approach (getClass().isArray()) is compiled to two separate "invokevirtual" instructions. The more generic optimizations applied by the JVM to these may not be as fast as the hand-tuned optimizations inherent in the "instanceof" instruction.

There are two special cases: null references and references to primitive arrays.

A null reference will cause instanceof to result false, while the isArray throws a NullPointerException.

Applied to a primitive array, the instanceof results false, but the isArray returns true.

If obj is of type int[] say, then that will 
have an array Class but not be an instance of Object[].
So what do you want to do with obj. If you are going to
cast it, go with instanceof. If you are going to use

reflection, then use .getClass().isArray().

总结:
isArray的方位更加广泛。
instance Object[]不能确别int[]等数组。

所以,那个更好,要看自己的具体情况了





星期六, 五月 15, 2010

Lisp命名规则2

另外一个重要的习惯是全局变量的名字以*号开始和结束(*THREADS*);常量名字用+号开始和结尾(+PI+),
低级函数用%开始和技术(%SUM%).语言标准名字的定义只允许用字母(A-Z)和*,+,-,/,1,2,<,=,> &

self-evaluating:
自执行

最重要的两个自执行常量:T和NIL代表 true和false.
另一类最重要的自执行符号是关键词符号.其名字以:开始

最基本的程序组件:
函数,变量,及宏
function,variable,macro


星期五, 五月 14, 2010

Lisp的命名

在LISP程序中,名字比如FORMAT和hello-world及*db*用来代表一个对象称之为符号(symbols).读者对指定
的名字是否用在变量,函数或其它东西一无所知。.它只是按照字符序列读出并被代表一个对象的名字。
几乎所有的字符都可用在名字中.空白字符不行,因为在list中元素也是用空白字符来分割的.
数字也可以用在名字中的一部分而不是解释成一个数字.相似的,名字可以包含一个句号(.),但无法阅读
只包含一个句号的名字。10个字符用于其他目的而不能在名字中出现:


  1. 1.开始和结束括号() open and close parentheses
  2. 2.双引号和单引号 "' double and single quotes
  3. 3.反引号(`)backtick
  4. 4.逗号 comma,
  5. 5.冒号: colon
  6. 6.分号;semicolon
  7. 7.反斜线 \ backslash
  8. 8.竖线| vertical bar

星期一, 五月 10, 2010

Re: Lisp注释语句.

Lisp 注释规则二:

缩进规则:
    函数调用形式参数对齐
    宏和特殊形式针对最后一个左括号缩进两格
    ;;;; 文件级别注释
    ;;; 段落级别注释
    ;;  函数内部代码注释
    ;   函数内部代码单行注释,放在代码后面



2010/5/7 William Wang <javacave@gmail.com>
在阅读 Practical Common Lisp书的时候,突然想到LISP的注释符号应该是如何写呢?
google了下。
http://www.cc.gatech.edu/computing/classes/cs2360/ghall/style/com_mechanics.html

单句注释;分号表示 ;;;header
块注释 #|
 Notes:zh
  #

另外一种非常规的注释,是在代码中用“ ”来表示,比如下列代码

	(defun mumble_fcn ( arg1 arg2  ) 
"This function takes two arbitrary arguments and returns some
arbitrarily random result. NOTE: both arguments should be non-nil."
(do-random-thing (do-random-thing arg1 ) arg2 ))




星期五, 五月 07, 2010

SAP NetWeaver Composition Environment 7.2 Trial Version 安装 步骤 Create secure store 出现错误

SAP NetWeaver Composition Environment 7.2 Trial Version
首先下载了jdk 1.6.0_07之上的版本,我下载的是 1.6.0_20版本,并且下载了jce 6的文件,很小只有8K.
安装到步骤时候出现错误:
createsecurestore.JPG
安装 :18/29的时候,Create secure store
 
根据提示打开错误日志:
C:\Program Files\sapinst_instdir\NW72_DEV_ADA\SERVER\SecureStoreCreate.log
发现如下提示:

FATAL: Main class "com.sap.security.core.server.secstorefs.SecStoreFS" cannot be started:
  FATAL: java.lang.ExceptionInInitializerError
    at javax.crypto.Cipher.getInstance(DashoA13*..)
    at javax.crypto.Cipher.getInstance(DashoA13*..)
    at iaik.security.provider.IAIK.a(Unknown Source)
    at iaik.security.provider.IAIK.addAsJDK14Provider(Unknown Source)
    at iaik.security.provider.IAIK.addAsJDK14Provider(Unknown Source)
    at com.sap.security.core.server.secstorefs.Crypt.<clinit>(Crypt.java:85)
    at com.sap.security.core.server.secstorefs.SecStoreFS.setSID(SecStoreFS.java:177)
    at com.sap.security.core.server.secstorefs.SecStoreFS.handleCreate(SecStoreFS.java:838)
    at com.sap.security.core.server.secstorefs.SecStoreFS.main(SecStoreFS.java:1308)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sap.engine.offline.OfflineToolStart.main(OfflineToolStart.java:161)
Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
    at javax.crypto.SunJCE_b.<clinit>(DashoA13*..)
    ... 14 more
Caused by: java.lang.SecurityException: Cannot locate policy or framework files!
    at javax.crypto.SunJCE_b.i(DashoA13*..)
    at javax.crypto.SunJCE_b.g(DashoA13*..)
    at javax.crypto.SunJCE_b$1.run(DashoA13*..)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 15 more

  FATAL: com.sap.engine.offline.OfflineToolStart will abort now with exitcode 2

Solution:
copy
C:\Program Files\Java\jre6\lib\security 下所有文件到sap临时安装JVM目录下,
如果有提示是否需要覆盖,不要覆盖SAP原来的文件。
to
C:\Program Files\sapinst_instdir\NW72_DEV_ADA\SERVER\sapjvm\sapjvm_6\jre\lib\security


Lisp注释语句.

在阅读 Practical Common Lisp书的时候,突然想到LISP的注释符号应该是如何写呢?
google了下。
http://www.cc.gatech.edu/computing/classes/cs2360/ghall/style/com_mechanics.html

单句注释;分号表示 ;;;header
块注释 #|
 Notes:zh
  #

另外一种非常规的注释,是在代码中用“ ”来表示,比如下列代码

	(defun mumble_fcn ( arg1 arg2  ) 
"This function takes two arbitrary arguments and returns some
arbitrarily random result. NOTE: both arguments should be non-nil."
(do-random-thing (do-random-thing arg1 ) arg2 ))



星期二, 四月 20, 2010

数据库Auto time stamp字段

MYSQL 5.x支持:通过字段申明:
ts2 TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);

MSSQL:支持:
版本戳 timestamp 字段类型。

星期一, 四月 19, 2010

SAP相关 第一帖

2010.4.20日。

今天装好了Net Weaver 7.1 SR1
和 笔记本上ECC 6.0 EH4 FOR MSSQL 2005 WINDOW 7

准备全力投入SAP 了

星期二, 一月 26, 2010

jsp code too large for try statement

必杀技:
在JAVA_OPTS里加入以下变量:

1.java -Dcom.sun.tools.javac.main.largebranch=true

java lib\tools.jar 包内

注意,如果装有多个版本的JDK,需要通过设置JAVA_HOME来指明使用的JDK的路径
只是在path中加入是不够的。

星期三, 一月 06, 2010

Linux文件名包含特殊字符无法使用通配符:Argument list too long

Linux文件名包含特殊字符比如-,括弧()等等,grep "xxx" filename

会出现:Argument list too long错误

简单解决办法,同find 一起使用

find . -exec grep -l "搜索字符" "{}" \;

列出包含 “搜索字符”的文件名

星期二, 十二月 15, 2009

IE getElementById display

Could not get the display property. Invalid argument

使用obj.style.display='none'
出现错误:
Could not get the display property. Invalid argument

function hider() {
var label, control;

if(document.getElementById && (label = document.getElementById('hidden1'))
&& (control = document.getElementById('hidden2'))
&& label.style && control.style)
{
label.style.display = control.style.display
= ('none' == label.style.display) ? '' : 'none';
}