리포트 프로그램 한개 만들어서 테이블 필드명대루 데이터를 집어넣으면 되는건가요?
텍스트 파일이나 엑셀파일을 불러와서 넣는법이 있는거 같던데
방법좀 알려주세요~
원하는 것은 데이터를 넣고 데이터베이브 테이블을 조회했을때 들어간 데이터의 엔트를 조회하는 프로그램을 만들라고합니다
리포트 프로그램 한개 만들어서 테이블 필드명대루 데이터를 집어넣으면 되는건가요?
텍스트 파일이나 엑셀파일을 불러와서 넣는법이 있는거 같던데
방법좀 알려주세요~
원하는 것은 데이터를 넣고 데이터베이브 테이블을 조회했을때 들어간 데이터의 엔트를 조회하는 프로그램을 만들라고합니다
*&---------------------------------------------------------------------*
*& Report ZAB07B02
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZAB07B02 MESSAGE-ID ZAB07M.
*----------------------------------------------------------------------*
* TABLES DEFINE
*----------------------------------------------------------------------*
TABLES ZAB02T02.
*----------------------------------------------------------------------*
* DATA DEFINE
*----------------------------------------------------------------------*
DATA: V_FIELD0(4) TYPE C,
GV_INDEX TYPE I,
GV_ROW TYPE N,
GV_TAB TYPE FILETABLE,
GV_FILE LIKE RLGRAP-FILENAME, "경로저장변수
GV_SUBRC TYPE I,
GV_TMP TYPE I.
FIELD-SYMBOLS <FS> TYPE ANY.
* 엑셀 업로드 데이터 선언
DATA : GT_XLS TYPE KCDE_CELLS OCCURS 0 WITH HEADER LINE.
*----------------------------------------------------------------------*
* INTERNAL TABLE DEFINE
*----------------------------------------------------------------------*
DATA : BEGIN OF ITAB_RST OCCURS 0,
* FIELD0(1), "체크박스의 공간을 위한 변수선언
TITLE(10),
A(10),
B(10),
C(10),
D(10),
E(10),
F(10),
G(10),
H(10),
I(10),
J(10),
K(10).
DATA: END OF ITAB_RST.
DATA : BEGIN OF ITAB_IN OCCURS 0.
INCLUDE STRUCTURE ZAB02T02.
DATA: END OF ITAB_IN.
*기본 화면
*----------------------------------------------------------------------*
* SELECTION-SCREEN
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FNAME LIKE RLGRAP-FILENAME MODIF ID 01, "파일명
P_ENDCOL TYPE I MODIF ID 01,
P_ENDROW TYPE I MODIF ID 01.
SELECTION-SCREEN END OF BLOCK B1.
*------------------------------------------------------
*AT SELECTION-SCREEN
*-------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
PERFORM F4_FILENAME USING P_FNAME.
*------------------------------------------------------------
*INITIALZATION
*------------------------------------------------------------
INITIALIZATION.
PERFORM INITIALIZATION.
*------------------------------------------------------------
*START-OF-SELECTION
*------------------------------------------------------------
START-OF-SELECTION.
SET PF-STATUS 'STAT0100'. "실행시 툴바밑에 버튼지정
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
FILENAME = P_FNAME "경로 지정
I_BEGIN_COL = '1' "시작칼럼
I_BEGIN_ROW = '1' "시작열
I_END_COL = P_ENDCOL "끝라인
I_END_ROW = P_ENDROW "끝열
TABLES
INTERN = GT_XLS
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT GT_XLS.
GV_INDEX = ( GT_XLS-COL ).
ASSIGN COMPONENT GV_INDEX OF STRUCTURE ITAB_RST TO <FS>.
MOVE GT_XLS-VALUE TO <FS>.
AT END OF ROW.
APPEND ITAB_RST.
CLEAR ITAB_RST.
ENDAT.
ENDLOOP.
LOOP AT ITAB_RST.
WRITE :/ ITAB_RST.
ENDLOOP.
*LOOP AT GT_XLS.
* WRITE : / GT_XLS-ROW , GT_XLS-COL , GT_XLS-VALUE.
*ENDLOOP.
INCLUDE ZAB07B01_F4_FILENAMEF01.
*&---------------------------------------------------------------------*
*& Form F4_FILENAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FNAME text
*----------------------------------------------------------------------*
FORM F4_FILENAME USING GV_FILE.
CLEAR : GV_TAB. REFRESH GV_TAB.
*업로드할 파일의 PATH 지정하기.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = '업로드할 파일을 선택하세요'
DEFAULT_FILENAME = '*.XLS'
MULTISELECTION = ' '
CHANGING
FILE_TABLE = GV_TAB
RC = GV_SUBRC.
IF SY-SUBRC = 0.
LOOP AT GV_TAB INTO GV_FILE.
ENDLOOP.
ENDIF.
ENDFORM. " F4_FILENAME.
*&---------------------------------------------------------------------*
*& Form INITIALIZATION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM INITIALIZATION .
P_FNAME = 'C:'.
ENDFORM. " INITIALIZATION
*----------------------------------------------------------------------*
* AT USER-COMMAND //펑션키 설정
*----------------------------------------------------------------------*
AT USER-COMMAND.
SY-LSIND = 1.
CASE SY-UCOMM.
WHEN 'SS'.
PERFORM SELECT_ALL.
WHEN 'DEL'.
PERFORM DELETE_ALL .
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
SY-UCOMM = ' '.
*&---------------------------------------------------------------------*
*& Form SELECT_ALL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM SELECT_ALL.
LOOP AT ITAB_RST.
MOVE-CORRESPONDING ITAB_RST TO ITAB_IN.
CLEAR ZAB02T02.
ZAB02T02-MANDT = SY-MANDT.
ZAB02T02-TITLE = ITAB_IN-TITLE.
ZAB02T02-A = ITAB_IN-A.
ZAB02T02-B = ITAB_IN-B.
ZAB02T02-C = ITAB_IN-C.
ZAB02T02-D = ITAB_IN-D.
ZAB02T02-E = ITAB_IN-E.
ZAB02T02-F = ITAB_IN-F.
MODIFY ZAB02T02 FROM ITAB_IN.
MESSAGE s007.
ENDLOOP.
ENDFORM. "SELECT_ALL
*&---------------------------------------------------------------------*
*& Form DELETE_ALL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DELETE_ALL .
loop at ITAB_RST.
DELETE FROM ZAB02T02.
MESSAGE s006.
endloop.
ENDFORM. " DELETE_ALL