2011年4月8日 星期五

[Link] MassDownload


News: 2012/03/11 Mass Download Program version update to 1.5.1
Mass Download is the successor to Direct Download, the same basic idea but with a totally new code base. The program has all the same features as before but has been updated to take advantage off some of the new features and changes that have arrived in the latest version of SAP.

Change document

customer master object: (Block customer):
TABLE       CDHDR/CDPOS
OBJECTCLAS  = DEBI
OBJECTID    = <Customer number>
TCODE       = VD05

OBJECTCLAS

可以由底下 Table 取得:
SWECDOBTYP  指派更改文件 / 工作流程物件類型
TCDOB       變更文件建立的物件
FUNCTION C14O_CH_DOC_OBJ_NAME_GET:
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       IMPORTING
*"             VALUE(I_TABLENAME) TYPE  ESP1_TAB_NAME
*"       EXPORTING
*"             VALUE(E_OBJ_NAME) LIKE  TCDOB-OBJECT
*"       EXCEPTIONS
*"              ILLEGAL_INPUT<
*"              CHNG_DOC_OBJ_NOT_FOUND
*"----------------------------------------------------------------------
CDNAMES_GET
Transport Chnge doc.obj. via shadow tab.

訂單文件修改查詢

範例程式:RVSCD100:
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
  EXPORTING
    DATE_OF_CHANGE    = CDHDR-UDATE
    OBJECTCLASS       = CDHDR-OBJECTCLAS
    OBJECTID          = CDHDR-OBJECTID
    TIME_OF_CHANGE    = CDHDR-UTIME
    USERNAME          = CDHDR-USERNAME
  TABLES
    I_CDHDR           = ICDHDR
  EXCEPTIONS
    NO_POSITION_FOUND = 1
    OTHERS            = 2.

CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
  EXPORTING
    CHANGENUMBER      = ICDHDR-CHANGENR
    TABLEKEY          = CDPOS-TABKEY
    TABLENAME         = CDPOS-TABNAME
  IMPORTING
    HEADER            = CDHDR
  TABLES
    EDITPOS           = ICDSHW
  EXCEPTIONS
    NO_POSITION_FOUND = 1
    OTHERS            = 2.

[Func] SD_CONDITION_TIME_INTERVAL_GET

依照篩選條件取回日期區間內生效的價格條件
FUNCTION SD_CONDITION_TIME_INTERVAL_GET :
CALL FUNCTION 'SD_CONDITION_TIME_INTERVAL_GET'
    EXPORTING
      VALUE(KOMG_I)             LIKE  KOMG STRUCTURE  KOMG OPTIONAL
      VALUE(KOMK_I)             LIKE  KOMK STRUCTURE  KOMK OPTIONAL
      VALUE(KOMP_I)             LIKE  KOMP STRUCTURE  KOMP OPTIONAL
      VALUE(DATVO_I)            LIKE  A000-DATAB
      VALUE(DATBI_I)            LIKE  A000-DATBI
      VALUE(KVEWE_I)            LIKE  T681V-KVEWE DEFAULT 'A'
      VALUE(KAPPL_I)            LIKE  T681A-KAPPL DEFAULT 'V '
      VALUE(KOMK_KOMP_FIELDS_I) LIKE  SY-MARKY DEFAULT ' '
    TABLES
      PERIODS_TAB               STRUCTURE  WPPERIOD
      KSCHL_TAB                 STRUCTURE  WPKSCHL
    EXCEPTIONS
      NO_CONDITIONS.
Example:
KOMG-VKORG = P_VKORG.
      KOMG-VTWEG = P_VTWEG.
      KOMG-MATNR = IMATNR-MATNR.
      KOMG-KUNNR = IKUNNR-KUNNR.
      CALL FUNCTION 'SD_CONDITION_TIME_INTERVAL_GET'
        EXPORTING
          KOMG_I      = KOMG
          DATVO_I     = S_DATAB-LOW
          DATBI_I     = S_DATAB-HIGH
        TABLES
          PERIODS_TAB = GT_PREDATE
          KSCHL_TAB   = GT_TKSCH
        EXCEPTIONS
          OTHERS      = 1.
      READ TABLE GT_PREDATE INDEX 1.
      CHECK SY-SUBRC = 0.
      LOOP AT GT_PREDATE.
        GT_ITAB-MATNR   = IMATNR-MATNR.
        GT_ITAB-KUNNR   = IKUNNR-KUNNR.
        GT_ITAB-NAME1   = IKUNNR-NAME1.
        GT_ITAB-KOTABNR = GT_PREDATE-KOTABNR.
        GT_ITAB-VTWEG   = P_VTWEG.
        GT_ITAB-KSCHL   = P_KSCHL.
        GT_ITAB-DATAB   = GT_PREDATE-DATAB.
        GT_ITAB-DATBI   = GT_PREDATE-DATBI.
        SELECT SINGLE H~ERNAM H~ERDAT P~KBETR
            INTO (GT_ITAB-ERNAM, GT_ITAB-ERDAT,GT_ITAB-KBETR)
            FROM KONH AS H
            JOIN KONP AS P
              ON P~KNUMH = H~KNUMH
           WHERE H~KNUMH = GT_PREDATE-KNUMH.
        APPEND GT_ITAB.
        LT_DD02T-KOTABNR = GT_PREDATE-KOTABNR.
        APPEND LT_DD02T.
      ENDLOOP.

[Code] Abap list Total Pages

