일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- sapa
- 유닉스
- Java
- Smart Forms
- 가계부
- UTF-8
- 머니플랜
- EUC-kr
- 오라클 함수
- Enhancement
- 동적 쿼리
- 이명박
- SAP
- Standard Function
- ole
- EXIT
- 엑소버드
- badi
- alv 정형화
- 스마트폼
- KOSA
- function
- ALV
- FI 용어정리
- fi
- gimp
- ABAP
- 방화벽
- selection screen
- List box
- Today
- Total
Drunken Lion
GENERATE SUBROUTINE POOL 본문
Example
Dynamic creation and generation of a subroutine pool that implements the event block LOAD-OF-PROGRAM and two subroutines. Depending on the return value sy-subrc, a subroutine is called or a message is issued.
DATA: prog TYPE
string,
tab TYPE STANDARD TABLE OF string,
mess TYPE
string,
sid TYPE string.
APPEND 'PROGRAM
subpool.' TO tab.
APPEND `DATA spfli_tab TYPE TABLE
OF spfli.` TO tab.
APPEND `LOAD-OF-PROGRAM.` TO
tab.
APPEND ` SELECT *` &
` FROM spfli` &
` INTO TABLE spfli_tab.` TO tab.
APPEND `FORM
loop_at_tab.` TO tab.
APPEND ` DATA spfli_wa TYPE
spfli.` TO tab.
APPEND ` LOOP AT spfli_tab INTO
spfli_wa.` TO tab.
APPEND ` PERFORM evaluate_wa USING spfli_wa.` TO
tab.
APPEND ` ENDLOOP.` TO tab.
APPEND
`ENDFORM.` TO tab.
APPEND `FORM evaluate_wa
USING l_wa TYPE spfli.` TO tab.
APPEND ` WRITE: / l_wa-carrid,
l_wa-connid.` TO tab.
APPEND `ENDFORM.` TO
tab.
GENERATE SUBROUTINE POOL tab NAME prog
MESSAGE mess
SHORTDUMP-ID sid.
IF sy-subrc = 0.
PERFORM
('LOOP_AT_TAB') IN PROGRAM (prog) IF FOUND.
ELSEIF sy-subrc = 4.
MESSAGE mess TYPE 'I'.
ELSEIF sy-subrc = 8.
MESSAGE sid TYPE
'I'.
ENDIF.
Example
Dynamic creation and generation of a subroutine pool that implements a local class. The static method meth of the class can be called with the absolute type name of the class.
DATA itab TYPE
TABLE OF string.
DATA prog TYPE string.
DATA class TYPE string.
APPEND `program.` TO itab.
APPEND `class main
definition.` TO itab.
APPEND ` public section.` TO itab.
APPEND ` class-methods meth.` TO itab.
APPEND `endclass.`
TO itab.
APPEND `class main implementation.` TO itab.
APPEND ` method meth.` TO itab.
APPEND ` message
'Test' type 'I'.` TO itab.
APPEND ` endmethod.` TO itab.
APPEND `endclass.` TO itab.
GENERATE SUBROUTINE
POOL itab NAME prog.
CONCATENATE `\PROGRAM=` prog `\CLASS=MAIN` INTO
class.
CALL METHOD (class)=>meth.
Example
Dynamic creation and generation of a subroutine pool that implements a local class. The class is instanced with its absolute type name, and the instance method meth is called dynamically.
DATA itab TYPE
TABLE OF string.
DATA prog TYPE string.
DATA class TYPE string.
DATA oref TYPE REF TO object.
APPEND `program.`
TO itab.
APPEND `class main definition.` TO itab.
APPEND ` public
section.` TO itab.
APPEND ` methods meth.` TO itab.
APPEND `endclass.` TO itab.
APPEND `class main
implementation.` TO itab.
APPEND ` method meth.` TO itab.
APPEND ` message 'Test' type 'I'.` TO itab.
APPEND ` endmethod.`
TO itab.
APPEND `endclass.` TO itab.
GENERATE SUBROUTINE POOL itab NAME prog.
CONCATENATE `\PROGRAM=`
prog `\CLASS=MAIN` INTO class.
CREATE OBJECT oref TYPE (class).
CALL METHOD oref->('METH').
Exceptions
Catchable Exceptions
- Cause: A further temporary
subroutine pool can be generated.
Runtime Error: GENERATE_SUBPOOL_DIR_FULL (catchable)
- Cause: The source code is in a table
consisting of strings that contains rows with more than 255 characters.
Runtime Error: GEN_SOURCE_TOO_WIDE
'SAP > ABAP' 카테고리의 다른 글
[WDA] WEB DYNPRO 에서 Dropdown 만들기 (0) | 2012.06.07 |
---|---|
이벤트를 이용한 back job 실행 (0) | 2012.04.09 |
세무서 제출용 양식에 공백 처리 (1) | 2012.02.24 |
ALV 에서 SY-UCOMM 발생 시키기 (0) | 2012.02.16 |
CL_GOS_SERVICE_TOOLS (0) | 2011.11.23 |