tables: mara,vbap.
data : begin of itab occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
end of itab.
data : begin of itab1 occurs 0,
matnr like vbap-matnr,
vbeln like vbap-vbeln,
end of itab1.
data: fld(20) type c,val like mara-matnr .
selection-screen begin of block blk1 with frame title text-001.
select-options: m for mara-matnr obligatory.
selection-screen end of block blk1.
at selection-screen on m.
select single matnr from mara into mara-matnr where matnr = m-low.
if sy-subrc ne 0.
message e000(zz) with 'invalid ' mara-matnr 'in your ' 'selection'.
endif.
start-of-selection.
select matnr ernam into table itab from mara where matnr in m.
select matnr vbeln into table itab1 from vbap for all entries in itab
where matnr = itab-matnr.
end-of-selection.
loop at itab.
write:/30 itab-matnr,60 itab-ernam.
* hide itab-matnr.
clear itab-matnr.
endloop.
set pf-status 'XX2'.
at line-selection.
get cursor field fld value val.
case fld.
when 'ITAB-MATNR'.
write:/ val.
endcase.
case sy-lsind.
when '1'.
set pf-status 'XX2'.
set titlebar 'XX2'.
if itab1[] is initial.
write:/ 'no data found for itab1 in first secondary list'.
endif.
loop at itab1.
write:/30 itab1-matnr,60 itab1-vbeln.
* hide itab1-matnr.
endloop.
when '2'.
set pf-status 'XX2'.
set titlebar 'XX2'.
loop at itab.
write:/30 itab-matnr,60 itab-ernam.
endloop.
endcase.
at user-command.
case sy-ucomm.
when 'SET'.
if sy-lsind = 1.
window starting at 5 3 ending at 40 10.
write 'Select line for a second window'.
elseif sy-lsind = 2.
window starting at 45 10 ending at 60 12.
write 'Last window'.
endif.
when 'BACK'.
sy-lsind = sy-lsind - 1.
when 'ABC'.
write:/ 'iam great'.
when 'DOWNLOAD'.
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = 'c:\temp.txt'
filetype = 'DAT'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = itab
* FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endcase.
top-of-page during line-selection.
case sy-lsind.
when '1'.
write:/ 'this is secondary list'.
endcase.
* AT USER-COMMAND.
* CASE sy-ucomm.
* WHEN 'SELE'.
* IF sy-lsind = 1.
* SET PF-STATUS 'DIALOG'.
* SET TITLEBAR 'WI1'.
* WINDOW STARTING AT 5 3 ENDING AT 40 10.
* WRITE 'Select line for a second window'.
* ELSEIF sy-lsind = 2.
* SET PF-STATUS 'DIALOG' EXCLUDING 'SELE'.
* SET TITLEBAR 'WI2'.
* WINDOW STARTING AT 45 10 ENDING AT 60 12.
* WRITE 'Last window'.
* ENDIF.
* ENDCASE.
Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments