* Module status_0100 output
*-----------------------------------*
* text
*-----------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
ENDMODULE.
*-----------------------------------*
*Module user_command_0100 input
*-----------------------------------*
* text
*-----------------------------------*
MODULE USER_COMMAND_0100 INPUT.
GV-UCOMM = SY-UCOMM.
CLEAR SY-UCOMM.
CASE GV-UCOMM
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'NEW'. " EKRANI TEMİZLE
PERFORM INIT.
CALL METHOD EDITOR -> DELETE_TEXT.
WHEN 'SAVE'.
PERFORM SAVE." KAYDET
ENDCASE.
ENDMODULE.
*--------------------------------------*
*FORM CREATE_TEXT
*--------------------------------------*
* TEXT
*--------------------------------------*
* -->P_LV_NAME TEXT
* <--p_lt_lines p="" text="">*--------------------------------------*
FORM CREATE_TEXT TABLES PT_LINES LIKE LINETAB
USING P_NAME LIKE THEAD-TDNAME.
CLEAR GV-SUBRC.
PT_LINES-TDFORMAT = '*'.
PT_LINES-TDLINE = CL_ABAP_CHAR_UTILITIES=>NEWLINE.
APPEND PT_LINES.
CALL FUNCTION 'CREATE_TEXT'
-----------------------------
FORM INIT .
CLEAR: ZSOZLESME_MAIN.
ENDFORM. " INIT
-------------------------------------
*------------------------------------------*
* FORM INIT_CONTAINER
*------------------------------------------*
* TEXT
*------------------------------------------*
*-->P1 TEXT
*<--p2 nbsp="" p="">*------------------------------------------*
FORM INIT_CONTAINER.
*Konteyner objesinin yaratılması
PERFORM SET_TEXT_CONTAINER USING 'ACIKLAMA'
CHANGING CONTAINER
EDITOR.
CALL METHOD EDITOR-£SET_TEXT_AS_STREAM
EXPORTING
TEXT = LINES.
RESFESH LINES.
ENDFORM. " INIT CONTAINER
*-------------------------*
*- FORM GET_NEXT_NUMBER
*-------------------------*
* TEXT
*-------------------------*
*-->P1 TEXT
*<--p2 p="" text="">*-------------------------*
FORM GET_NET_NUMBER
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR ='01'
OBJECT = 'ZSOZID'
* QUANTITY = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BIN_DATA = ' '
IMPORTING
NUMBER = ZSOZLESME_MAIN-SOZID
* QUANTITY =
* RETURNCOE =
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
BIN_DATA_OVERFLOW = 7
OTHERS = 8.
OF SY-SUBRC<>0.
GY-SUBRC = 4.
MESSAGE S000(L1)
WITH 'SNRO işlem kodunda' ' ZSOZID numara aralığı kontrol ediniz! '
DISPLAY LIKE 'E'.
ENDIF.
ENDFORM. " GET_NEXT_NUMBER
* FORM OPEN
*---------------------------------------*
*TEXT
*---------------------------------------*
*-->P1
*<--p2 p="">*---------------------------------------*
FORM OPEN.
DATA : LT_FIELDS LIKE SVAL OCCURS 0 WITH HEADER LINE,
LV_SOZID LIKE ZSOZLESME_MAIN-SOZID.
REFRESH : LT_FIELDS.
LT_FIELDS-TABNAME = 'ZSOZLESME_MAIN'.
LT_FIELDS-FIELDNAME = 'SOZID'.
APPEND LT_FIELDS.
CALL FUNCTION ' POPUP_GET_VALUES'
EXPORTING
* NO_VALUE_CHECK = ' '
POPUP_TITLE = 'Sözleşme numarası seçiniz...'
* START_COLUMN = '5'
* START_ROW = '5'
* IMPORTING
* RETURNCODE =
TABLES
FIELDS = LT_FIELDS
EXCEPTIOS
ERROR_IN_FIELDS = 1
OTHERS = 2.
READ TABLE LT_FIELDS INDEX 1.
LV_SOZID = LT_FIELDS-VALUE.
*ANA VERİLERİ OKU
SELECT SINGLE * FROM ZSOZLESME_MAIN
WHERE SOZID EQ LV_SOZID AND
LOEKZ EQ SPACE.
IF SY-SUBRC NE 0.
MESSAGE S000(L1) WITH LV_SOZID 'Sözleşmesi bulunamadı!'.
exit.
ENDIF.
*METİNLERİ OKU
PERFORM INIT_CONTAINER.
TEXTID = ZSOZLESME_MAIN-SOZID.
PERFORM READ_TEXT TABLES LINETAB
USING TEXTID
'Z001'
'ZSOZID'.
CALL METHOD EDITOR->DELETE_TEXT.
LOOP AT LINETAB INTO TLINE.
APPEND TLINE-TDLINE TO LINES.
ENDLOOP.
CALL METHOD EDITOR->SET_TEXT_AS_STREAM
EXPORTING
TEXT = LINES.
ENDFORM. " OPEN
*---------------------------------*
* form READ_EDITOR
*---------------------------------*
*TEXT
*---------------------------------*
* -->P_TEXT_TAB TEXT
* -->P_0946 TEXT
*---------------------------------*
FORM READ_EDITOR TABLES PT_TAB STRUCTURE TLINE
USING P_EDITOR TYPE REF TO CL_GUI_TEXTEDIT.
REFRESH PT_TAB.
CHECK P_EDITOR IS NOT INITIAL.
DATA : LINES TYPE TABLE OF LINE WITH HEADER LINE.
REFRESH LINES.
CALL METHOD P_EDITOR->GET_TEXT_AS_R3TABLE
IMPORTING
TABLE = LINES[]
EXCEPTIONS
ERROR_DP = 1
ERROR_CNTL_CALL_METHOD = 2
ERROR_DP_CREATE = 3
POTENTIAL_DATA_LOSS = 4.
LOOP AT LINES.
PT_TAB-TDFORMAT = '*'.
PT_TAB-TDLINE = LINES.
APPEND PT_TAB.
ENDLOOP.
ENDFORM. " READ_EDITOR
FORM READ_TEXT TABLES PT_LINES STRUCTURE TLINE
USING P_NAME LIKE THEAD-TDNAME
P_ID TYPE THEAD-TDID
P_OBJECT TYPE THEAD-TDOBJECT.
REFRESH : PT_LINES.
CALL FUNCTION ' READ_TEXT'
EXPORTING
ID = P_ID
LANGUAGE = 'T'
NAME = P_NAME
OBJECCT = P_OBJECT
TABLES
LINES = PT_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
ENDFORM. " READ_TEXT
*******************************************************
report ***
TABLES ZSOZLESME_MAIN. " sözleşmelerin kaydedildiği tablo
* text editör ----------*
CONSTANTS : LINE_LENGTH TYPE I VALUE 132.
DATA : CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
EDITOR TYPE REF TO CL_GUI_TEXTEDIT,
LINES LIKE STANDARD TABLE OF LINE,
LINETAB LIKE TABLE OF TLINE,
TEXTID LIKE THEAD-TDNAME,
TLINE LIKE TLINE.
DATA : BEGIN OF GV,
SUBRC LIKE SY-SUBRC,
UCOMM LIKE SY-UCOMM,
END OF GV.
START-OF-SELECTION.
*Program değişkenleri init et
PERFORM INIT.
*Konteyner objesini int et
PERFORM INIT_CONTAINER.
CALL SREEN 100.
*----------------------------------*
* FORM SAVE
*---------------------------------*
* TEXT
*----------------------------------*
* -->P1
* <--p2 div="">
*----------------------------------*
FORM SAVE.
CLEAR GV-SUBRC.
IF ZSOZLESME_MAIN-SOZID IS INITIAL.
* yeni sözleşme numarası üret
PERFORM GET_NEXT_NUMBER .
ENDIF.
*editördeki uzun metni oku
PERFORM READ_EDITOR TABLES LINETAB USING EDITOR.
TEXTID =ZSOZLESME_MAIN-SOZID.
*TEXT OBJESİNİ YARAT
PERFORM CREATE_TEXT TABLES LINETAB USING TEXTID.
CHECK GV-SUBRC IS INITIAL.
*KAYDET
ZSOZLESME_MAIN-CERNAM = SY-UNAME.
ZSOZLESME_MAIN-CERDAT = SY-DATUM.
ZSOZLESME_MAIN-CERZET = SY-UZEIT.
MODIFY ZSOZLESME_MAIN.
COMMIT WORK AND WAIT.
MESSAGE S000(L1) WITH ZSOZLESME_MAIN-SOZID ' Nolu sözleşme kaydedildi...'.
ENDFORM.
--p2>
*-------------------------------------------------*
*form SET_TEXT_CONTAINER
*-------------------------------------------------*
*TEXT
*-------------------------------------------------*
* -->P_050 TEXT
*-------------------------------------------------*
FORM SET_TEXT_CONTAINER USING P_CONNAME
CHANGING
P_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER
P_EDITOR TYPE REF TO CL_GUI_TEXTEDIT.
IF P_EDITOR IS INITIAL.
CREATE OBJECT P_CONTAINER
EXPORTING
CONTAINER_NAME = P_CONNAME
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_LINK = 5.
CREATE OBJECT P_EDITOR
EXPORTING
PARENT = P_CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_POSITION = LINE_LENGTH
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
GUI_TYPE_NOT_SUPPORTED = 5.
* Editörü temizle
CALL METHOD P_EDITOR -> DELETE_TEXT.
*TOOLBAR çıkmasın
CALL METHOD P_EDITOR->SET_TOOLBAR_MODE.
EXPORTING
TOOLBAR_MODE = 0 .
*DURUM çubugu çıkmasın
CALL METHOD P_EDITOR->SET_STATUSBAR_MODE.
EXPORTING
STATUSBAR_MODE = 0.
ENDIF.
CALL METHOD CL_GUI_CFW =>FLUSH.
EXCEPTIONS
OTHERS = 1.
ENDFORM.
Hiç yorum yok:
Yorum Gönder