如何印出 [ 頁次/總頁數 ] 的樣式呢?
在每一頁的表頭上,總頁數先用特別的字串代表,特別的字串必須不會與其他的字串重複,以免後面要取代時會有失誤。
假設表頭總頁數的代表字串是 '----' ,取代的程式如下,在列印工作完成之後:
   WRITE SY-PAGNO TO TO_PAGE LEFT-JUSTIFIED.
   DO SY-PAGNO TIMES.
      READ LINE 3 OF PAGE SY-INDEX.
      REPLACE '----' WITH TO_PAGE INTO SY-LISEL.
      MODIFY CURRENT LINE.
   ENDDO.

Passing data from one ABAP program to another

1. You have to define an internal table ITAB in program AAA. 
2. In the program AAA you export your ITAB to the memory. 
    EXPORT ITAB TO MEMORY ID 'TD' (ID is the name of memory, you don't need to create it ). 
3. In program BBB you have to declare The same table (same table's name and same fields). 
4. In BBB you can import ITAB : 
    IMPORT ITAB FROM MEMORY ID 'TD' 
5. Now you can export it to AAA after modifications. 
    EXPORT ITAB TO MEMORY ID 'TD'
6. In AAA : 
    IMPORT ITAB FROM MEMORY ID 'TD'
This solution is independant to SUBMIT. 
 
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.sap-img.com/ab020.htm

2011年3月31日 星期四

The Unit Conversion of Layout Set

The following conversion factors apply

Units of measurement: The following units of measurement may be used:

  • TW (twip)
  • PT (point)
  • IN (inch)
  • MM (millimeter)
  • CM (centimeter)
  • LN (line)
  • CH (character).

The following conversion factors apply:

  • 1 TW = 1/20 PT
  • 1 PT = 1/72 IN
  • 1 IN = 2.54 CM
  • 1 CM = 10 MM
  • 1 CH = height of a character relative to the CPI specification in the form header
  • 1 LN = height of a line relative to the LPI specification in the form header

System Bar Code and using it in SAPscript

A documentation on creating System Bar Code and using it in SAPscript layout for printing.

[Link] Smartforms - FAQ

Smartforms: Frequently Asked Questions

[Link] SAPScripts - FAQ

SAPScripts: Frequently Asked Questions

[Manual] Application Platform

SAP Web Application Server provides a complete development infrastructure on which you can develop, distribute, and execute platform-independent, robust, and scalable Web services and business applications. SAP Web Application Server supports ABAP, Java, and Web services.

COOIS 的報表


COOIS 裡面 submit 到底下這些報表:

PPIOA000                       訂單資訊系統﹕初始報表
PPIOB000                       訂單資訊系統﹕撿貨報表
PPIOC000                       訂單資訊系統﹕選擇報表
PPIOD000                       訂單資訊系統﹕詳細的清單報表 - 物料異動
PPIOE000                       訂單資訊系統﹕細節清單報表 - 觸發點
PPIOF000                       訂單資訊系統﹕PRT 明細清單報表
PPIOG000                       訂單資訊系統﹕自動貨物移動的明細清單報表
PPIOH000                       訂單資訊系統﹕訂單表頭的明細清單報表
PPIOI000                        訂單資訊系統﹕項目的明細清單報表
PPIOK000                       訂單資訊系統﹕產能明細清單報表
PPIOM000                       訂單資訊系統﹕元件的明細清單報表
PPIOO000                       訂單資訊系統﹕作業的明細清單報表
PPIOR000                       訂單資訊系統﹕確認的明細清單報表
PPIOS000                       訂單資訊系統﹕順序的明細清單報表
PPIOW000                      訂單資訊系統﹕錯誤貨物移動的明細清單報表

Enhance standard SM30 table maintain screen and flow


How to enhance standard SM30 table maintain screen and flow.
We known the SE11 can create table maintain screen, but the screen maybe too small, or maybe we did like to fulfill value to some fields automatically. If required you can follow these steps:
1:
If you propose to include extend fields from other table in the screen , and your table didn't store the value. ex., you only store customer number(KUNNR) but no customer name(NAME1). Then you need to create maintenance view.
Before you create maintenance view, don't forget to create foreign key to link your add-on table field and external table. ex., in case was customer number field(KUNNR) v.s KNA1.
2:
You can to go to create maintenance view use your add-on table as primary table. When you want to add other table into your maintenance view, you can do that in Tables/Join conditions tab page.
Place the cursor on the primary table and choose Relationships below. All existing foreign key relationships of the primary table are displayed. Select the required foreign key and choose Copy.
The secondary table used in such a foreign key is included in the view. The join conditions derived from the foreign keys are displayed.
3:
When you completed above actions, now you can create the maintenance view's maintain screen. At menu:
Unitilies-&gt;Table Maintenance Generator
4:
[ To be continue ... ]

SE16 Delete All


How can you to delete all records that whats you selected in se16 when that table disable maintenance ?
Follow the steps:
  1. Fulfill selection criteria of se16.
  2. Entry debug mode ( /h )
  3. Set break-point:
    • Subroutine: pf_status_liste
    • Subroutine:autho_check
  4. Set watch-point:
    • excl_tab-code = DEL5, DEL2
      • DEL5: Delete ALL
      • DEL2: Delete
    • dd02l-mainflag
  5. Press [F8] to Run program
  6. Delete records for internal table excl_tab what code eq DEL5 and DEL2 When got watchpoint, than can enable Delete ALL & Delete in menu item.
  7. Press [F8] to go.
  8. List records what match your criteria, then press select all 
  9. And entry debug mode (/h)
  10. Press [F8] to go.
  11. Modify the field dd02l-mainflag = ANYTHING to replace of space when you got break-point.

Comparing two ABAP Program


How to comparing two ABAP programs and show you the differences in both ABAP.

Transaction SE39 will do this.