๐ŸŽฉ ์ธํ„ฐ๋„ํ…Œ์ด๋ธ”์˜ HEADER

ํ™์˜ˆ๋ฆผยท2023๋…„ 7์›” 18์ผ
0

SAP ABAP(๊ฐœํŽธ์ค‘...)

๋ชฉ๋ก ๋ณด๊ธฐ
32/55
post-thumbnail

์‚ฌ์šฉ๋ฐฉ๋ฒ•

์ŠคํŠธ๋Ÿญ์ฒ˜ OCCURS 0.

DATA : BEGIN OF <gt_sflight> OCCURS 0,
        carrid    TYPE sflight-carrid,
        connid    TYPE sflight-connid,
       END OF <gt_sflight>.

OCCURS ๋Š” ์‹œ์Šคํ…œ ์‹คํ–‰ ํ™˜๊ฒฝ์—์„œ Internal Table ์˜ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค . 0์œผ๋กœ ํ‘œ์‹œํ•˜๋ฉด ๋ฉ”๋ชจ๋ฆฌ ์ œํ•œ์„ ๋‘์ง€ ์•Š๋Š”๋‹ค๋Š” ๋œป์œผ๋กœ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น์„ ์ตœ์†Œํ™”ํ•œ๋‹ค๋Š” ์˜๋ฏธ ์ž…๋‹ˆ๋‹ค . 0 ์ด์™ธ์˜ ์ˆซ์ž๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์œผ๋‚˜ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น์ด ๋ถ€์กฑํ•˜๋ฉด ์‹œ์Šคํ…œ์ด ์ž๋™์œผ๋กœ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ™•๋ณดํ•˜๋ฏ€๋กœ ๊ทธ๋ ‡๊ฒŒ ํฐ ์˜๋ฏธ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ OCCURS ๋ฅผ ์„ ์–ธํ•œ Intenal Table ์€ Standard ํ…Œ์ด๋ธ” ํ˜•ํƒœ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
[์ถœ์ฒ˜ : http://sapjoy.co.kr/abapqna/7518]

์ฐธ๊ณ  (๊ตฌ ์ฝ”๋“œ)

DATA : gt_data TYPE sflight OCCURS 0.  <" ํ—ค๋”๊ฐ€ ์—†๋Š” ์ธํ„ฐ๋„ํ…Œ์ด๋ธ” >

DATA : gt_data TYPE sflight OCCURS 0 WITH HEADER LINE,  <" ํ—ค๋”๊ฐ€ ์žˆ๋Š” ์ธํ„ฐ๋„ํ…Œ์ด๋ธ” >
       gt_temp LIKE gt_data OCCURS 0.  <" ํ—ค๋”๊ฐ€ ์—†๋Š” ์ธํ„ฐ๋„ํ…Œ์ด๋ธ” >

ํ…Œ์ด๋ธ” WITH HEADER LINE.

DATA : <gt_spfli> TYPE TABLE OF <spfli> WITH HEADER LINE.
  • ๋””๋ฒ„๊น…ํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ๊ฒฐ๊ณผ์ ์œผ๋กœ, ์œ„์˜ ๋‘ ๊ตฌ๋ฌธ ๋ชจ๋‘ ํ—ค๋”๋ฅผ ๊ฐ€์ง„ ์ธํ„ฐ๋„ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•œ๋‹ค.
    • OCCURS 0.WITH HEADER LINE.
      ๋Œ€์ƒStructureTable
      ์ƒ์„ฑBODYHEADER

ITAB ์„ ์–ธ ์˜ˆ์‹œ

DATA : BEGIN OF gs_vbap,
        vbeln TYPE vbak-vbeln,
        angdt TYPE vbak-angdt,
        vbtyp TYPE vbak-vbtyp,
        matwa TYPE vbap-matwa,
        arktx TYPE vbap-arktx.
        INCLUDE STRUCTURE tds_sd_prodh_univ_node.
        INCLUDE STRUCTURE j_1bsd_tc_det.
DATA :  zmeng TYPE vbap-zmeng,
        meins TYPE vbap-meins,
       END OF gs_vbap,

       <gt_vbap> LIKE TABLE OF <gs_vbap> WITH HEADER LINE.

INTO, FROM ์ƒ๋žต

LOOP AT <gt_sflight>. "---> INTO ์ƒ๋žต
  gv_tabix = sy-tabix.

  CASE gt_sflight-planetype.
    WHEN 'A340-600'.
      gt_sflight-planetype = 'A380'.

      MODIFY <gt_sflight> INDEX <gv_tabix> "---> FROM ์ƒ๋žต
      TRANSPORTING <planetype>.
  ENDCASE.

ENDLOOP.

LOOP AT / READ TABLE ์—์„œ INTO ์ƒ๋žต

  • LOOP AT/READ TABLE ํ…Œ์ด๋ธ” INTO WA INDEX gv_tabix
  • INTO ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์›Œํฌ์—์–ด๋ฆฌ์–ด(์ŠคํŠธ๋Ÿญ์ฒ˜)์— ๋‹ด์•„์ฃผ์–ด์•ผ ํ–ˆ์ง€๋งŒ,
    ํ—ค๋”๋ฅผ ๊ฐ€์ง„ ITAB์€ ์ŠคํŠธ๋Ÿญ์ฒ˜(ํ—ค๋”)๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— INTO ๋ฅผ ์ƒ๋žตํ•œ๋‹ค.

APPEND์—์„œ TO ์ƒ๋žต / MODIFY ์—์„œ FROM ์ƒ๋žต

  • ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜จ ๊ณณ๊ณผ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๋Š” ๊ณณ์ด ๊ฐ™์œผ๋ฏ€๋กœ, ์œ„์น˜๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” TO์™€ FROM์„ ์ƒ๋žตํ•œ๋‹ค.
DATA : BEGIN OF gs_data,
         vbeln TYPE lips-vbeln,
         posnr TYPE lips-posnr,
         pstyv TYPE lips-pstyv,
         matnr TYPE lips-matnr,
         matwa TYPE lips-matwa,
         matkl TYPE lips-matkl,
       END OF gs_data,

       gt_data  LIKE TABLE OF gs_data WITH HEADER LINE,
       lv_tabix TYPE sy-tabix.

CLEAR : gt_data, gt_data[].

	gt_data-vbeln = '1000000001'.
	gt_data-posnr = 10.
	gt_data-pstyv = 'ADP1'.
	gt_data-matnr = 'T-RSP512'.
	gt_data-matwa = 'ST_10'.
	gt_data-matkl = '01'.

APPEND gt_data.
CLEAR gt_data.

CLEAR๋กœ ์ดˆ๊ธฐํ™”

ํ—ค๋”์™€ ๋ฐ”๋””๋ฅผ ๊ฐ๊ฐ ์ดˆ๊ธฐํ™”

CLEAR : gt_spfli, gt_spfli[], gt_mat, gt_mat[].
  • CLEAR๋Š” ๋ชจ๋“  ๋Œ€์ƒ์„ ์ดˆ๊ธฐํ™”ํ•œ๋‹ค.
  • REFRESH๋Š” ์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”, ์ฆ‰ ๋ฐ”๋”” ์ „์šฉ ์ดˆ๊ธฐํ™” ์ฝ”๋“œ์ด๋‹ค.
    • ๋”ฐ๋ผ์„œ ํ—ค๋”(์ŠคํŠธ๋Ÿญ์ฒ˜)๋Š” ์ดˆ๊ธฐํ™”ํ•˜์ง€ ๋ชปํ•œ๋‹ค.

๋ฐ”๋””๋ฅผ CLEARํ•˜๋ฉด ๋ฐ์ดํ„ฐ๊ฐ€ ์ง€์›Œ์ง„๋‹ค.

  • LOOP๋ฌธ์—์„œ APPEND/MODIFY ํ›„ ํด๋ฆฌ์–ด ํ•  ๋•Œ๋Š” ์ŠคํŠธ๋Ÿญ์ฒ˜(=ํ—ค๋”)๋งŒ ์ฒญ์†Œํ•œ๋‹ค.
APPEND : gt_spfli, gt_mat.
CLEAR  : gt_spfli, gt_mat.

SELECT-OPTIONS์€ ITAB

  • ์…€๋ ‰ํŠธ์˜ต์…˜์€ ํ—ค๋”๋กœ SIGN OPTION LOW HIGH๋ฅผ ๊ฐ€์ง„๋‹ค.
REPORT zc525lr0001 MESSAGE-ID zc5m25.

TABLES : sflight.

SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
  PARAMETERS     : pa_carr TYPE sflight-carrid.
  SELECT-OPTIONS : so_conn FOR  sflight-connid.
SELECTION-SCREEN END OF BLOCK bl1.

INITIALIZATION. <" ์ดˆ๊ธฐ๊ฐ’ ์„ค์ • *>
  pa_carr = 'AA'.

<* ์…€๋ ‰์…˜ ์Šคํฌ๋ฆฐ์€ ํ—ค๋”๋ฅผ ๊ฐ€์ง„ ์ธํ„ฐ๋„ํ…Œ์ด๋ธ”์ด๋‹ค. *>
<* ๋”ฐ๋ผ์„œ ์›Œํฌ์—์–ด๋ฆฌ์–ด๋ฅผ ์„ ์–ธํ•˜์ง€ ์•Š์•„๋„, ์ด๋ฏธ ์›Œํฌ์—์–ด๋ฆฌ์–ด๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค. *>
<* so_conn ์€ ํ—ค๋”, so_conn[] ์€ ๋ฐ”๋””๋ฅผ ์˜๋ฏธํ•œ๋‹ค. *>

  so_conn-sign   = 'I'. " include *
  so_conn-option = 'EQ'.
  so_conn-low    = '0017'.

  APPEND so_conn. <" ํ—ค๋”๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ... APPEND so_conn to so_conn[]. ๋ฅผ ์˜๋ฏธํ•œ๋‹ค.>

profile
SYNC 3๊ธฐ 5๋ฐ˜ 2023.07 - 2023.12

1๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2023๋…„ 7์›” 18์ผ

์ž˜ ์ฝ์—ˆ์Šต๋‹ˆ๋‹ค. ์ข‹์€ ์ •๋ณด ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