REPORT ZDTS_UPLOAD .
type-pools: slis.
datA:
begin of gt_data occurs 0,
ad(10) type c,
soyad(10) type c,
end of gt_grup.
*ALV data declarations
DATA:
fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid,
gt_events TYPE slis_t_event,
gd_prntparams TYPE slis_print_alv,
is_variant LIKE disvariant.
DATA : gt_fcat TYPE slis_t_fieldcat_alv,
gf_fcat LIKE LINE OF gt_fcat.
DATA : layout TYPE slis_layout_alv .
PARAMETERS : FILEX LIKE RLGRAP-FILENAME
DEFAULT
'C:\'
OBLIGATORY.
initialization.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILEX .
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = FILEX .
start-of-selection.
perform read_data. "okuma işlemini yapalım
end-of-selection.
*&---------------------------------------------------------------------*
*& Form read_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM read_data .
data: yol type string. yol = filex.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = yol
FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '. "göndermediğiniz takdirde tab delimeted olarak ayarlar
TABLES
DATA_TAB = gt_data
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7 .
* <-- p2 text *----------------------------------------------------------------------* FORM write_data.
*FCAT'imizi oluşturuyoruz
PERFORM appalv USING 'AD' 'GT_DATA' 'Adı' '' 'X' ''. "ad alanını key alan yaptık
PERFORM appalv USING 'SOYAD' 'GT_DATA' 'Soyadı' '' '' ''.
layout-zebra = 'X' .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = gt_fcat
is_layout = layout
is_variant = is_variant
i_save = 'A'
i_callback_program = sy-repid
TABLES
t_outtab = GT_DATA.
ENDFORM. " write_data
*&---------------------------------------------------------------------*
*& Form appalv
*&---------------------------------------------------------------------*
FORM appalv USING p_fn
p_tn
p_txt
p_fix
p_key
p_no_zero .
CLEAR gf_fcat.
gf_fcat-fieldname = p_fn .
gf_fcat-tabname = p_tn .
gf_fcat-seltext_m = p_txt .
gf_fcat-fix_column = p_fix .
gf_fcat-key = p_key .
gf_fcat-no_zero = p_no_zero .
APPEND gf_fcat TO gt_fcat.
ENDFORM. " appalv
Konu ile ilgili detaylı içerik ve örnek ABAP Kodları,daha sonra eklenecektir.
SAP ve ABAP ile ilgili tüm sorularınızı
serkurumsal@yandex.com
E-Mail adresi ile bize ulaşarak sorabilirsiniz.
Serkan AKKAVAK
Bilgisayar Mühendisi
0 Comments