*&---------------------------------------------------------------------*
*& Report ZOUTPUT_MODE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZOUTPUT_MODE NO STANDARD PAGE HEADING.
*& Report ZOUTPUT_MODE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZOUTPUT_MODE NO STANDARD PAGE HEADING.
"DECLARATIONS FOR WORK ARE AND INTERNAL TABLE
INCLUDE ZOUTPUT_MODE_TOP.
INCLUDE ZOUTPUT_MODE_TOP.
*&---------------------------------------------------------------------*
*& Include ZOUTPUT_MODE_TOP
*&---------------------------------------------------------------------*
"STRUCTUE OF VTTK WITH LIMITED FIELDS
TYPES: BEGIN OF ty_vttk,
tknum TYPE vttk-tknum,
vbtyp TYPE vttk-vbtyp,
shtyp TYPE vttk-shtyp,
tplst TYPE vttk-tplst,
ernam TYPE vttk-ernam,
erdat TYPE vttk-erdat,
erzet TYPE vttk-erzet,
aenam TYPE vttk-aenam,
END OF ty_vttk.
" WORK ARAEA AND INTRNAL TABLE
DATA: I_VTTK TYPE TABLE OF TY_VTTK,
W_VTTK TYPE TY_VTTK.
DATA: V_FILE TYPE STRING.
V_FILE = 'ZAPP_SERVER.TXT'. "WE JUST ASSIGNED A TEXT FILE
DATA : V_STRUCTURE TYPE STRING.
*& Include ZOUTPUT_MODE_TOP
*&---------------------------------------------------------------------*
"STRUCTUE OF VTTK WITH LIMITED FIELDS
TYPES: BEGIN OF ty_vttk,
tknum TYPE vttk-tknum,
vbtyp TYPE vttk-vbtyp,
shtyp TYPE vttk-shtyp,
tplst TYPE vttk-tplst,
ernam TYPE vttk-ernam,
erdat TYPE vttk-erdat,
erzet TYPE vttk-erzet,
aenam TYPE vttk-aenam,
END OF ty_vttk.
" WORK ARAEA AND INTRNAL TABLE
DATA: I_VTTK TYPE TABLE OF TY_VTTK,
W_VTTK TYPE TY_VTTK.
DATA: V_FILE TYPE STRING.
V_FILE = 'ZAPP_SERVER.TXT'. "WE JUST ASSIGNED A TEXT FILE
DATA : V_STRUCTURE TYPE STRING.
"FETCHING THE DATA.
SELECT TKNUM VBTYP
SHTYP TPLST
ERNAM ERDAT
ERZET AENAM FROM VTTK
INTO TABLE I_VTTK.
****************************************************************
" OPEN DATASET STATEMENT IS USED TO OPEN/PLACE OUR FILE IN
" THE APPLICATION SERVER EITHER IN TEXT MODE OR BINARY MODE
" OR LEGACY BINARY MODE.
" HERE OUTPUT MEANS WRITING THE DATA INTO THE FILE.
***************************************************************
OPEN DATASET V_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
************************************************************************
" HERE WE ARE CONCATINATING EACH AND EVERY FIELD INTO OUR V_STRUCTURE
" AND WE ARE SEPARATING IT BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
*************************************************************************
LOOP AT I_VTTK INTO W_VTTK.
CONCATENATE W_VTTK-TKNUM W_VTTK-VBTYP
W_VTTK-SHTYP W_VTTK-TPLST
W_VTTK-ERNAM W_VTTK-ERDAT
W_VTTK-ERZET W_VTTK-AENAM
INTO V_STRUCTURE
SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
TRANSFER V_STRUCTURE TO V_FILE. " V_STRUCTURE (DATA) IS MOVED TO V_FILE
ENDLOOP.
****************************************************************************
" CLOSE DATASET IS A STATEMENT IS USED TO CLOSE THE FILE
" WHICH IS OPENED BY THE "OPEN DATASET"
****************************************************************************
CLOSE DATASET V_FILE.
WRITE:/ 'WRITING THE DATA INTO APLLICATION SERVER IS SUCESSFULL'.
***************************************************************
" NOW GO TO TCODE AL11 FOR DIRECTORIES
" OPEN DIR = DIR_HOME,
" NOW OUR FILE Z_APP_SERVER.TXT WILL BE THERE
" JUST DOUBLE CLICK ON IT TO VIEW OUR DATA.
**************************************************************
OUTPUT:
DOUBLE CLICK ON DIR_HOME TO GET OUR FILE ZAPP_SERVER.TXT
TO VIEW OUR DATA JUST DOUBLE CLICK ON IT