下午花了一个小时复习了一下以前培训的things,以前学的现在也用不到多少,为了不忘记,现在开始又要复习一下,都是写些简单地的程序。我的学习都是这样,从简单的东西然后慢慢的融汇到复杂的事情。嘿嘿,这个星期六和星期天实在不想做什么事情,就看了下以前下的一个关于测字的书,看上去好难。说不定哪天abap不会了,就出去给人家算命,给自己留条后路阿!哈哈!~
*&---------------------------------------------------------------------*
*& Report ZTESTWS3 *
*& *
*&---------------------------------------------------------------------*
REPORT ZTESTWS3.
**define data
TABLES: EKKO,
EKPO.
DATA MARK.
*DATA OK_CODE LIKE SY-UCOMM.
**define internal table it_ekko.
DATA: WA_EKKO TYPE EKKO,
IT_EKKO TYPE TABLE OF EKKO.
**DEFINE INTERNAL TABLE IT_EKPO
DATA: WA_EKPO TYPE EKPO,
IT_EKPO_READ TYPE TABLE OF EKPO,
IT_EKPO TYPE TABLE OF EKPO.
**selection-screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS S_EBELN FOR EKKO-EBELN.
SELECTION-SCREEN END OF BLOCK B1.
**start-of-selection
START-OF-SELECTION.
PERFORM GET_DATA_EKKO.
**end-of-selection
END-OF-SELECTION.
PERFORM DISPLAY_DATA_EKKO.
SET PF-STATUS 'STATUS_TBASE'.
SET TITLEBAR 'TITLE_TBASE'.
**at user-command
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'BOOK'.
REFRESH IT_EKKO.
DO.
READ LINE SY-INDEX FIELD VALUE MARK.
IF SY-SUBRC 0.
EXIT.
ENDIF.
CHECK NOT MARK IS INITIAL.
PERFORM GET_DATA_EKPO
USING WA_EKKO-EBELN
CHANGING IT_EKPO_READ.
APPEND LINES OF IT_EKPO_READ TO IT_EKPO.
ENDDO.
SORT IT_EKPO BY EBELN.
PERFORM DISPLAY_DATA_EKPO.
SET TITLEBAR 'TITLE_SBASE'.
SET PF-STATUS 'STATUS_SBASE'.
**SELECT ALL
WHEN 'SELECT'.
DO.
READ LINE SY-INDEX.
IF SY-SUBRC NE 0. EXIT. ENDIF.
MODIFY CURRENT LINE FIELD VALUE MARK FROM 'X'.
ENDDO.
**DESELECT ALL
WHEN 'DESELECT'.
DO.
READ LINE SY-INDEX.
IF SY-SUBRC NE 0. EXIT. ENDIF.
MODIFY CURRENT LINE FIELD VALUE MARK FROM SPACE.
ENDDO.
ENDCASE.
**TOP-OF-PAGE DURING LINE-SELECTION
TOP-OF-PAGE DURING LINE-SELECTION.
CASE SY-UCOMM.
WHEN 'BOOK'.
FORMAT COLOR COL_HEADING.
ULINE.
ENDCASE.
*&---------------------------------------------------------------------*
*& Form get_data_ekko
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM GET_DATA_EKKO .
SELECT *
INTO CORRESPONDING FIELDS OF TABLE IT_EKKO
FROM EKKO
WHERE EBELN IN S_EBELN.
ENDFORM. " get_data_ekko
*&---------------------------------------------------------------------*
*& Form display_data_ekko
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM DISPLAY_DATA_EKKO .
LOOP AT IT_EKKO INTO WA_EKKO.
WRITE: / MARK AS CHECKBOX,
WA_EKKO-EBELN,
WA_EKKO-BUKRS,
WA_EKKO-LIFNR,
WA_EKKO-AEDAT.
HIDE: WA_EKKO-EBELN.
ENDLOOP.
ENDFORM. " display_data_ekko
*&---------------------------------------------------------------------*
*& Form GET_DATA_EKPO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_EKKO_EBELN text
* *----------------------------------------------------------------------*
FORM GET_DATA_EKPO USING P_EBELN TYPE EKPO-EBELN
CHANGING P_EKPO LIKE IT_EKPO.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE P_EKPO
FROM EKPO
WHERE EBELN = P_EBELN.
ENDFORM. " GET_DATA_EKPO
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA_EKPO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
FORM DISPLAY_DATA_EKPO .
LOOP AT IT_EKPO INTO WA_EKPO.
WRITE: / WA_EKPO-EBELN,
WA_EKPO-EBELP,
WA_EKPO-AEDAT.
ENDLOOP.
ENDFORM. " DISPLAY_DATA_EKPO