REPORT z19_01.
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm.
DATA: init,
container TYPE REF TO cl_gui_custom_container,
editor TYPE REF TO cl_gui_textedit.
TYPES: g_text_t(72) TYPE c OCCURS 0.
DATA: g_header LIKE thead,
g_lines TYPE tline OCCURS 0 WITH HEADER LINE,
text_table TYPE g_text_t,
modi TYPE i,
g_number(8).
TABLES: stxh.
PARAMETERS p_carrid TYPE sflight-carrid OBLIGATORY.
START-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
IF init IS INITIAL.
init = 'X'.
CREATE OBJECT: container EXPORTING container_name = 'TEXTEDIT',
editor EXPORTING parent = container.
g_header-tdobject = 'ZSFLIGHT'.
g_header-tdid = 'Z01'.
g_header-tdspras = sy-langu.
SELECT SINGLE tdname INTO g_header-tdname
FROM zcarrlt
WHERE carrid = p_carrid.
IF sy-subrc EQ 0.
PERFORM read_text.
ELSE.
PERFORM text_init.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
* save_ok = ok_code.
* CLEAR ok_code.
* CASE save_ok.
* WHEN 'INSERT'.
* CALL METHOD editor->get_text_as_stream
* IMPORTING
* text = text_tab.
* WHEN 'F1'.
* MESSAGE i888(sabapdocu) WITH text-001.
* WHEN OTHERS.
* MESSAGE i888(sabapdocu) WITH text-002.
* CALL METHOD cl_gui_cfw=>dispatch. "for application events
* MESSAGE i888(sabapdocu) WITH text-003.
* ENDCASE.
* SET SCREEN 100.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
LEAVE TO SCREEN 0.
WHEN 'SAVE'.
PERFORM save_text.
PERFORM save_table.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form TEXT_INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM text_init .
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '1'
object = 'ZABAP'
subobject = p_carrid "'AA'
quantity = '1'
IMPORTING
number = g_number
EXCEPTIONS
interval_not_found = 1
number_range_not_intern = 2
object_not_found = 3
quantity_is_0 = 4
quantity_is_not_1 = 5
interval_overflow = 6
buffer_overflow = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
CONCATENATE g_header-tdobject g_header-tdid g_number
INTO g_header-tdname.
CALL FUNCTION 'INIT_TEXT'
EXPORTING
id = g_header-tdid
language = sy-langu
name = g_header-tdname
object = g_header-tdobject
IMPORTING
header = g_header
TABLES
lines = g_lines.
ENDFORM. " TEXT_INIT
*&---------------------------------------------------------------------*
*& Form SAVE_TEXT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM save_text .
CALL METHOD editor->get_text_as_stream
IMPORTING
text = text_table
is_modified = modi
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
IF NOT text_table[] IS INITIAL.
g_lines[] = text_table[].
CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
TABLES
text_stream = text_table
itf_text = g_lines.
*
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = g_header
* INSERT = 'X'
IMPORTING
newheader = g_header
TABLES
lines = g_lines
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
ENDIF.
IF sy-subrc NE 0.
*MESSAGE e001 WITH 'Error occurred when saving'.
EXIT.
ENDIF.
ENDFORM. " SAVE_TEXT
*&---------------------------------------------------------------------*
*& Form SAVE_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM save_table .
DATA : ls_tab LIKE zcarrlt.
ls_tab-carrid = p_carrid.
ls_tab-tdname = g_header-tdname.
MODIFY zcarrlt FROM ls_tab.
IF sy-subrc EQ 0.
COMMIT WORK.
ENDIF.
ENDFORM. " SAVE_TABLE
*&---------------------------------------------------------------------*
*& Form READ_TEXT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_text .
DATA : l_lines TYPE tline.
SELECT SINGLE * FROM stxh INTO stxh
WHERE tdobject = g_header-tdobject
AND tdname = g_header-tdname
AND tdid = g_header-tdid
AND tdspras = sy-langu.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = g_header-tdid
language = sy-langu
name = g_header-tdname
object = g_header-tdobject
IMPORTING
header = g_header
TABLES
lines = g_lines.
*
LOOP AT g_lines INTO l_lines.
l_lines-tdformat = '*'.
REPLACE '*' WITH '' INTO l_lines-tdline.
MODIFY g_lines FROM l_lines.
ENDLOOP.
IF NOT g_lines[] IS INITIAL.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
TABLES
itf_text = g_lines
text_stream = text_table.
*
CALL METHOD editor->set_selected_text_as_r3table
EXPORTING
table = text_table.
* CALL METHOD editor->set_selected_text_as_stream
* EXPORTING
* selected_text = text_table.
CALL METHOD editor->set_selection_indexes
EXPORTING
from_index = 1
to_index = 1.
ENDIF.
ENDFORM. " READ_TEXT
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
671 | 직원 데이터 [1] | sapjoy | 2024.07.02 | 241 |
670 | REPORT Z99_24. | sapjoy | 2024.05.21 | 83 |
669 | REPORT Z06_01. | sapjoy | 2024.04.21 | 60 |
668 | REPORT z05_36 | sapjoy | 2023.02.08 | 270 |
667 | API | sapjoy | 2022.11.03 | 351 |
666 | z15_21_drag | sapjoy | 2022.02.24 | 307 |
665 | Z18_06_DRAGCLASS | sapjoy | 2022.02.23 | 334 |
664 | REPORT Z21_01 | sapjoy | 2015.10.28 | 2276 |
663 | subroutine pool | sapjoy | 2013.11.16 | 3314 |
662 | REPORT Z20_01. | sapjoy | 2012.08.02 | 5097 |
661 | REPORT Z19_02. | sapjoy | 2012.08.02 | 3953 |
» | REPORT z19_01. | sapjoy | 2012.08.02 | 3559 |
659 | REPORT z18_06. | sapjoy | 2012.08.02 | 3195 |
658 | REPORT z18_05 | sapjoy | 2012.08.02 | 3384 |
657 | REPORT z18_04 . | sapjoy | 2012.08.02 | 3388 |
656 | REPORT z18_03. | sapjoy | 2012.08.02 | 4598 |
655 | REPORT z18_02. | sapjoy | 2012.08.02 | 3124 |
654 | REPORT z18_01. | sapjoy | 2012.08.02 | 3152 |
653 | REPORT z17_23 | sapjoy | 2012.08.02 | 2538 |
652 | REPORT z17_22 | sapjoy | 2012.08.02 | 2307 |