[go: up one dir, main page]

 
 
Sinco's profileSinco‘s SpacesPhotosBlogListsMore Tools Help
Blog

    August 31

    [ReportingService|XML]ReportingService 讀取XML

    <Query>
    <Method Namespace="http://tempuri.org" Name="Get_MB52_DATA_XML_01" >
    <Parameters>
           <Parameter Name="strMaterial_l">
               <DefaultValue>FEE1246</DefaultValue>
           </Parameter>
           <Parameter Name="strMaterial_h">
               <DefaultValue>FEE1246</DefaultValue>
           </Parameter>
           <Parameter Name="strPlant_l">
               <DefaultValue>3200</DefaultValue>
           </Parameter>
           <Parameter Name="strPlant_h">
               <DefaultValue>3200</DefaultValue>
           </Parameter>
           <Parameter Name="strSloc_l">
               <DefaultValue>6001</DefaultValue>
           </Parameter>
           <Parameter Name="strSloc_h">
               <DefaultValue>6001</DefaultValue>
           </Parameter>
       </Parameters>
    </Method>
    <SoapAction>http://tempuri.org/Get_MB52_DATA_XML_01</SoapAction>

    </Query>

    [CMD]Check SAP Process

    @echo off
    tasklist |find /i "saplogon.exe" >check_sap.txt
    IF errorlevel 1 ((del /q check_sap.txt)&(echo SAP未執行,準備開啟中...)&(goto end))
    IF errorlevel 0 ((del /q check_sap.txt)&(echo SAP已經執行,請不要重復執行)&pause&exit)
    :end
    "C:\Program Files\SAP\SapSetup\setup\SAL\SapLogon.s8l"

    August 30

    [CMD]Tasklist

    set /p n=firefox set /p t=1 set /a t1=%t%*60 :do tasklist|find /i "%n%" &&goto loop||start "" "d:\a.txt" goto end :loop ping 127.1 -n %t1% >nul goto do :end
    July 27

    IP Test[有线通 网速测试]

    Download Speed: 827 kbps (103.4 KB/sec transfer rate)
    Upload Speed: 27 kbps (3.4 KB/sec transfer rate)
    2009年7月24日 21:08:06

    Download Speed: 766 kbps (95.8 KB/sec transfer rate)
    Upload Speed: 29 kbps (3.6 KB/sec transfer rate)
    2009年7月24日 21:10:40

    Download Speed: 635 kbps (79.4 KB/sec transfer rate)
    Upload Speed: 18 kbps (2.3 KB/sec transfer rate)
    2009年7月24日 21:12:51

    Download Speed: 242 kbps (30.3 KB/sec transfer rate)
    Upload Speed: 129 kbps (16.1 KB/sec transfer rate)
    2009年7月24日 23:15:43

    Download Speed: 301 kbps (37.6 KB/sec transfer rate)
    Upload Speed: 144 kbps (18 KB/sec transfer rate)
    2009年7月24日 23:17:58

    Download Speed: 611 kbps (76.4 KB/sec transfer rate)
    Upload Speed: 242 kbps (30.3 KB/sec transfer rate)
    2009年7月25日 1:04:08

    Download Speed: 9615 kbps (1201.9 KB/sec transfer rate)
    Upload Speed: 448 kbps (56 KB/sec transfer rate)
    2009年7月25日 8:39:35

    Download Speed: 686 kbps (85.8 KB/sec transfer rate)
    Upload Speed: 419 kbps (52.4 KB/sec transfer rate)
    2009年7月25日 8:43:12

    Download Speed: 728 kbps (91 KB/sec transfer rate)
    Upload Speed: 421 kbps (52.6 KB/sec transfer rate)
    2009年7月25日 8:43:54

    Download Speed: 614 kbps (76.8 KB/sec transfer rate)
    Upload Speed: 249 kbps (31.1 KB/sec transfer rate)
    2009年7月25日 8:45:26

    Download Speed: 695 kbps (86.9 KB/sec transfer rate)
    Upload Speed: 266 kbps (33.3 KB/sec transfer rate)
    2009年7月25日 8:46:19

    Download Speed: 1665 kbps (208.1 KB/sec transfer rate)
    Upload Speed: 315 kbps (39.4 KB/sec transfer rate)
    2009年7月26日 23:56:20

    Download Speed: 397 kbps (49.6 KB/sec transfer rate)
    Upload Speed: 163 kbps (20.4 KB/sec transfer rate)
    2009年7月26日 23:57:41

    Ethernet adapter 本地连接:

            Connection-specific DNS Suffix  . :
            Description . . . . . . . . . . . : Broadcom NetLink (TM) Fast Ethernet
            Physical Address. . . . . . . . . : 00-1B-38-04-D1-AB
            Dhcp Enabled. . . . . . . . . . . : Yes
            Autoconfiguration Enabled . . . . : Yes
            IP Address. . . . . . . . . . . . : 10.33.48.96
            Subnet Mask . . . . . . . . . . . : 255.255.248.0
            Default Gateway . . . . . . . . . : 10.33.48.1
            DHCP Server . . . . . . . . . . . : 172.18.12.58
            DNS Servers . . . . . . . . . . . : 211.103.13.101
                                                211.138.200.69
            Lease Obtained. . . . . . . . . . : 2009年7月24日 21:02:09
            Lease Expires . . . . . . . . . . : 2009年7月25日 20:52:55

    June 14

    [SAP|ABAP 优化【引用】

    1. loop 循环中不要用select.

    2. 用inner join时,不要超过3到4个表 用head表 join detail表

    3. 数据量大的时候用index,或是视图。

    4. select时,where后面的条件多点,3到4个以上。

    5. 一般都是先保存到内表,然后操作内表

    1、使用where语句

    2、使用聚合函数

    不推荐

    Maxnu = 0.

    Select * from zflight where airln = ‘LF’ and cntry = ‘IN’.

    Check zflight-fligh > maxnu.

    Maxnu = zflight-fligh.

    Endselect.

    推荐

    Select max( fligh ) from zflight into maxnu where airln = ‘LF’ and cntry = ‘IN’.

    3、使用视图代替基本表查询

    不推荐

    Select * from zcntry where cntry like ‘IN%’.

    Select single * from zflight where cntry = zcntry-cntry and airln = ‘LF’.

    Endselect.

    推荐

    Select * from zcnfl where cntry like ‘IN%’ and airln = ‘LF’.

    Endselect.

    4、使用INTO table 代替select endselect

    不推荐

    Refresh: int_fligh.

    Select * from zflight into int_fligh.

    Append int_fligh. Clear int_fligh.

    Endselect.

    推荐

    Refresh: int_fligh.

    Select * from zflight into table int_fligh.

    5、使用批量修改内表代替逐行修改

    不推荐

    Loop at int_fligh.

    If int_fligh-flag is initial.

    Int_fligh-flag = ‘X’.

    Endif.

    Modify int_fligh.

    Endloop.

    推荐

    Int_fligh-flag = ‘X’.

    Modify int_fligh transporting flag where flag is initial.

    6、使用二分法查询,提高查询内表数据速度

    不推荐

    Read table int_fligh with key airln = ‘LF’.

    推荐

    Read table int_fligh with key airln = ‘LF’ binary search.

    7、两个内表添加使用批量增加代替逐行

    不推荐

    Loop at int_fligh1.

    Append int_fligh1 to int_fligh2.

    Endloop.

    推荐

    Append lines of int_fligh1 to int_fligh2.

    8、使用table buffering

    Use of buffered tables is recommended to improve the performance considerably. The buffer is bypassed while using the following statements

    Select distinct

    Select … for update

    Order by, group by, having clause

    Joins

    Use the Bypass buffer addition to the select clause in order to explicitly bypass the buffer while selecting the data.

    9、 使用FOR ALL Entries

    不推荐

    Loop at int_cntry.

    Select single * from zfligh into int_fligh

    where cntry = int_cntry-cntry.

    Append int_fligh.

    Endloop.

    推荐

    Select * from zfligh appending table int_fligh

    For all entries in int_cntry

    Where cntry = int_cntry-cntry.

    10、正确地使用where语句,使查询能使用索引

    When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index

    To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields. One more tip is that if a table begins with MANDT, while an index does not, there is a high possibility that the optimizer might not use that index.

    11、正确地使用MOVE语句

    Instead of using the move-corresponding clause it is advisable to use the move statement instead. Attempt should be made to move entire internal table headers in a single shot, rather than moving the fields one by one.

    12、正确地使用inner join

    Let us take an example of 2 tables, zairln and zflight. The table zairln has the field airln, which is the airline code and the field lnnam, which is the name of the airline. The table zflight has the field airln, the airline code and other fields which hold the details of the flights that an airline operates.

    Since these 2 tables a re logically joined by the airln field, it is advisable to use the inner join.

    Select a~airln a~lnnam b~fligh b~cntry into table int_airdet

    From zairln as a inner join zflight as b on a~airln = b~airln.

    In order to restrict the data as per the selection criteria, a where clause can be added to the above inner join.

    13、使用sort by 代替order by

    15、使用select 字段列表代替 Select *

    不推荐

    SELECT * FROM DD01L INTO DD01L_WA

    WHERE DOMNAME LIKE ‘CHAR%’

    AND AS4LOCAL = ‘A’.

    ENDSELECT.

    推荐

    SELECT DOMNAME FROM DD01L

    INTO DD01L_WA-DOMNAME

    WHERE DOMNAME LIKE ‘CHAR%’

    AND AS4LOCAL = ‘A’.

    ENDSELECT.

    16、使用subquery代替多个select语句

    不推荐

    SELECT * FROM SPFLI

    INTO TABLE T_SPFLI

    WHERE CITYFROM = ‘FRANKFURT’

    AND CITYTO = ‘NEW YORK’.

    SELECT * FROM SFLIGHT AS F

    INTO SFLIGHT_WA

    FOR ALL ENTRIES IN T_SPFLI

    WHERE SEATSOCC < F~SEATSMAX

    AND CARRID = T_SPFLI-CARRID

    AND CONNID = T_SPFLI-CONNID

    AND FLDATE BETWEEN ‘19990101′ AND ‘19990331′.

    ENDSELECT.

    推荐

    SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA

    WHERE SEATSOCC < F~SEATSMAX

    AND EXISTS ( SELECT * FROM SPFLI

    WHERE CARRID = F~CARRID

    AND CONNID = F~CONNID

    AND CITYFROM = ‘FRANKFURT’

    AND CITYTO = ‘NEW YORK’ )

    AND FLDATE BETWEEN ‘19990101′ AND ‘19990331′.

    ENDSELECT.

    17、如何快速删除重复内表的记录

    不推荐

    READ TABLE ITAB INDEX 1 INTO PREV_LINE.

    LOOP AT ITAB FROM 2 INTO WA.

    IF WA = PREV_LINE.

    DELETE ITAB.

    ELSE.

    PREV_LINE = WA.

    ENDIF.

    ENDLOOP.

    推荐

    DELETE ADJACENT DUPLICATES FROM ITAB

    COMPARING K.

    18、如何快速删除内表一定范围内的记录

    不推荐

    DO 101 TIMES.

    DELETE ITAB INDEX 450.

    ENDDO.

    推荐

    DELETE ITAB FROM 450 TO 550.

    19、使用collect语句代替人工合计计算结果

    不推荐

    LOOP AT ITAB1 INTO WA1.

    READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.

    IF SY-SUBRC = 0.

    ADD: WA1-VAL1 TO WA2-VAL1,

    WA1-VAL2 TO WA2-VAL2.

    MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.

    ELSE.

    INSERT WA1 INTO ITAB2 INDEX SY-TABIX.

    ENDIF.

    ENDLOOP.

    推荐

    LOOP AT ITAB1 INTO WA.

    COLLECT WA INTO ITAB2.

    ENDLOOP.

    SORT ITAB2 BY K.

    20、使用显示的work area 代替默认的work area

    不推荐

    ITAB = WA.

    APPEND ITAB.

    推荐

    APPEND WA TO ITAB.

    21、使用LOOP …ASSIGNING代替loop … modify.

    不推荐(整条记录更新)

    LOOP AT ITAB INTO WA.

    I = SY-TABIX MOD 2.

    IF I = 0.

    WA-FLAG = ‘X’.

    MODIFY ITAB FROM WA.

    ENDIF.

    ENDLOOP.

    推荐(只会更新需要修改内容)

    LOOP AT ITAB ASSIGNING .

    I = SY-TABIX MOD 2.

    IF I = 0.

    -FLAG = ‘X’.

    ENDIF.

    ENDLOOP.

    March 22

    SOX

      《萨班斯法案》(Sarbanes-Oxley Act,简称SOX法案)

      SOX法案规定:

      ●禁止向本公司董事或高管人员提供私人贷款;

      ●公司高管、董事或者受益权人10%的股权变动必须在两个营业日内披露;

      ●在养老金计划管制期内,公司的董事和高层管理人员不能直接或间接交易持有的该公司股票或从中获益的其他行为;

      ●对于有违反证券法规情节的有关人士,美国证监会可以禁止他们担任公司的管理人员或者董事等。

      再建立上市公司高管人员责任追究机制

      1.明确CEO/CFO的会计责任

      SOX法案要求在上市公司公开披露的信息中,须附有首席执行官(CEO)和首席财务主管(CFO)的承诺函,保证所提交的定期信息披露报告的真实性。此前,美国的上市公司定期信息披露并不需要CEO/CFO签字,因此一旦其上市公司的财务丑闻被揭发,其CEO/CFO往往以自己不知情来开脱个人的法律责任;由于专业性强,程序复杂,一般也很难找到直接证据来证明CEO/CFO明知或故意披露虚假财务信息。结果,美国无罪推定的司法原则使监管部门经常无计可施。

      SOX法案规定:

      ●上市公司所有定期报告(包括公司依照1934年证券交易法规定编制的会计报表)应附有公司首席执行官与首席财务官签署的承诺函;

      ●承诺函中的内容包括:确保本公司定期报告所含会计报表及信息披露的适当性,并且保证此会计报表及信息披露在所有重大方面都公正地反映了公司的经营成果及财务状况。

      这样一来,监管者即使找不到或者不再需要寻找财务欺诈的直接证据,也可以要求其CEO/CFO本人承担法律责任。

      2.要求公司CEO/CFO本人承担不当行为的法律责任

      此前,在那些造成重大危害的上市公司财务欺诈事件中,公司CEO/CFO本人仅面临个人职业声誉下降(Reputation Risk)的威胁;即使监管者对其采取种种处罚措施,这些惩罚可能也会以各种方式转嫁给上市公司负担,却难以对CEO/CFO本人形成有效威慑。

      SOX法案此次直接明确了公司CEO/CFO本人面临的法律责任,为监管机构查处财务欺诈提供了强有力的法律武器,弥补了监管体系上的漏洞,使公司的激励机制与责任追究机制达成某种平衡。

      SOX法案规定:

      ●在公司定期报告中若发现因实质性违反监管法规而被要求重编会计报表时,公司的CEO/CFO应当返还给公司12个月内从公司收到的所有奖金、红利,其他形式的激励性报酬以及买卖本公司股票所得收益;

      ●如果公司CEO/CFO事先知道违规事项,但仍提交承诺函,最多可以判处10年监禁,以及100万美元的罚款;

      ●对于故意做出虚假承诺的,最多可以被监禁20年并判处500万美元的罚款。

      强化内外制衡

      安然事件的引爆,并非始于监管机构的稽查行动,而是市场投资机构(主要是对冲基金等)对安然公司的信息披露产生怀疑,即向公司管理层提出一连串的问题要求予以澄清,并大量抛空安然股票所致。因此可以说,提高信息披露义务、加强信息披露,是各国对上市公司进行监管的基本手段。

      但是一般而言,如何使投资者获得全面、准确、有用的信息以便作出正确的投资决策,并形成对上市公司的监管,还是一个难题。尽管在上市公司信息披露的有关制度方面,美国走在世界前沿,但是SOX法案依然提出了更高的要求,似乎有点矫枉必须过正的味道。

      SOX法案规定:

      ●进一步缩短财务报告披露的滞后期,提高及时性。其中,未来3年内,年度报告由90天缩短为60天;季度报告由45天缩短为35天。年报及季报都需要注册会计师的审计。

      ●强化上市公司内控及报告制度,要求公司年度报告中提供“内部控制报告”,说明公司内部控制制度及其实施的有效性,“内部控制报告”要出具注册会计师的意见;

      ●提高对公司信息披露可用性的要求,包括定期报告中披露所有的资产负债表外交易、财务状况的预测性信息、高层财务人员的道德守则、所有由注册会计师出具的实质性的纠正调整、临时报告中公司财务状况或财务经营状况的实质性变化等。

      加强内部独立监督能力

      与我国上市公司不同,美国上市公司内部设有审计委员会,但不设立监事会。审计委员会的职责是监督该公司的会计及财务报告程序,以及审计该公司的财务报告。2002年上市公司系列财务丑闻表明,公司的审计委员会没有发挥应有的作用,甚至形同虚设。

      SOX法案规定:

      ●为保证独立性,审计委员会必须完全由“独立董事”组成,独立董事不得是公司或者其子公司的关联人士,其中至少一人应是财务专家;独立董事不得从公司中接受任何咨询、顾问费或者其他酬金;

      ●公司聘用会计师事务所及报酬方式要由审计委员会批准,并接受审计委员会的监督;会计师事务所在审计过程中遇到的重大事项必须及时报告审计委员会;

      ●为保证审计委员会能够及时发现公司的会计和审计问题,还需要建立一套处理举报或投诉的工作程序以及相应的监测系统、反应机制。

      SOX法案所提出的措施,是否能确保对会计、审计及公司高官人员的监督,还需要实践检验。但是会计审计本身的专业性较强,即使由审计委员会进行监督,还是能够给注册会计师留有一定的操作空间。

      杜绝注册会计师利益瓜葛

      美国上市公司的连锁会计丑闻,已使有关会计师事务所深陷其中。然而,负有审计责任的会计师事务所不但没有履行职责,五大会计师事务所之一的安达信甚至为虎作伥,帮助安然销毁证据。

      实际上,美国证监会在很早以前就注意到并着手开始纠正会计师事务所与被审计公司之间存在的利益瓜葛问题。例如:若一个事务所长期服务于同一客户,就有可能和客户发生复杂的利害关系,它们会在进行审计业务的同时,再提供企业咨询等非审计业务。而非审计业务的收益,很可能会超过审计业务等。

      前任美国证监会主席阿瑟·莱维特曾经力主:所有会计师事务所的审计业务与咨询业务必须分拆。但此建议曾遭到五大会计师事务所的抵制。对此,SOX法案授予美国证监会一柄尚方宝剑,严格限制会计师事务所那些可能产生利益冲突的做法。

      SOX法案规定:

      ●禁止会计师事务所在进行审计业务的同时提供非审计业务。其中,明确列举了8类不适当业务被禁止,并授权美国证监会的会计监督委员会可以根据情况对其他类业务作出禁止规定。

      ●强制实行注册会计师定期轮换制。规定会计师事务所的主审会计师,或者复核审计项目的会计师,为同一公司连续提供审计服务不得超过5年。

      ●限制注册会计师去被审公司任职。公司的现任CEO/CFO等高管人员,若在一年内曾经受雇于会计师事务所并参与该公司有关的审计工作,则该事务所不得再担任该公司的审计工作。

      ●实行会计师事务所注册备案制度。从事上市公司审计业务的会计师事务所,必须在会计监督委员会进行注册,并且要定期更新注册信息。

      ●针对安达信销毁审计档案的问题,SOX法案还规定:注册会计师有保管审计工作底稿的责任。要求会计师事务所审计上市公司的工作底稿至少保存7年。

      由于此项措施的强制性,到目前为止,五大会计师事务所已经基本完成审计和咨询业务的分拆。例如毕马威的咨询业务分拆为毕博咨询;普华永道的咨询业务分拆后被IBM收购;因为分拆较早,从安达信分拆出来的埃森哲咨询得以从安然事件中幸免。

      会计师行业由自律改为监管

      以往,美国注册会计师行业的监管与服务职能都集中在美国注册会计师协会(AICPA)。然而,证券市场的系列会计丑闻,已使注册会计师行业自律的有效性遭到空前质疑。

      实际上,美国注册会计师协会是依靠会员会费的资助在维持运作,所以少数大型会计师事务所对协会的影响很大,使协会不可避免地会自发维护注册会计师的利益。因此,仅依靠协会自律,很难杜绝丑闻再度发生。

      SOX法案规定:

      ●要求美国证券交易委员会(SEC)成立上市公司会计监督委员会(PCAOB),而原来由AICPA行使的对注册会计师行业的监管职能,则交给更具公共职能的PCAOB。

      ●PCAOB由五人组成,直接归美国证监会管辖,但不属于其内部雇员。为消除注册会计师事务所对其的影响,该委员会的运行经费不再由会计师事务所承担,而是改为由上市公司分担;

      ●美国证监会授权该委员会制定审计准则、会计师事务所注册权、日常监督权、调查和处罚权;检查和处理上市公司与会计师之间的会计处理分歧。

      尽管此前在《1934年证券交易法》中已明确:制定上市公司会计准则的权限属于美国证监会。但是,由于政府机构的效率、经费、专业人才等方面的不足,更由于对行业自律的有效性存在幻想,美国证监会一度将会计准则的制定权代理给了民间自律机构。 SOX法案要求美国证监会对这个问题进行纠正,并向国会报告有关情况。

      确保证券分析师的客观性和独立性

      美国证券市场系列会计丑闻中,除了注册会计师外,证券公司在其中也扮演了不光彩的角色。尤其证券公司内部投资银行部门和证券分析师相互勾结,发布虚假分析报告,操纵市场价格,误导投资者。此类情况被揭发后,证券公司面临大量的法律诉讼和监管部门的处罚。

      SOX法案规定:

      ●要求美国证监会SEC制定相关的规定和细则,以避免证券分析师在其研究报告或公开场合向投资者推荐股票时“见利忘义”,以提高研究报告的客观性,向投资者提供更为有用和可靠的信息。规定的内容包括:禁止公开发布由经纪人和交易商雇佣的从事投资银行业务的人员所提供的研究报告,以及非直接从事投资研究的人员提供的研究报告;由经纪人和交易商雇佣的非从事投资银行业务的官员负责对证券分析师的监管和评价;要求经纪人和交易商,以及他们雇佣从事投资银行业务的人员,不得因证券分析师对发行人证券提出了不利的或相反的研究结论,并因该结论影响到经纪人、交易商同发行人的关系而对证券分析师进行报复和威胁;

      ●规定一定期限内担任或即将担任公开发行股票承销商或坐市商(dealers)的经纪人和交易商不得公开发布关于该股票或发行人的研究报告;

      ●在执业的经纪人和交易商内部建立制度架构体系,将证券分析师划分为复核、强制(pressure)、监察等不同的工作部门,以避免参与投资银行业务的人员存有潜在的偏见;

      ●要求证券分析师、经纪人和交易商在研究报告公布的同时,披露已知的和应当知晓的利益冲突事项。

      SOX法案还注意到纠正各种干扰证券分析人员独立性的问题,例如来自公司内部投资银行部门的威胁利诱等。

      加强刑事处罚

      由于上市公司会计丑闻给投资者造成极大损失,人们迫切要求将犯罪分子绳之以法。因此,除了对CEO/CFO的处罚规定外,SOX法案中还制定了严厉处罚证券犯罪的法规。

      SOX法案规定:

      ●任何人通过信息欺诈或价格操纵在证券市场获取利益,最多可监禁25年或处以罚款;对违法的注册会计师可被判处10年以下监禁或罚款;

      ●延长了对证券欺诈的追诉期,起诉时间可以延长至非法行为发现的两年内,或者非法行为实施后的五年内;

      ●新的规定将保护公司检举揭发的员工,对举报者进行打击报复的,最高可判处10年监禁,还规定了对举报者的具体的补偿措施,比如恢复职务、补发报酬及其他损失等。

      SOX法案是匆忙出台的产物,这与美国特定的政治背景有关。

      从目前情况看,SOX法案提出的措施,对于稳定美国股市起到了一定作用。但要使投资者全面恢复信心,解决证券市场深层次的问题,还需要一定的时间,也并非制定几条法律法规那么简单。

      SOX法案即《萨班斯-奥克斯莱法案》

      又称《2002年公众公司会计改革和投资者保护法》。美国国会为纠正2001年安然事件后爆发的连串上市公司会计丑闻,恢复投资者对股票市场的信心,推出此亡羊补牢之举。该法案于2002年7月由美国总统布什签署发布。

      SOX法案主要针对公司财务丑闻中揭露出来的问题,修补完善了《1933年证券法》和《1934年证券交易法》的有关章节。

    传说世上最准的测试题

     

    测试结果:

    长颈鹿 
    知性优雅,默默等待爱情 
    长颈鹿是位冷静的思考者,这类型的人知性而优雅,喜欢研究问题,为人成熟稳 
    重,进退自如,绝不会做出令人大跌眼镜的事情来,人缘不错,大家都很喜欢你,不 
    管遇到什么状况,你都能冷静处理,但也因为在一些小地方上过於保守,可能会白白 
    错失不少机会,当机会降临时可要抓牢哦! 
    【如何排除人际烦恼】 
    你从不会拒绝别人的请求,不管身边的朋友拜托你做什么,你都欣然接受,这样一 
    来,很容易把自己累坏哦!别人喜欢依赖你,而你却找不到可以依赖的人,你必须向 
    别人请求支援才能为自己减压。 
    【对异性的态度】 
    你很少主见主动追求别人,你好像一直在默默等待有缘人的出现哦!过於温吞的个性 
    是你恋爱路上的绊脚石,你必须积极行动起来才能牢牢抓住手中的红线。 
    【职业预测】 
    你的理性和知性,适合做心理谘询师、访谈专员、顾问等。 

    March 16

    [JAVA]检查Windows进程是否存在,不存在则启动

    import java.io.*;

    public class taskkill {

        /**
         * @param args
         */
        public static void main(String[] args) throws IOException {

            // TODO Auto-generated method stub
            //String exeStr = "C:/windows/system32/cmd.exe tasklist";
            String exeStr = "tasklist";
            String exeStrArthurserver = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
            //String exeStrArthurserver = "E:\\ArthurServer.exe";
            Runtime r = Runtime.getRuntime();
            // 通过Java虚拟机启动进程,即父进程启动子进程
            // 由于是父进程所以可以得到其子进程的输出流。
            Process p = r.exec(exeStr);
            // 获得该进程的输入流
            InputStream is = p.getInputStream();
            BufferedReader in = new BufferedReader(new InputStreamReader(is));

            String line =  null;
             boolean isExist = false;
            // 读取数据
            // 如果程序不关闭将一直“等待”read结果
            while ((line=in.readLine())!=null)
            {
            //System.out.println(line);
            if(line.indexOf("firefox.exe")!=-1)
            {
                System.out.println("Exist Firefox");
                isExist = true;
                //r.exec(exeStrArthurserver);
                break;
            }
            }
            in.close();
            is.close();
            if(isExist==false)
            {
                r.exec(exeStrArthurserver);
                //Mail
                //Mail
            }
        }
        }

    March 15

    [ubuntu|Linux]Ubuntu常用命令

    【安装】
    查看软件xxx安装内容
    dpkg -L xxx
    查找软件
    apt-cache search 正则表达式
    查找文件属于哪个包
    dpkg -S filename
    apt-file search filename
    查询软件xxx依赖哪些包
    apt-cache depends xxx
    查询软件xxx被哪些包依赖
    apt-cache rdepends xxx
    增加一个光盘源
    sudo apt-cdrom add
    系统升级
    sudo apt-get update
    sudo apt-get dist-upgrade
    清除所以删除包的残余配置文件
    dpkg -l |grep ^rc|awk ‘{print $2}’ |tr [”n”] [” “]|sudo xargs dpkg -P -
    编译时缺少h文件的自动处理
    sudo auto-apt run ./configure
    查看安装软件时下载包的临时存放目录
    ls /var/cache/apt/archives


    【系统】
    查看内核
    uname -a
    查看Ubuntu版本
    cat /etc/issue
    查看内核加载的模块
    lsmod
    查看PCI设备
    lspci
    查看USB设备
    lsusb
    查看网卡状态
    sudo ethtool eth0
    查看CPU信息
    cat /proc/cpuinfo
    显示当前硬件信息
    lshw


    【硬盘】
    查看硬盘的分区
    sudo fdisk -l
    查看硬盘剩余空间
    df -h
    df -H
    查看目录占用空间
    du -hs 目录名
    优盘没法卸载
    sync
    fuser -km /media/usbdisk

    【内存】
    查看当前的内存使用情况
    free -l

    【进程】
    查看当前有哪些进程
    ps -A
    中止一个进程
    kill 进程号(就是ps -A中的第一列的数字)
    或者 killall 进程名
    强制中止一个进程(在上面进程中止不成功的时候使用)
    kill -9 进程号
    或者 killall -9 进程名
    查看当前进程的实时状况
    top
    查看进程打开的文件
    lsof -p

    【ADSL】
    配置 ADSL
    sudo pppoeconf
    ADSL手工拨号
    sudo pon dsl-provider
    激活 ADSL
    sudo /etc/ppp/pppoe_on_boot
    断开 ADSL
    sudo poff
    查看拨号日志
    sudo plog

    【网络】
    根据IP查网卡地址
    arping IP地址
    查看当前IP地址
    sudo ifconfig eth0 |awk ‘/inet addr/ {split($2,x,”:”);print x[2]}’
    查看当前外网的IP地址
    w3m -no-cookie -dump www.ip138.com|grep -o ‘[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}’
    w3m -no-cookie -dump ip.loveroot.com|grep -o ‘[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}’
    查看当前监听80端口的程序
    lsof -i :80
    查看当前网卡的物理地址
    sudo arp -a | awk ‘{print $4}’
    sudo ifconfig eth0 | head -1 | awk ‘{print $5}’
    立即让网络支持nat
    sudo echo 1 &gt; /proc/sys/net/ipv4/ip_forward
    sudo iptables -t nat -I POSTROUTING -j MASQUERADE
    查看路由信息
    netstat -rn
    sudo route -n

    手工增加删除一条路由
    sudo route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
    sudo route del -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
    修改网卡MAC地址的方法
    sudo ifconfig eth0 down #关闭网卡
    sudo ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE #然后改地址
    sudo ifconfig eth0 up #然后启动网卡 【服务】
    添加一个服务
    sudo update-rc.d 服务名 defaults 99
    删除一个服务
    sudo update-rc.d 服务名 remove
    临时重启一个服务
    /etc/init.d/服务名 restart
    临时关闭一个服务
    /etc/init.d/服务名 stop
    临时启动一个服务
    /etc/init.d/服务名 start

    [ubuntu|Linux]Ubuntu常用软件安装集合



    以下介绍的是Ubuntu的常用软件和他们的安装方法。
    在安装之前请先更新源,具体请看:
    http://www.oshead.com/ubuntu/?action=show&id=4

    首先介绍两个命令: sudo 和 su
    sudo意思就是super-user do,让当前用户暂时以管理员的身份root来执行这条命令。
    su是用来改变当前用户的,su root,就是将当前用户切换为root,用了su root之后,下面所有的命令就可以不用打sudo了,因为当前用户已经是管理员root了。

    常用工具:
    scim
    很好的输入法,有着和微软拼音输入法差不多的输入方式,联想功能很强大。
    sudo apt-get install scim scim-modules-socket scim-modules-table scim-pinyin scim-tables-zh
    sudo sh -c " echo 'export XMODIFIERS=@im=SCIM ; export GTK_IM_MODULE="scim" ; export QT_IM_MODULE="scim" ; scim -d ' > /etc/X11/Xsession.d/95xinput "
    sudo chmod 755 /etc/X11/Xsession.d/95xinput

    comix
    Ubuntu下看漫画的软件,可以不用解压压缩包直接观看,和Windows中的ComicViewer的极佳替代品,只是打开很大的压缩包时,速度稍慢一点。
    apt-get install comix

    kiba-dock
    桌面dock工具,可以把常用的软件放在里面,最大的特色是支持物理效果,即可以将里面所有的物体扔来扔去,弹来弹去,很有趣。
    sudo apt-get install kiba-dock

    Avant Window Navigator
    Avant Window Navigator是一个Ubuntu下仿苹果风格的Dock,个人比较喜欢,虽然没有像kiba-dock那种可以做物理运动扔来扔去的功能,但是他里 面有着跳动、缩放、闪光、翻转等9种不同的效果,而且还可以把这9种效果任意组合,所以用起来还是非常舒服的。
    http://www.oshead.com/ubuntu/?action=show&id=9

    alien
    非常强大的工具,可以把rpm包转换为deb包,相信很多人都很需要这个功能。
    sudo apt-get install alien
    用法: sudo alien rpmfile.rpm

    ghex
    非常好用的16进制编辑工具,可以直接修改可执行文件。
    sudo apt-get install ghex

    聊天工具:
    LumaQQ
    Linux下的QQ聊天软件,最新版是2006 M2,虽然已经停止了开发,但是界面和QQ已经基本差不多,并且仍然能完成大部分的功能。
    http://www.oshead.com/ubuntu/?action=show&id=6

    视频音频:
    gstreamer
    安装后,Ubuntu即可播放mp3
    sudo apt-get install gstreamer0.10-*

    xine
    安装完后movie player即可播放rmvb等几乎所有格式的视频
    sudo apt-get remove totem-gstreamer
    sudo apt-get install totem-xine libxine1-ffmpeg libxine1-gnome libxine1-plugins libxine1 libstdc++5
    sudo apt-get install w32codecs

    Listen
    还在想Gnome下用什么音频播放器么,还在羡慕KDE下的Amarok么?用Listen吧,比Amarok都爽,让KDE来羡慕GNOME吧。
    sudo apt-get install listen

    网络工具:
    aMule
    Ubuntu下的Emule,速度甚至比Emule更快,而且不限制关键字哦(不纯洁的人们,这个作用就不用我解释了吧)
    sudo apt-get install amule

    WireShark
    Linux下用的最广泛的网络分析工具,功能非常强大,报文分析非常透彻,比Windows下的Etherpeek更加好用,只是没有报文统计功能。
    sudo apt-get install wireshark

    开发工具:
    jdk 6
    Java Develop Kit,用Java编写的程序都需要他的支持,里面包括了jre,所以不用另外去下jre了。
    sudo apt-get install sun-java6-jdk
    sudo update-alternatives --config java
    执行之后会出现如下画面
    There are 2 alternatives which provide `java'.

      Selection    Alternative
    -----------------------------------------------
              1    /usr/bin/gij-4.2
    *+        2    /usr/lib/jvm/java-6-sun/jre/bin/java

    Press enter to keep the default[*], or type selection number:
    输入你现在正在新装的java-6-sun的序号,如上,我的是2,回车。

    eclipse
    http://www.oshead.com/ubuntu/?action=show&id=7

    bluefish editor
    非常好用的网页编辑工具,里面提供了很多辅助Tag来添加代码,想我这种记忆力不好的人有救了。
    apt-get install bluefish

    devhelp
    一个像Windows中MSDN的帮助文档,只要下载对应的dev帮助文件,就可以在里面进行查找,很好用,开发必备工具。
    apt-get install devhelp Ubuntu常用软件安装集合

    以下介绍的是Ubuntu的常用软件和他们的安装方法。
    在安装之前请先更新源,具体请看:
    http://www.oshead.com/ubuntu/?action=show&id=4

    首先介绍两个命令: sudo 和 su
    sudo意思就是super-user do,让当前用户暂时以管理员的身份root来执行这条命令。
    su是用来改变当前用户的,su root,就是将当前用户切换为root,用了su root之后,下面所有的命令就可以不用打sudo了,因为当前用户已经是管理员root了。

    常用工具:
    scim
    很好的输入法,有着和微软拼音输入法差不多的输入方式,联想功能很强大。
    sudo apt-get install scim scim-modules-socket scim-modules-table scim-pinyin scim-tables-zh
    sudo sh -c " echo 'export XMODIFIERS=@im=SCIM ; export GTK_IM_MODULE="scim" ; export QT_IM_MODULE="scim" ; scim -d ' > /etc/X11/Xsession.d/95xinput "
    sudo chmod 755 /etc/X11/Xsession.d/95xinput

    comix
    Ubuntu下看漫画的软件,可以不用解压压缩包直接观看,和Windows中的ComicViewer的极佳替代品,只是打开很大的压缩包时,速度稍慢一点。
    apt-get install comix

    kiba-dock
    桌面dock工具,可以把常用的软件放在里面,最大的特色是支持物理效果,即可以将里面所有的物体扔来扔去,弹来弹去,很有趣。
    sudo apt-get install kiba-dock

    Avant Window Navigator
    Avant Window Navigator是一个Ubuntu下仿苹果风格的Dock,个人比较喜欢,虽然没有像kiba-dock那种可以做物理运动扔来扔去的功能,但是他里 面有着跳动、缩放、闪光、翻转等9种不同的效果,而且还可以把这9种效果任意组合,所以用起来还是非常舒服的。
    http://www.oshead.com/ubuntu/?action=show&id=9

    alien
    非常强大的工具,可以把rpm包转换为deb包,相信很多人都很需要这个功能。
    sudo apt-get install alien
    用法: sudo alien rpmfile.rpm

    ghex
    非常好用的16进制编辑工具,可以直接修改可执行文件。
    sudo apt-get install ghex

    聊天工具:
    LumaQQ
    Linux下的QQ聊天软件,最新版是2006 M2,虽然已经停止了开发,但是界面和QQ已经基本差不多,并且仍然能完成大部分的功能。
    http://www.oshead.com/ubuntu/?action=show&id=6

    视频音频:
    gstreamer
    安装后,Ubuntu即可播放mp3
    sudo apt-get install gstreamer0.10-*

    xine
    安装完后movie player即可播放rmvb等几乎所有格式的视频
    sudo apt-get remove totem-gstreamer
    sudo apt-get install totem-xine libxine1-ffmpeg libxine1-gnome libxine1-plugins libxine1 libstdc++5
    sudo apt-get install w32codecs

    Listen
    还在想Gnome下用什么音频播放器么,还在羡慕KDE下的Amarok么?用Listen吧,比Amarok都爽,让KDE来羡慕GNOME吧。
    sudo apt-get install listen

    网络工具:
    aMule
    Ubuntu下的Emule,速度甚至比Emule更快,而且不限制关键字哦(不纯洁的人们,这个作用就不用我解释了吧)
    sudo apt-get install amule

    WireShark
    Linux下用的最广泛的网络分析工具,功能非常强大,报文分析非常透彻,比Windows下的Etherpeek更加好用,只是没有报文统计功能。
    sudo apt-get install wireshark

    开发工具:
    jdk 6
    Java Develop Kit,用Java编写的程序都需要他的支持,里面包括了jre,所以不用另外去下jre了。
    sudo apt-get install sun-java6-jdk
    sudo update-alternatives --config java
    执行之后会出现如下画面
    There are 2 alternatives which provide `java'.

      Selection    Alternative
    -----------------------------------------------
              1    /usr/bin/gij-4.2
    *+        2    /usr/lib/jvm/java-6-sun/jre/bin/java

    Press enter to keep the default[*], or type selection number:
    输入你现在正在新装的java-6-sun的序号,如上,我的是2,回车。

    eclipse
    http://www.oshead.com/ubuntu/?action=show&id=7

    bluefish editor
    非常好用的网页编辑工具,里面提供了很多辅助Tag来添加代码,想我这种记忆力不好的人有救了。
    apt-get install bluefish

    devhelp
    一个像Windows中MSDN的帮助文档,只要下载对应的dev帮助文件,就可以在里面进行查找,很好用,开发必备工具。
    apt-get install devhelp
    March 07

    Ubuntu下安装*.bin程序

    1.先把*.bin从windows分区拷到/usr/local下面
    2.执行命令 sudo chmod +x *.bin
    3.执行命令sudo ./*.bin
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export JAVA_HOME=/usr/local/jdk1.6.0_12
    export PATH=$PATH:$JAVA_HOME/bin

    Ubuntu Logo Wine for Ubuntu and Ubuntu derivatives Ubuntu Logo

    Ubuntu and other Debian-based distributions utilize a special tool for managing packages known as APT. APT is able to automagically install all of the needed dependencies for a software package, as well as keep the package up to date, by scanning what are known as APT repositories. Ubuntu has its own repository of software that includes Wine, however we keep our own repository of the latest available beta packages here for download.

    Warning: These are beta packages

    The packages here are beta packages. This means they will periodically suffer from regressions, and as a result an update may break functionality in Wine. If the latest stable release of Wine (currently Wine 1.0.1) works for you, then you may not want to use these beta packages.

    Adding the WineHQ APT Repository:

    Open the Software Sources menu by going to System->Administration->Software Sources. Then select the Third Party Software tab and click Add. System->Administration->Software Sources->Third Party Software

    Then, copy and paste one of the lines below depending on which version you are running.

    For Ubuntu Intrepid (8.10):
    deb http://wine.budgetdedicated.com/apt intrepid main #WineHQ - Ubuntu 8.10 "Intrepid Ibex"

    For Ubuntu Hardy (8.04):
    deb http://wine.budgetdedicated.com/apt hardy main #WineHQ - Ubuntu 8.04 "Hardy Heron"

    Trusting the WineHQ APT Repository and installing Wine:

    After adding the repository, you also need to add the key for the repository to your system's list of trusted keys.

    Download and save Scott Ritchie's key (right click -> save as) to your desktop. Then open the Authentication tab, click import key file, and select the key file you just saved (Scott Ritchie.gpg). It is safe to delete this file after doing this step. System->Administration->Software Sources->Authentication

    Click close to finish, and then reload the package information when prompted. If you have Wine installed, the system's update manager will now inform you of the latest Wine beta release and prompt you to upgrade. If you haven't installed Wine yet, go to Applications->Add/Remove and search for Wine or just click this link.

    Upgrading to a new version of Ubuntu

    If you are upgrading the entire system, such as going from Ubuntu 8.04 to 8.10, you will need to come back to this page and add the repository for the new version above. The built in update manager will not switch the Wine repository automatically.

    Older .deb packages

    Since the APT repository can only hold the latest packages, older versions of the packages are available at the WineHQ .deb packages archive.

    You can install downloaded packages by double-clicking on them.

    Alternative command Line Instructions for Installing Wine:

    It is also possible to add the Wine repositories and install via the command line, as follows. These may be useful on Kubuntu, Xubuntu, and other Ubuntu derivatives.

    First, open a terminal window (Applications->Accessories->Terminal). Then add the repository's key to your system's list of trusted APT keys by copy and pasting the following into your terminal:

    wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -

    Next, add the repository to your system's list of APT sources:

    For Ubuntu Intrepid (8.10):
    sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/intrepid.list -O /etc/apt/sources.list.d/winehq.list

    For Ubuntu Hardy (8.04):
    sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/hardy.list -O /etc/apt/sources.list.d/winehq.list

    Then update APT's package information by running 'sudo apt-get update'. You can now install Wine normally or by typing 'sudo apt-get install wine' into the terminal.

    Very fast and reliable webhosting for the APT repository is graciously provided by budgetdedicated.com.v

    March 04

    JAVA 调用SAP RFC函数 报错信息搜集

    RFC接口调用SAP如果有异常会通过com.sap.mw.jco.JCO$Exception: 抛出异常
    在开发中遇到的异常有如下

    用户名密码可能是错误或者用户无权限,确认用户,必要时联系SAP负责人,检查用户
    (103) RFC_ERROR_LOGON_FAILURE: ##.#####,####
    (103) RFC_ERROR_LOGON_FAILURE: Name or password is incorrect (repeat logon)

    call信息没有填写完整,检查配置文件各个SAP配置信息是否完整
    (101) RFC_ERROR_PROGRAM: Missing R3NAME=... or ASHOST=... in connect_param in RfcOpenEx

    ip地址失败:
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed

    组权限访问 server文件没更新.
    (102) RFC_ERROR_COMMUNICATION:Connect to message server failed

    C:\WINNT\system32\drivers\etc

    端口号错误报错信息:
    (103) RFC_ERROR_LOGON_FAILURE: ## 502 ########

    超时:
    (103) RFC_ERROR_LOGON_FAILURE: Timeout

    执行函数,函数的问题
    (104) RFC_ERROR_SYSTEM_FAILURE: Error in module RSQL of the database interface.执行函数

    (104) RFC_ERROR_SYSTEM_FAILURE: An error occurred when receiving a complex parameter.

    (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet

    返回的表没有值.那个表连第一行都没有,取不到
    (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet

    语法错误
    (104) RFC_ERROR_SYSTEM_FAILURE: Syntax error in program SAPMV50A

    找不到行
    (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not ha:ve any rows yet

    输入参数不能插入SAP函数输入字段中.
    (122) JCO_ERROR_CONVERSION: Integer '4234243' has to many digits at field PO_ITEM

    JAVA使用jco连接SAP

    1、JCO使用前提:sapjco包.将该包中librfc32.dll放到 C:\WINNT\SYSTEM32 中,将 librfc32.dll sapjco.jar sapjcorfc.dll 放到jre/bin中(注意是jre而不是jdk)。
    2、简单使用过程:导入jar包;定义连接;建立连接对象;打开连接;调用功能模块;关闭连接。以下是一个连接的实例:
    //导入jar包
    import com.sap.mw.jco.*;
    public class TestGet {
        public static void main(String[] args) {
            IRepository repository;
    //定义连接
            JCO.Client mConnection ;
    //建立连接对象       
            mConnection =
            JCO.createClient(   "700",         // SAP client
                        "username",            // userid
                        "password",           // password
                        "EN",                 // language (null for the default language)
                        "hostname or IP",     // application server host name
                        "01");                // system number
        try{
    //打开连接,调用功能模块,关闭连接
            mConnection.connect();
            System.out.println(mConnection.getAttributes());
            mConnection.disconnect();
            }catch(Exception e){
            System.err.println("打开或关闭连接失败");
            }
        }
    }
    注意,有关连接对象的考虑,并不是反复的建立连接和关闭连接,会导致大量的系统资源消耗;sap提供了连接池的概念,使用连接池可以减轻服务器的负担,从而提供服务器性能。
    3、使用连接池以后可以提高效率,下面介绍一个这种例子:
    import java.io.BufferedInputStream;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import com.sap.mw.jco.*;
    public class TestGetPool {
        static final String pool_name = "pool";
        public static void main(String[] args) throws IOException {
            IRepository repository;
            JCO.Client mConnection ;
            JCO.Pool pool = JCO.getClientPoolManager().getPool(pool_name);
            if (pool == null) {
                java.util.Properties logonprope = new java.util.Properties();
                InputStream in = new BufferedInputStream (new FileInputStream("../jcoproject/src/jcotest/logon.properties"));
                logonprope.load(in);
    //在连接池中添加连接的方式有多种,这里仅仅展示了两种方式
                JCO.addClientPool( pool_name,           // pool name
                              5,                   // maximum number of connections
                              logonprope
                    );                 
                    }
    /**       
    *                 JCO.addClientPool( pool_name,           // pool name
                                        5,                   // maximum number of connections
                                        "700",         // SAP client
                                "username",           // userid
                                "password",          // password
                                "EN",                 // language (null for the default language)
                                "hostname",     // application server host name
                                "01");                // system number
    * /
        mConnection = JCO.getClient(pool_name);
        try{
            mConnection.connect();
            System.out.println(mConnection.getAttributes());
            }catch(Exception e){
                System.err.println("打开或关闭连接失败");
            }finally{
                JCO.releaseClient(mConnection);
            }
        }
    }
    注意上述程序采用了两种连接池添加的方法,其中使用properties方法(使用该方法最大的好处就是更改了系统的时候不需要重新编译java文件,带来了重要的好处)的文件如下:
    jco.client.client=700
    jco.client.user=username
    jco.client.passwd=password
    jco.client.ashost= hostname
    jco.client.sysnr=01

    October 07

    SAP Movement Type

    101 Goods receipt for purchase order or order
    If the purchase order or order has not been assigned to an account, a stock type (unrestricted-use stock, stock in quality inspection, blocked stock) can be entered during goods receipt.
    If the purchase order or order has been assigned to an account, the goods receipt is not posted to the warehouse, but to consumption.
    In the case of non-valuated materials, the goods receipt is posted to the warehouse, although the purchase order has not been assigned to an account.
    Possible special stock indicators:
    o K Goods receipt for purchase order to consignment stock
    o O Goods receipt for purchase order to stock of material provided to vendor
    o E GR for purchase order or order to
    o sales order stock
    o Q GR for purchase order or order to
    o project stock.
    Goods receipt for subcontract order : at goods receipt, the consumption of the components is posted at the same time (see movement type 543)
    Goods receipt for
    stock transport order : at goods receipt the transported quantity is posted in the receiving plant from stock in transit into unrestricted-use stock (or stock in quality inspection, blocked stock).
    103 Goods receipt for purchase order into GR blocked stock
    You cannot receive goods into goods receipt blocked stock for stock transport orders.
    Possible special stock indicators:
    K, O, E, Q
    105 Release from GR blocked stock for purchase order
    Movement type 105 has the same effects as 101.
    Possible special stock indicators:
    K, O, E, Q
    121 Subsequent adjustment for subcontracting
    This movement type cannot be entered manually.
    With a subsequent adjustment for a subcontract order it is possible to correct the consumption of components. In this case, the material produced by the supplier is credited with the excess consumption / under-consumption. For this reason, if there is a subsequent adjustment, an item is generated for the produced material using movement movement type 121.
    Movement type 121 does not have a reversal movement type.
    Possible special stock indicators:
    O, E, Q
    122 Return delivery to supplier or to production
    Using movement type 122, you can distinguish real return deliveries for a purchase order or order from cancellations (102).
    In the standard version, you must enter a reason for the return delivery if you are using movement type 122. This enables you to carry out evaluations for return deliveries.
    The effects of movement type 122 correspond to a cancellation of movement type 101.
    Possible special stock indicators:
    K, O, E, Q
    123 Reversal of return delivery
    If you returned a goods receipt using movement type 122, you can reverse the return delivery using movement type 123. This movement type has the same effects as movement type 101.
    Possible special stock indicators:
    K, O, E, Q
    124 Return delivery to vendor from GR blocked stock
    Using movement type 124, you can return a goods receipt to GR blocked stock (103).
    Movement type 124 has the same effects as movement type 104.
    Possible special stock indicators:
    K, O, E, Q
    125 Return delivery from GR blocked stock - reversal
    If you returned a goods receipt to GR blocked stock using movement type
    124, you can reverse the return delivery using movement type 125.
    Movement type 125 has the same effects as movement type 103.
    Possible special stock indicators:
    K, O, E, Q
    131 Goods receipt for run schedule header
    This movement type cannot be entered manually. It is generated automatically at notification of goods receipt for a run schedule header.
    Possible special stock indicators:
    E, Q
    141 Goods receipt for subsequent adjustment for active ingredient
    This movement type cannot be entered manually. It is generated automatically upon subsequent adjustment for a proportion/product unit . Subsequent adjustment is necessary if the system finds that there has been excess consumption or under-consumption after a goods receipt posting.
    Possible special stock indicators:
    K, O, E, Q
    161 Return for purchase order
    If a purchase order item is marked as a returns item, the returns to vendor are posted using movement type 161 when the goods receipt for purchase order (101) is posted.
    Movement type 161 has the same effects as movement type 122.
    Possible special stock indicators:
    K, O, E, Q
    201 Goods receipt for a cost center
    The goods can only be withdrawn from unrestricted-use stock.
    Possible special stock indicators:
    o K: Goods withdrawal from
    o consignment stock
    o P: Goods withdrawal from pipeline
    If you have withdrawals from consignment stock and from pipeline, payables to suppliers ensue.
    221 Goods issue for a project
    The goods can only be withdrawn from unrestricted-use stock.
    Possible special stock indicators:
    K, Q
    231 Goods issue for a customer order (without Shipping)
    You use this movement type if you want to process the delivery without Shipping.
    The goods can only be withdrawn from unrestricted-use stock.
    Possible special stock indicators:
    E, K, Q
    241 Goods issue for an asset
    The goods can only be withdrawn from unrestricted-use stock.
    Possible special stock indicators:
    K
    251 Goods issue for sales (without customer order)
    Use this movement type if you have not entered a customer order in SD. In the standard system, the movement is assigned to a cost center.
    The goods can only be withdrawn from unrestricted-use stock.
    Possible special stock indicators:
    K
    261 Goods issue for an order
    This refers to all withdrawals for orders (for example, production order, maintenance order, except customer orders.
    Possible special stock indicators:
    E, K, P, Q, W
    The goods issue can be posted manually in Inventory Management or automatically when an order is confirmed or via a delivery in Shipping.
    281 Goods issue for a network
    The goods can only be withdrawn from unrestricted-use stock.
    The goods issue can also be posted via a delivery in Shipping.
    Possible special stock indicators:
    E, K, P, Q
    291 Goods issue for any arbitrary account assignment
    With this movement type, all account assignment fields are ready for input. You can assign the movement to any arbitrary account assignment object.
    The goods can only be withdrawn from unrestricted-use stock.
    Possible special stock indicators:
    E, K, P, Q
    301 Transfer posting plant to plant in one step
    The quantity is transferred from unrestricted-use stock in the issuing plant to unrestricted-use stock in the receiving plant.
    Possible special stock indicators:
    E, O, Q, V, W
    303 Transfer posting plant to plant in two steps - removal from storage
    The quantity is transferred from unrestricted-use stock of the issuing plant to stock in transfer in the receiving plant.
    For technical reasons, you cannot carry out transfer postings from plant to plant in two steps for split valuation materials.
    Removal from storage can be posted with movement type 603 via Shipping.
    Possible special stock indicators:
    None
    305 Transfer posting plant to plant in two steps - placement in storage
    The quantity is posted from
    stock in transfer to unrestricted-use stock in the receiving plant. The movement is not valuated.
    You can use movement type 605 in Shipping to post the goods receipt with reference to the delivery.
    Possible special stock indicators:
    None
    309 Transfer posting material to material
    The quantity is posted from unrestricted-use stock of the issuing material into unrestricted-use stock in the receiving material.
    Prerequisite: both materials have the same stockkeeping unit.
    Possible special stock indicators:
    E, O, Q, V, W
    311 Transfer posting storage location to storage location in one step
    The quantity is transferred from unrestricted-use stock of the issuing storage location to unrestricted use in the receiving storage location.
    Possible special stock indicators:
    E, K, M, Q
    See also 321, 343, 349, 455 for other stock types.
    313 Stock transfer storage location to storage location in two steps - removal from storage
    The quantity is transferred from unrestricted-use stock of the issuing storage location to stock in transfer in the receiving storage location.
    Possible special stock indicators:
    None
    315 Transfer posting storage location to storage location in two steps - placement in storage
    In the receiving storage location, the quantity is transferred from the stock in transfer to the unrestricted-use stock.
    Possible special stock indicators:
    None
    317 Creation of a structured material from constituent components (Retail)
    A material split into its components using movement type 319 can be rejoined using movement type 317.
    Movement type 317 has the same effect as a cancellation of movement type 319.
    Possible special stock indicators:
    None
    319 Split structured material into components (Retail)
    You can enter the splitting of a structured material manually using movement type 319.
    You can configure Customizing so that a structured material (for example, a set, prepack or display is automatically split into its components at goods receipt. The system posts the split using movement type 319. In this process, the BOM header material is posted and each of the component stocks are increased. You can also use this function if you use the Warehouse Management System (WM).
    Possible special stock indicators:
    None
    Example:
    A box of the structured material S contains 3 pieces of the component K1 and 4 pieces of the component K2. The following material document items result after the material is split at goods receipt:
    Qty Unit Material Movement type
    1 box S 101 +
    1 box S 319 -
    4 piece K1 319 +
    5 piece K2 319 +
    321 Transfer posting stock in quality inspection - unrestricted-use stock
    The quantity is transferred from stock in quality inspection into unrestricted-use stock. Here it is possible to post the quantity to another storage location.
    You cannot use this movement type for QM-managed materials since transfer posting for these materials takes place using the usage decision.
    Possible special stock indicators:
    E, K, O, Q, V, W
    323 Transfer posting storage location to storage location - stock in quality inspection
    The quantity is transferred from stock in quality inspection in the issuing storage location into stock in quality inspection in the receiving storage location.
    Possible special stock indicators:
    E, K, Q
    325 Transfer posting storage location to storage location - blocked stock
    The quantity is transferred from blocked stock in the issuing storage location into blocked stock in the receiving storage location.
    Possible special stock indicators:
    E, K, Q
    331 Withdrawal of sample from stock in quality inspection
    The sample is destructive, that is, the withdrawal has the same effects asscrapping.
    Possible special stock indicators:
    E, K, Q, V, W
    333 Withdrawal of sample from unrestricted-use stock
    The sample is destructive, that is, the withdrawal has the same effects asscrapping.
    Possible special stock indicators:
    E, K, Q, V, W
    335 Withdrawal of sample from blocked stock
    The sample is destructive, that is, the withdrawal has the same effects asscrapping.
    Possible special stock indicators:
    E, K, Q
    341 Change in status of a batch (available to unavailable)
    This goods movement is automatically created when there is a change in the status of a batch and it is also used to transfer the unrestricted-use stock into
    restricted-use stock.
    Possible special stock indicators:
    E, K, M, O, Q, V, W
    343 Transfer posting blocked stock - unrestricted-use stock
    The quantity is transferred from blocked stock to unrestricted-use stock. You can also post the quantity to another storage location.
    Possible special stock indicators:
    E, K, Q
    349 Transfer posting from blocked stock to stock in quality inspection
    The quantity is transferred from blocked stock to stock in quality inspection. Here you can transfer the quantity to another storage location.
    Possible special stock indicators:
    E, K, Q
    351 Goods issue for a stock transport order (without Shipping)
    The quantity is transferred from unrestricted-use stock in the issuing plant to stock in transit in the receiving plant.
    Movement type 351 is only used if the goods issue is posted without a delivery in Shipping. A goods issue for a stock transport order with delivery in Shipping is posted using movement type 641, 643, 645 or 647.
    The transfer posting is also possible for materials with split valuation.
    The goods issue for a stock transport order takes place using movement type 101.
    Possible special stock indicators:
    E, Q
    For special stock indicators E and Q and for purchase orders assigned to an account, ensure that the quantity is not posted to the stock in transit in the receiving plant.
    411 Transfer posting of special stocks E, K, and Q to company's own stock
    The quantity is transferred from unrestricted-use special stock E( sales order stock ), unrestricted-use special stock K ( consignment stock) andunrestricted-use special stock Q ( project_stock ) to unrestricted-use storage location stock. The corresponding special stock indicator is required for this movement.
    If you do not use the special stock indicator, the system uses this movement type and movement type 311.
    For sales order stock, you can change the material number for this movement if you manage the material in your company's own stock under a different material number (for example, for configurable materials).
    Consignment stock is transferred to valuated stock, thus resulting in a vendor liability.
    413 Transfer posting to sales order stock
    You can use this movement type to carry out a transfer posting from your own unrestricted-use stock, other sales order stock, consignment stock, and project stock to a sales order stock.
    Possible special stock indicators:
    E, K, Q
    415 Transfer posting to project stock
    You can use this movement type to carry out a transfer posting from your own unrestricted-use stock, consignment stock, and other project stock to a project stock.
    Possible special stock indicators:
    E, K, Q
    441 Transfer posting non-tied to tied empties
    Part of the stock of an "empties" material assigned to a full product is managed in the stock type "tied empties".
    Empties stock not assigned to a full product forms part of the stock type "unrestricted-use".
    Using movement type 441, you can make a transfer posting for an empties material from the stock type "unrestricted-use" to the stock type "tied empties". Movement type 442 reverses this transaction.
    Example:
    The full product "beer" has a stock of 15 cases. Part of the empties components "bottle" and "case" is tied empties stock.
    Material unrestricted-use tied empties
    Beer 15
    Bottle 240 360
    case 10 15
    451 Returns from customers (without Shipping)
    Using movement type 451, you post customer returns without a returns delivery in Shipping into blocked stock returns . The blocked stock returns are not valuated.
    Possible special stock indicators:
    None
    See also: 453, 651, 653
    453 Transfer posting blocked stock returns to unrestricted-use stock
    The quantity is transferred from blocked stock returns to unrestricted-use stock and thereby transferred to valuated stock.
    With this movement you can transfer the quantity to another storage location at the same time.
    Possible special stock indicators:
    None
    455 Transfer posting storage location to storage location - blocked stock
    returns
    The quantity is transferred from blocked stock returns of the issuing storage location to blocked stock returns of the receiving storage location.
    Possible special stock indicators:
    None
    457 Transfer posting blocked stock returns to quality inspection stock
    The quantity is transferred from blocked stock returns to quality inspection stock and thereby transferred to valuated stock.
    With this movement you can transfer the quantity to another storage location at the same time.
    Possible special stock indicators:
    None
    459 Transfer posting blocked stock returns to blocked stock
    The quantity is transferred from blocked stock returns to blocked stock and thereby transferred to valuated stock.
    With this movement you can transfer the quantity to another storage location at the same time.
    Possible special stock indicators:
    None
    501 Goods receipt without purchase order - unrestricted-use stock
    This movement type is used for deliveries from vendors that are not based on a purchase order. Invoice verification is not possible for these goods receipts.
    For a goods receipt for purchase order (101), the receipt of returnable transport packaging can be entered using movement type 501 and special stock indicator M.
    Possible special stock indicators:
    E, K, M, Q
    503 Goods receipt without purchase order - stock in quality inspection
    This movement type is used for deliveries from vendors that are not based on a purchase order. Invoice verification is not possible for these goods receipts.
    Possible special stock indicators:
    E, K, Q
    505 Goods receipt without purchase order - blocked stock
    This movement type is used for deliveries from vendors that are not based on a purchase order. Invoice verification is not possible for these goods receipts.
    Possible special stock indicators:
    E, K, Q
    511 Free-of-charge delivery from vendor
    The quantity is posted to unrestricted-use stock. If there is a material with moving average price, the moving average price is reduced accordingly.
    Possible special stock indicators:
    None
    521 Goods receipt without order - unrestricted-use stock
    This movement type is used for deliveries from production that are not based on an order.
    Possible special stock indicators:
    E, Q
    523 Goods receipt without order - stock in quality inspection
    This movement type is used for deliveries from production that are not based on an order.
    Possible special stock indicators:
    E, Q
    525 Goods receipt without order - blocked stock
    This movement type is used for deliveries from production that are not based on an order.
    Possible special stock indicators:
    E, Q
    531 Goods receipt from by-product from the order
    The goods receipt of a by-product usually refers to an order, but it can be entered without a reference.
    If a component is entered with a negative quantity in the order, a reservation item is created with 531 (instead of 261). The receipt of a by-product can be entered when the component for the order is withdrawn from stock or it can be entered as an 'other goods receipt'.
    Possible special stock indicators:
    E, Q
    See also: 545 and 581
    541 Transfer posting unrestricted-use stock - stock of material provided to vendor
    With this movement type you provide the subcontractor with the components required for subcontract orders . The quantity is posted into unrestricted-use stock of material provided to vendor.
    If there is a goods receipt for a subcontract order (101), the consumption of components is posted from this stock.
    The transfer posting can be posted via a delivery in Shipping.
    Possible special stock indicators:
    None
    543 Consumption from stock of material provided to vendor
    This movement cannot be entered manually.
    The consumption of components for a subcontract order is posted using goods receipt for purchase order (101). It can be corrected by means of a subsequent adjustment.
    For special stock indicators E and Q, you must ensure that the quantity is not posted to the stock of material provided to vendor, but to the unrestricted-use sales order or project stock.
    Possible special stock indicators:
    E, O, Q
    545 Goods receipt from by-product from subcontracting
    If a component is entered with a negative quantity for the subcontract order, the receipt of the by-product is posted to stock provided to vendor during goods receipt for purchase order or during the subsequent adjustment.
    For special stock indicators E and Q, you must ensure that the quantity is not posted to the stock of material provided to vendor, but to the unrestricted-use sales order or project stock.
    Possible special stock indicators:
    E, O, Q
    551 Scrapping from unrestricted-use stock
    Possible special stock indicators:
    E, K, O, Q, V, W
    553 Scrapping from stock in quality inspection
    Possible special stock indicators:
    E, K, O, Q, V, W
    555 Scrapping from blocked stock
    Possible special stock indicators:
    E, K, Q
    561 Initial entry of stock - unrestricted-use stock
    During
    initial entry of stock balances, when the R/3 system is active, you enter the physical warehouse stock figures or the book inventory from your old system into the R/3 Materials Management component. This data entry usually takes place by means of batch input.
    Possible special stock indicators:
    E, K, M, O, Q, V, W
    563 Initial entry of stock - quality inspection
    During
    initial entry of stock balances, when the R/3 system is active, you enter the physical warehouse stock figures or the book inventory from your old system into the R/3 Materials Management component. This data entry usually takes place by means of batch input.
    Possible special stock indicators:
    E, K, O, Q, V, W
    565 Initial entry of stock - blocked stock
    During
    initial entry of stock balances, when the R/3 system is active, you enter the physical warehouse stock figures or the book inventory from your old system into the R/3 Materials Management component. This data entry usually takes place by means of batch input.
    Possible special stock indicators:
    E, K, Q
    571 Goods receipt for assembly order to unrestricted-use
    This movement cannot be entered in Inventory Management, but only in repetitive manufacturing using the Goods receipt for sales order function.
    Possible special stock indicators:
    E, Q
    573 Goods receipt for assembly order to quality inspection
    This movement cannot be entered in Inventory Management, but only in repetitive manufacturing using the Goods receipt for sales order function.
    Possible special stock indicators:
    E, Q
    575 Goods receipt for assembly order to blocked stock
    This movement cannot be entered in Inventory Management, but only in repetitive manufacturing using the Goods receipt for sales order function.
    Possible special stock indicators:
    E, Q
    581 Goods receipt of a by-product from the network
    The goods receipt of a by-product usually refers to a network , but can be entered without reference.
    If a component is entered with a negative quantity in the network, a reservation is created with 581 (instead of 281). The receipt of a by-product can be entered during the withdrawal for the network or as an 'other goods receipt'.
    Possible special stock indicators:
    E, Q
    601 Goods issue for delivery (Shipping)
    In Shipping, this movement type is created automatically with the Goods issue for delivery function.
    The quantity is taken from unrestricted-use stock.
    Possible special stock indicators:
    E, K, Q
    603 Goods issue for stock transport order (Shipping) with additional
    item
    If you issue goods for a stock transport order in Shipping using movement type 641, you can use this movement type to assign an extra item to the order.
    The ordered material is transferred to the stock in transit of the receiving plant. The material for the additional item is transferred from unrestricted-use stock in the issuing plant to stock in transfer in the receiving plant.
    You can also use this movement type without referencing a purchase order.
    Possible special stock indicators:
    None
    See also: 303, 641
    605 Goods receipt for a stock transport order (Shipping) with
    additional item
    You can use this movement type to transfer into unrestricted-use stock the material you posted into stock in transfer in the receiving plant using movement type 603. You post the goods movement with reference to the purchase order (if available) or the delivery.
    Possible special stock indicators:
    None
    See also: 305, 641
    621 Transfer posting unrestricted-use - returnable packaging (Shipping)
    The quantity is transferred from unrestricted-use stock to the returnable packaging stock at customer .
    Possible special stock indicators:
    none
    623 Goods issue from returnable packaging stock at customer (Shipping)
    This quantity is withdrawn from unrestricted-use returnable packaging stock at the customer.
    Possible special stock indicators:
    V
    631 Transfer posting unrestricted use - customer consignment stock (Shipping)
    The quantity is transferred from unrestricted-use stock to consignment stock at customer.
    Possible special stock indicators:
    E, Q
    633 Goods issue from customer consignment (Shipping)
    The quantity is withdrawn from unrestricted-use consignment stock at the customer.
    Possible special stock indicators:
    W
    641 Goods issue for a stock transport order (Shipping)
    The quantity is transferred using a delivery in Shipping from unrestricted-use stock of the issuing plant to stock in transit of the receiving plant.
    The goods receipt for the
    stock transport order takes place using movement type 101 and can, if required, refer to the purchase order or to the delivery. If a purchase order item is flagged as a returns item in the stock transport order, you can post the goods receipt of the returns in the issuing plant with movment type 671.
    Possible special stock indicators:
    E, Q
    For the special stock indicators E and Q and for purchase orders assigned to an account, you must ensure that the quantity is not posted to the stock in transit of the receiving plant.
    See also: 351, 643, 671
    643 Goods issue for a cross-company
    stock transport order (Shipping)
    It is used only for cross-company stock transport orders with SD billing and invoice. The quantity is withdrawn from the unrestricted-use stock of the issuing plant. No stock in transit is created here. In the second step, the goods receipt must be entered in the receiving plant. If a purchase order item is flagged as a returns item in the stock transport order, you can post the goods receipt of the returns in the issuing plant with movment type 673.
    Possible special stock indicators:
    None
    See also: 351, 641, 673
    645 Goods issue for a cross-company
    stock transport order in one step (Shipping)
    Unlike movement type 643, when a goods issue is posted using movement type 645, a goods receipt line is generated automatically. If a purchase order item is flagged as a returns item in the stock transport order, you can post the goods receipt of the returns in the issuing plant with movment type 675.
    Possible special stock indicators:
    None
    See also: 675
    647 Goods issue for a stock transport order in one step
    (Shipping)
    Unlike movement type 641, when a goods issue is posted using movement type 647, a goods receipt line (101) is generated automatically in the receiving plant. If a purchase order item is flagged as a returns item in the stock transport order, you can post the goods receipt of the returns in the issuing plant with movment type 677.
    Possible special stock indicators:
    E, Q
    See also: 677
    651 Returns from customer (Shipping)
    Using movement type 651, you post returns from a customer with a return delivery in Shipping to blocked stock returns.
    Possible special stock indicators:
    None
    See also: 451, 453, 653
    653 Returns from customer (Shipping) to unrestricted-use stock
    With this movement type you post returns from the customer with returns delivery via Shipping directly to the valuated stock.
    Possible special stock indicators:
    E
    See also: 451, 453, 651
    655 Returns from customer (Shipping) to stock in quality inspection
    With this movement type you post returns from the customer with returns delivery via Shipping directly to the valuated stock.
    Possible special stock indicators:
    E
    See also: 451, 453, 651
    657 Returns from customer (Shipping) to blocked stock
    With this movement type you post returns from the customer with returns delivery via Shipping directly to the valuated stock.
    Possible special stock indicators:
    E
    See also: 451, 453, 651
    661 Returns to vendor via Shipping
    As with movement type 502, a return delivery to the vendor is entered without reference to the purchase order, but the goods issue is posted via a delivery in Shipping.
    Possible special stock indicators:
    E
    671 Returns for stock transport order via Shipping
    If a purchase order item is marked as a returns item in a stock transport order using movement type 641, when a goods receipt for a stock transport order (101) is posted, the return is posted to stock in transit using movement type 161. When the return arrives, the issuing plant posts the goods receipt for the return using movement type 671. Movement type 671 (like movement types 352 and 642) reduces the receiving plant's stock in transit and increases the issuing plant's unrestricted-use stock.
    Possible special stock indicators:
    E, Q
    673 Returns for cross-company stock transport order
    (Shipping)
    If you post a goods issue for a cross-company stock transport order with returns items using movement type 643 via Shipping, the returns are transferred to unrestricted-use stock in the issuing plant in a second step using movement type 673.
    Possible special stock indicators:
    None
    See also: 643
    675 Returns for cross-company stock transport order
    (Shipping) in one step
    If you use movement type 645 to post a goods issue for a cross-company stock transport order with returns items in one step, the returns are transferred to unrestricted-use stock in the issuing plant using movement type 161 in the receiving plant and movement type 675 in the issuing plant.
    Possible special stock indicators:
    None
    See also: 645
    677 Returns for stock transport order in one step (Shipping)
    If you use movement type 647 to post a goods issue for a stock transport order with returns items in one step, the returns are transferred to unrestricted-use stock in the issuing plant using movement type 161 in the receiving plant and movement type 677 in the issuing plant.
    Possible special stock indicators:
    E, Q
    See also: 647
    701 Inventory differences in unrestricted-use stock (MM-IM)
    This movement is generated automatically during inventory difference posting in Inventory Management.
    Possible special stock indicators:
    E, K, M, O, Q, V, W
    703 Inventory differences in quality inspection stock (MM-IM)
    This movement is generated automatically during inventory difference posting in Inventory Management.
    Possible special stock indicators:
    E, K, M, O, Q, V, W
    707 Inventory differences in blocked stock (MM-IM)
    This movement is generated automatically during inventory difference posting in Inventory Management.
    Possible special stock indicators:
    E, K, M, Q
    711 Inventory differences in unrestricted-use stock (LE-WM)
    This movement is generated automatically when you post inventory differences in the Warehouse Management System.
    Possible special stock indicators:
    E, K, M, Q
    713 Inventory differences in quality inspection stock (LE-WM)
    This movement is generated automatically when you post inventory differences in the Warehouse Management System.
    Possible special stock indicators:
    E, K, M, Q
    715 Inventory differences in blocked stock returns (LE-WM)
    This movement is generated automatically when you post inventory differences in the Warehouse Management System.
    Possible special stock indicators:
    None
    717 Inventory differences in blocked stock (LE-WM)
    This movement is generated automatically when you post inventory differences in the Warehouse Management System.
    Possible special stock indicators:
    E, K, M, Q
    721 - Sales value receipt - not affecting margins (Retail)
    The movement is generated automatically when the sales price of a value-only material is changed (total sales price revaluation on the posting date).
    Possible special stock indicators:
    None
    731 - Sales value receipt - affecting margins (Retail)
    The movement is generated automatically when the sales price of a value-only material is changed (partial sales price revaluation on the posting date).

    August 28

    Log4Net使用指南

    声明:本文内容主要译自Nauman Leghari的Using log4net,亦加入了个人的一点心得(节3.1.4)。
    请在这里下载示例代码

    1 简介

    1.1 Log4net的优点:

    几乎所有的大型应用都会有自己的用于跟踪调试的API。因为一旦程序被部署以后,就不太可能再利用专门的调试工具了。然而一个管理员可能需要有一套强大的日志系统来诊断和修复配置上的问题。

    经验表明,日志记录往往是软件开发周期中的重要组成部分。它具有以下几个优点:它可以提供应用程序运行时的精确环境,可供开发人员尽快找到应用程序中的Bug;一旦在程序中加入了Log 输出代码,程序运行过程中就能生成并输出日志信息而无需人工干预。另外,日志信息可以输出到不同的地方(控制台,文件等)以备以后研究之用。

    Log4net就是为这样一个目的设计的,用于.NET开发环境的日志记录包。

    1.2 Log4net的安装:

    用户可以从http://logging.apache.org/log4net/下载log4net的源代码。解压软件包后,在解压的src目录下将log4net.sln载入Visual Studio .NET,编译后可以得到log4net.dll。用户要在自己的程序里加入日志功能,只需将log4net.dll引入工程即可。

    2 Log4net的结构

    log4net 有四种主要的组件,分别是Logger(记录器), Repository(库), Appender(附着器)以及 Layout(布局).

    2.1 Logger

    2.1.1 Logger接口

    Logger是应用程序需要交互的主要组件,它用来产生日志消息。产生的日志消息并不直接显示,还要预先经过Layout的格式化处理后才会输出。

    Logger提供了多种方式来记录一个日志消息,你可以在你的应用程序里创建多个Logger,每个实例化的Logger对象都被log4net框架作为命名实体(named entity)来维护。这意味着为了重用Logger对象,你不必将它在不同的类或对象间传递,只需要用它的名字为参数调用就可以了。log4net框架使用继承体系,继承体系类似于.NET中的名字空间。也就是说,如果有两个logger,分别被定义为a.b.c和a.b,那么我们说a.b是a.b.c的祖先。每一个logger都继承了祖先的属性

    Log4net框架定义了一个ILog接口,所有的logger类都必须实现这个接口。如果你想实现一个自定义的logger,你必须首先实现这个接口。你可以参考在/extension目录下的几个例子。

    ILog接口的定义如下:

    public interface ILog

    {

    void Debug(object message);

    void Info(object message);

    void Warn(object message);

    void Error(object message);

    void Fatal(object message);

    //以上的每一个方法都有一个重载的方法,用来支持异常处理。

    //每一个重载方法都如下所示,有一个异常类型的附加参数。

    void Debug(object message, Exception ex);

    // ...

    //Boolean 属性用来检查Logger的日志级别

    //(我们马上会在后面看到日志级别)

    bool isDebugEnabled;

    bool isInfoEnabled;

    //… 其他方法对应的Boolean属性

    }

    Log4net框架定义了一个叫做LogManager的类,用来管理所有的logger对象。它有一个GetLogger()静态方法,用我们提供的名字参数来检索已经存在的Logger对象。如果框架里不存在该Logger对象,它也会为我们创建一个Logger对象。代码如下所示:

    log4net.ILog log = log4net.LogManager.GetLogger("logger-name");

    通常来说,我们会以类(class)的类型(type)为参数来调用GetLogger(),以便跟踪我们正在进行日志记录的类。传递的类(class)的类型(type)可以用typeof(Classname)方法来获得,或者可以用如下的反射方法来获得:

    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType

    尽管符号长了一些,但是后者可以用于一些场合,比如获取调用方法的类(class)的类型(type)。

    2.1.2 日志的级别

    正如你在ILog的接口中看到的一样,有五种不同的方法可以跟踪一个应用程序。事实上,这五种方法是运作在Logger对象设置的不同日志优先级别上。这几种不同的级别是作为常量定义在log4net.spi.Level类中。你可以在程序中使用任何一种方法。但是在最后的发布中你也许不想让所有的代码来浪费你的CPU周期,因此,框架提供了7种级别和相应的Boolean属性来控制日志记录的类型。

    Level有以下几种取值

    级别

    允许的方法

    Boolean属性

    优先级别

    OFF

    Highest

    FATAL

    void Fatal(...);

    bool IsFatalEnabled;

    RROR

    void Error(...);

    bool IsErrorEnabled;

    WARN

    void Warn(...);

    bool IsWarnEnabled;

    INFO

    void Info(...);

    bool IsInfoEnabled;

    DEBUG

    void Debug(...);

    bool IsDebugEnabled;

    ALL

    Lowest

    表1 Logger的日志级别

    在log4net框架里,通过设置配置文件,每个日志对象都被分配了一个日志优先级别。如果没有给一个日志对象显式地分配一个级别,那么该对象会试图从他的祖先继承一个级别值。

    ILog接口的每个方法都有一个预先定义好了的级别值。正如你在表1看到的,ILog的Inof()方法具有INFO级别。同样的,以此类推,Error()方法具有ERROR级别。当我们使用以上的任何一种方法时,log4net框架会检查日志对象logger的级别和方法的级别。只有当方法的级别高于日志级别时,日志请求才会被接受并执行。

    举例说明,当你创建了一个日志对象,并且把他的级别设置为INFO。于是框架会设置日志的每个Boolean属性。当你调用相应的日志方法时,框架会检查相应的Boolean属性,以决定该方法能不能执行。如下的代码:

    Logger.Info("message");

    Logger.Debug("message");

    Logger.Warn("message");

    对于第一种方法,Info()的级别等与日志的级别(INFO),因此日志请求会被传递,我们可以得到输出结果”message”。

    对于第二种方法,Debug()的级别低于日志对象logger的日志级别(INFO),因此,日志请求被拒绝了,我们得不到任何输出。同样的,针对第三行语句,我们可以很容易得出结论。

    在表1中有两个特殊的级别:ALL和OFF。ALL表示允许所有的日志请求。OFF是拒绝所有的请求。

    你也可以显式地检查Logger对象的Boolean属性,如下所示:

    if (logger.IsDebugEnabled)

    {

    Logger.Debug("message");

    }

    2.2 Repository

    Repository主要用于负责日志对象组织结构的维护。在log4net的以前版本中,框架仅支持分等级的组织结构(hierarchical organization)。这种等级结构本质上是库的一个实现,并且定义在log4net.Repository.Hierarchy 名字空间中。要实现一个Repository,需要实现log4net.Repository.ILoggerRepository 接口。但是通常并不是直接实现该接口,而是以log4net.Repository.LoggerRepositorySkeleton为基类继承。体系库 (hierarchical repository )则由log4net.Repository.Hierarchy.Hierarchy类实现。

    如果你是个log4net框架的使用者,而非扩展者,那么你几乎不会在你的代码里用到Repository的类。相反的,你需要用到LogManager类来自动管理库和日志对象。

    2.3 Appender

    一个好的日志框架应该能够产生多目的地的输出。比如说输出到控制台或保存到一个日志文件。log4net 能够很好的满足这些要求。它使用一个叫做Appender的组件来定义输出介质。正如名字所示,这些组件把它们附加到Logger日志组件上并将输出传递到输出流中。你可以把多个Appender组件附加到一个日志对象上。 Log4net框架提供了几个Appender组件。关于log4net提供的Appender组件的完整列表可以在log4net框架的帮助手册中找到。有了这些现成的Appender组件,一般来说你没有必要再自己编写了。但是如果你愿意,可以从log4net.Appender.AppenderSkeleton类继承。

    2.4 Appender Filters

    一个Appender 对象缺省地将所有的日志事件传递到输出流。Appender的过滤器(Appender Filters) 可以按照不同的标准过滤日志事件。在log4net.Filter的名字空间下已经有几个预定义的过滤器。使用这些过滤器,你可以按照日志级别范围过滤日志事件,或者按照某个特殊的字符串进行过滤。你可以在API的帮助文件中发现更多关于过滤器的信息。

    2.5 Layout

    Layout 组件用于向用户显示最后经过格式化的输出信息。输出信息可以以多种格式显示,主要依赖于我们采用的Layout组件类型。可以是线性的或一个XML文件。Layout组件和一个Appender组件一起工作。API帮助手册中有关于不同Layout组件的列表。一个Appender对象,只能对应一个Layout对象。要实现你自己的Layout类,你需要从log4net.Layout.LayoutSkeleton类继承,它实现了ILayout接口。

    3 在程序中使用log4net

    在开始对你的程序进行日志记录前,需要先启动log4net引擎。这意味着你需要先配置前面提到的三种组件。你可以用两种方法来设定配置:在单独的文件中设定配置或在代码中定义配置。

    因为下面几种原因,推荐在一个单独的文件中定义配置:

    l 你不需要重新编译源代码就能改变配置;

    l 你可以在程序正运行的时候就改变配置。这一点在一些WEB程序和远程过程调用的程序中有时很重要;

    考虑到第一种方法的重要性,我们先看看怎样在文件中设定配置信息。

    3.1 定义配置文件

    配置信息可以放在如下几种形式文件的一种中。

    在程序的配置文件里,如AssemblyName.config 或web.config.

    在你自己的文件里。文件名可以是任何你想要的名字,如AppName.exe.xyz等.

    log4net框架会在相对于AppDomain.CurrentDomain.BaseDirectory 属性定义的目录路径下查找配置文件。框架在配置文件里要查找的唯一标识是<log4net>标签。一个完整的配置文件的例子如下:

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

    <configSections>

    <section name="log4net"

    type="log4net.Config.Log4NetConfigurationSectionHandler,

    log4net-net-1.0"

    />

    </configSections>

    <log4net>

    <root>

    <level value="WARN" />

    <appender-ref ref="LogFileAppender" />

    <appender-ref ref="ConsoleAppender" />

    </root>

    <logger name="testApp.Logging">

    <level value="DEBUG"/>

    </logger>

    <appender name="LogFileAppender"

    type="log4net.Appender.FileAppender" >

    <param name="File" value="log-file.txt" />

    <param name="AppendToFile" value="true" />

    <layout type="log4net.Layout.PatternLayout">

    <param name="Header" value="[Header]\r\n"/>

    <param name="Footer" value="[Footer]\r\n"/>

    <param name="ConversionPattern"

    value="%d [%t] %-5p %c [%x] - %m%n"

    />

    </layout>

    <filter type="log4net.Filter.LevelRangeFilter">

    <param name="LevelMin" value="DEBUG" />

    <param name="LevelMax" value="WARN" />

    </filter>

    </appender>

    <appender name="ConsoleAppender"

    type="log4net.Appender.ConsoleAppender" >

    <layout type="log4net.Layout.PatternLayout">

    <param name="ConversionPattern"

    value="%d [%t] %-5p %c [%x] - %m%n"

    />

    </layout>

    </appender>

    </log4net>

    </configuration>

    你可以直接将上面的文本拷贝到任何程序中使用,但是最好还是能够理解配置文件是怎样构成的。 只有当你需要在应用程序配置文件中使用log4net配置时,才需要在<configSection>标签中加入<section>配置节点入口。对于其他的单独文件,只有<log4net>标签内的文本才是必需的,这些标签的顺序并不是固定的。下面我们依次讲解各个标签内文本的含义:

    3.1.1 <root>

    <root>

    <level value="WARN" />

    <appender-ref ref="LogFileAppender" />

    <appender-ref ref="ConsoleAppender" />

    </root>

    在框架的体系里,所有的日志对象都是根日志(root logger)的后代。 因此如果一个日志对象没有在配置文件里显式定义,则框架使用根日志中定义的属性。在<root>标签里,可以定义level级别值和Appender的列表。如果没有定义LEVEL的值,则缺省为DEBUG。可以通过<appender-ref>标签定义日志对象使用的Appender对象。<appender-ref>声明了在其他地方定义的Appender对象的一个引用。在一个logger对象中的设置会覆盖根日志的设置。而对Appender属性来说,子日志对象则会继承父日志对象的Appender列表。这种缺省的行为方式也可以通过显式地设定<logger>标签的additivity属性为false而改变。

    <logger name="testApp.Logging" additivity="false">

    </logger>

    Additivity的值缺省是true.

    3.1.2 <Logger>

    <logger name="testApp.Logging">

    <level value="DEBUG"/>

    </logger>

    <logger> 元素预定义了一个具体日志对象的设置。然后通过调用LogManager.GetLogger(“testAPP.Logging”)函数,你可以检索具有该名字的日志。如果LogManager.GetLogger(…)打开的不是预定义的日志对象,则该日志对象会继承根日志对象的属性。知道了这一点,我们可以说,其实<logger>标签并不是必须的。

    3.1.3 <appender>

    <appender name="LogFileAppender"

    type="log4net.Appender.FileAppender" >

    <param name="File" value="log-file.txt" />

    <param name="AppendToFile" value="true" />

    <layout type="log4net.Layout.PatternLayout">

    <param name="Header" value="[Header]\r\n" />

    <param name="Footer" value="[Footer]\r\n"/>

    <param name="ConversionPattern"

    value="%d [%t] %-5p %c - %m%n"

    />

    </layout>

    <filter type="log4net.Filter.LevelRangeFilter">

    <param name="LevelMin" value="DEBUG" />

    <param name="LevelMax" value="WARN" />

    </filter>

    </appender>

    在<root>标签或单个的<logger>标签里的Appender对象可以用<appender>标签定义。<appender>标签的基本形式如上面所示。它定义了appender的名字和类型。 另外比较重要的是<appender>标签内部的其他标签。不同的appender有不同的<param>标签。在这里,为了使用FileAppender,你需要一个文件名作为参数。另外还需要一个在<appender>标签内部定义一个Layout对象。Layout对象定义在它自己的<layout>标签内。<layout>标签的type属性定义了Layout的类型(在本例里是PatternLayout),同时也确定了需要提供的参数值。Header和Footer标签提供了一个日志会话(logging session)开始和结束时输出的文字。有关每种appender的具体配置的例子,可以在log4net\doc\manual\example-config-appender.html中得到。

    3.1.4 log4net.Layout.PatternLayout中的转换模式(ConversionPattern)

    %m(message):输出的日志消息,如ILog.Debug(…)输出的一条消息

    %n(new line):换行

    %d(datetime):输出当前语句运行的时刻

    %r(run time):输出程序从运行到执行到当前语句时消耗的毫秒数

    %t(thread id):当前语句所在的线程ID

    %p(priority): 日志的当前优先级别,即DEBUG、INFO、WARN…等

    %c(class):当前日志对象的名称,例如:

    模式字符串为:%-10c -%m%n

    代码为:

    ILog log=LogManager.GetLogger(“Exam.Log”);

    log.Debug(“Hello”);

    则输出为下面的形式:

    Exam.Log - Hello

    %L:输出语句所在的行号

    %F:输出语句所在的文件名

    %-数字:表示该项的最小长度,如果不够,则用空格填充

    例如,转换模式为%r [%t]%-5p %c - %m%n 的 PatternLayout 将生成类似于以下内容的输出:

    176 [main] INFO org.foo.Bar - Located nearest gas station.

    3.1.5 <filter>

    最后,让我们看看在Appender元素里的<filter>标签。它定义了应用到Appender对象的过滤器。本例中,我们使用了LevelRangeFilter过滤器,它可以只记录LevelMin和LevelMax参数指定的日志级别之间的日志事件。可以在一个Appender上定义多个过滤器(Filter),这些过滤器将会按照它们定义的顺序对日志事件进行过滤。其他过滤器的有关信息可以在log4net的SDK文档中找到。

    3.2 使用配置文件

    3.2.1 关联配置文件

    当我们创建了上面的配置文件后,我们接下来需要把它和我们的应用联系起来。缺省的,每个独立的可执行程序集都会定义它自己的配置。log4net框架使用 log4net.Config.DOMConfiguratorAttribute在程序集的级别上定义配置文件。

    例如:可以在项目的AssemblyInfo.cs文件里添加以下的语句

    [assembly:log4net.Config.DOMConfigurator(ConfigFile="filename",

    ConfigFileExtension="ext",Watch=true/false)]

    l ConfigFile:指出了我们的配置文件的路径及文件名,包括扩展名。

    l ConfigFileExtension:如果我们对被编译程序的程序集使用了不同的文件扩展名,那么我们需要定义这个属性,缺省的,程序集的配置文件扩展名为”config”。

    l Watch (Boolean属性): log4net框架用这个属性来确定是否需要在运行时监视文件的改变。如果这个属性为true,那么FileSystemWatcher将会被用来监视文件的改变,重命名,删除等事件。

    其中:ConfigFile和ConfigFileExtension属性不能同时使用,ConfigFile指出了配置文件的名字,例如,ConfigFile=”Config.txt”

    ConfigFileExtension则是指明了和可执行程序集同名的配置文件的扩展名,例如,应用程序的名称是”test.exe”,ConfigFileExtension=”txt”,则配置文件就应该是”test.exe.txt” ;

    也可以不带参数应用DOMConfiguratio():

    [assembly: log4net.Config.DOMConfigurator()]

    也可以在程序代码中用DOMConfigurator类打开配置文件。类的构造函数需要一个FileInfo对象作参数,以指出要打开的配置文件名。 这个方法和前面在程序集里设置属性打开一个配置文件的效果是一样的。

    log4net.Config.DOMConfigurator.Configure(

    new FileInfo("TestLogger.Exe.Config"));

    DOMConfigurator 类还有一个方法ConfigureAndWatch(..), 用来配置框架并检测文件的变化。

    以上的步骤总结了和配置相关的各个方面,下面我们将分两步来使用logger对象。

    3.2.2 创建或获取日志对象

    日志对象会使用在配置文件里定义的属性。如果某个日志对象没有事先在配置文件里定义,那么框架会根据继承结构获取祖先节点的属性,最终的,会从根日志获取属性。如下所示:

    Log4net.ILog log = Log4net.LogManager.GetLogger("MyLogger");

    3.2.3 输出日志信息

    可以使用ILog的几种方法输出日志信息。你也可以在调用某方法前先检查IsXXXEnabled布尔变量,再决定是否调用输出日志信息的函数,这样可以提高程序的性能。因为框架在调用如ILog.Debug(…)这样的函数时,也会先判断是否满足Level日志级别条件。

    if (log.IsDebugEnabled) log.Debug("message");

    if (log.IsInfoEnabled) log.Info("message);

    3.3 在程序中配置log4net

    除了前面讲的用一个配置文件来配置log4net以外,还可以在程序中用代码来配置log4net框架。如下面的例子:

    // 和PatternLayout一起使用FileAppender

    log4net.Config.BasicConfigurator.Configure(

    new log4net.Appender.FileAppender(

    new log4net.Layout.PatternLayout("%d

    [%t]%-5p %c [%x] - %m%n"),"testfile.log"));

    // using a FileAppender with an XMLLayout

    log4net.Config.BasicConfigurator.Configure(

    new log4net.Appender.FileAppender(

    new log4net.Layout.XMLLayout(),"testfile.xml"));

    // using a ConsoleAppender with a PatternLayout

    log4net.Config.BasicConfigurator.Configure(

    new log4net.Appender.ConsoleAppender(

    new log4net.Layout.PatternLayout("%d

    [%t] %-5p %c - %m%n")));

    // using a ConsoleAppender with a SimpleLayout

    log4net.Config.BasicConfigurator.Configure(

    new log4net.Appender.ConsoleAppender(new

    log4net.Layout.SimpleLayout()));

    尽管这里用代码配置log4net也很方便,但是你却不能分别配置每个日志对象。所有的这些配置都是被应用到根日志上的。

    log4net.Config.BasicConfigurator 类使用静态方法Configure 设置一个Appender 对象。而Appender的构造函数又会相应的要求Layout对象。你也可以不带参数直接调用BasicConfigurator.Configure(),它会使用一个缺省的PatternLayout对象,在一个ConsoleAppender中输出信息。如下所示:

    log4net.Config.BasicConfigurator.Configure();

    在输出时会显示如下格式的信息:

    0 [1688] DEBUG log1 A B C - Test

    20 [1688] INFO log1 A B C - Test

    当log4net框架被配置好以后,就可以如前所述使用日志功能了。

    4 总结

    使用log4net可以很方便地为应用添加日志功能。应用Log4net,使用者可以很精确地控制日志信息的输出,减少了多余信息,提高了日志记录性能。同时,通过外部配置文件,用户可以不用重新编译程序就能改变应用的日志行为,使得用户可以根据情况灵活地选择要记录的信息。