ABAP指標field symbol!
例: 頑張れ
*&---------------------------------------------------------------------*
*& Report X *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT X.
*
TYPES: gts_str TYPE STRING.
DATA: gdt_str TYPE TABLE OF gts_str.
DATA: gds_str TYPE gts_str.
DATA: gdf_str TYPE STRING.
*
DATA: gdt_DD02L TYPE TABLE OF DD02L.
DATA: gds_DD02L TYPE TABLE OF DD02L.
* フィールドシンボル定義
FIELD-SYMBOLS:
DATA: v_flienm(40).
DATA: wa_str TYPE STRING.
DATA: it_str TYPE TABLE OF STRING.
* APPEND 'TYPE = ''TR'' AND OKFLAG = ''U''' TO it_options_usobx.
*&---------------------------------------------------------------------*
*& Event START-OF-SELECTION <主処理>
*&---------------------------------------------------------------------*
START-OF-SELECTION.
************************************************************************
* PERFORM SUB_SET_SEPARATOR_XXX.
* PERFORM X_A_TEST.
PERFORM X_B_TEST.
*&---------------------------------------------------------------------*
*& Form X_B_TEST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM X_B_TEST .
DATA: v_buf(10000).
* DESCRIBE TABLE
ASSIGN v_buf TO
SELECT * FROM DD02L UP TO 10 ROWS
INTO
WRITE: /
APPEND
ENDSELECT.
ENDFORM. " X_B_TEST
*&---------------------------------------------------------------------*
*& Form X_A_TEST
*&---------------------------------------------------------------------*
FORM X_A_TEST .
DATA: v_buf(10000).
* DESCRIBE TABLE
ASSIGN v_buf TO
SELECT * FROM DD02L UP TO 10 ROWS
INTO
WRITE: /
ENDSELECT.
*
SKIP.
ASSIGN COMPONENT v_buf OF STRUCTURE gds_DD02L TO
SELECT * FROM DD02L UP TO 10 ROWS
INTO
WRITE: /
ENDSELECT.
SKIP.
ASSIGN v_buf TO
SELECT * FROM DD03L UP TO 10 ROWS
INTO
WRITE: /
ENDSELECT.
ENDFORM. " X_A_TEST
*&---------------------------------------------------------------------*
*& Form SUB_SET_SEPARATOR
*&---------------------------------------------------------------------*
* 構造を渡すと、專案間にセパレーターをセットして、1專案で返す
*----------------------------------------------------------------------*
FORM SUB_SET_SEPARATOR_XXX.
DATA: V_DATA(30000).
DATA: V_TABNAME LIKE DD02L-TABNAME VALUE 'T001W'.
DATA: V_CHAR72 LIKE RFC_DB_OPT.
FIELD-SYMBOLS:
ASSIGN V_DATA TO
IF V_CHAR72 IS INITIAL.
SELECT * FROM (V_TABNAME) INTO
WRITE V_DATA.
ENDSELECT.
ELSE.
SELECT * FROM (V_TABNAME) INTO
WRITE V_DATA.
ENDSELECT.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SUB_SET_SEPARATOR
*&---------------------------------------------------------------------*
* 構造を渡すと、專案間にセパレーターをセットして、1專案で返す
*----------------------------------------------------------------------*
* -->U_STR 構造
* -->U_SEPARATOR 區切り文字
* *----------------------------------------------------------------------*
FORM SUB_SET_SEPARATOR USING U_STR
U_SEPARATOR
CHANGING C_RET.
FIELD-SYMBOLS:
DATA LDF_WORK(512) TYPE C.
DATA LDF_INDEX LIKE SY-INDEX.
* DATA LDF_LEN TYPE I.
CLEAR SY-INDEX.
CLEAR C_RET.
UNASSIGN
DO 1000 TIMES.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE U_STR TO
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
* LDF_LEN = STRLEN(
* DESCRIBE FIELD
* LDF_WORK =
LDF_WORK =
* CONDENSE LDF_WORK. " 空白削除
LDF_INDEX = SY-INDEX + 1.
ASSIGN COMPONENT LDF_INDEX OF STRUCTURE U_STR TO
IF SY-SUBRC = 0.
CONCATENATE C_RET LDF_WORK U_SEPARATOR INTO C_RET.
* SEPARATED BY U_SEPARATOR.
ELSE.
" 最終行にはセパレータはセットしない
CONCATENATE C_RET LDF_WORK INTO C_RET.
ENDIF.
ENDDO.
ENDFORM. " SUB_SET_SEPARATOR
*&---------------------------------------------------------------------*
*& Form SUB_SET_SEPARATOR_TAB
*&---------------------------------------------------------------------*
* 構造を渡すと、專案間に TABをセットして、1專案で返す
*----------------------------------------------------------------------*
* -->U_STR 構造
* *----------------------------------------------------------------------*
FORM SUB_SET_SEPARATOR_TAB USING U_STR
CHANGING C_RET TYPE C.
FIELD-SYMBOLS:
DATA LDF_WORK(100) TYPE C.
DATA LDF_INDEX LIKE SY-INDEX.
* DATA LDF_LEN TYPE I.
CLEAR SY-INDEX.
CLEAR C_RET.
UNASSIGN
DO 1000 TIMES.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE U_STR TO
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
* LDF_LEN = STRLEN(
* DESCRIBE FIELD
* LDF_WORK =
LDF_WORK =
CONDENSE LDF_WORK. " 空白削除
LDF_INDEX = SY-INDEX + 1.
ASSIGN COMPONENT LDF_INDEX OF STRUCTURE U_STR TO
IF SY-SUBRC = 0.
CONCATENATE C_RET
LDF_WORK
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO C_RET.
* SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
ELSE.
" 最終行にはセパレータはセットしない
CONCATENATE C_RET LDF_WORK INTO C_RET.
ENDIF.
ENDDO.
ENDFORM. " SUB_SET_SEPARATOR_TAB
**********************************************************
來個簡單的,比較容易理解的
types: begin of t_date ,
year(4) type n ,
month(2) type n ,
day(2) type n ,
end of t_date .
field-symbols:
assign l_first_day to
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8356764/viewspace-967715/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Javascript] Symbol vs Symbol.forJavaScriptSymbol
- 詳解c++指標的指標和指標的引用C++指標
- C語言指標(三):陣列指標和字串指標C語言指標陣列字串
- 陣列指標,指標陣列陣列指標
- 指標指標
- SymbolSymbol
- 指標陣列與陣列指標指標陣列
- 指標函式 和 函式指標指標函式
- dedeCMS標籤[field:typedir/]中{cmspath}的去除辦法
- 第 10 節:複合型別-5. 指標 -- 指標與指標變數 -8. 多級指標型別指標變數
- C指標原理(14)-C指標基礎指標
- C指標原理(15)-C指標基礎指標
- 指標常量和常量指標的區別指標
- psql: symbol lookup error: ./psql: undefined symbol: PQsetErrorContextVisibilitySQLSymbolErrorUndefinedContext
- isa指標指標
- 姜指標指標
- MACD指標Mac指標
- GO 指標Go指標
- golang指標Golang指標
- 雙指標指標
- HCBOLL指標指標
- 智慧指標指標
- C | 指標指標
- JavaScript SymbolJavaScriptSymbol
- Go 陣列指標(指向陣列的指標)Go陣列指標
- jmeter軟體指標和硬體指標(16.5)JMeter指標
- 智慧指標之手撕共享指標shared_ptr指標
- C與指標 第六章 指標指標
- C語言指標(二) 指標變數 ----by xhxhC語言指標變數
- C語言重點——指標篇(一文讓你完全搞懂指標)| 從記憶體理解指標 | 指標完全解析C語言指標記憶體
- ABAP 資料結構啟用時的錯誤訊息 - combination reference table field does not exist資料結構
- 比如,一級指標、二級指標等,通過不同層級的指標資料指標
- [BUG反饋]前臺呼叫標籤,field的值 field="id,title,description" 只能讀取'id',其它的不能用
- 野指標定位指標
- 指標的用法指標
- 陣列指標陣列指標
- 指標與const指標
- 防止空指標指標
- 雙指標法指標