01-11-2007 7:47 AM
can any body provide sample code for interactive report
thanks in advance
01-11-2007 7:49 AM
01-11-2007 7:49 AM
01-11-2007 7:49 AM
REPORT ztest.
*logical database is KDF
TABLES: LFA1, LFB1, BSIK.
DATA: BEGIN OF DOCTAB OCCURS 100,
BELNR LIKE BSIK-BELNR,
BUDAT LIKE BSIK-BUDAT,
GSBER LIKE BSIK-GSBER,
DMBTR LIKE BSIK-DMBTR,
END OF DOCTAB.
START-OF-SELECTION.
GET LFB1.
WRITE: LFA1-LIFNR HOTSPOT, LFB1-BUKRS, (20) LFA1-NAME1, (20)
LFA1-ORT01
.
HIDE: LFA1-LIFNR, LFB1-BUKRS.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE: SY-LISEL.
ULINE. SKIP.
WRITE: 'COMPANY CODE:'(001), LFB1-BUKRS.
WRITE: / 'DOC. NO. POST.DATE BA LOCAL CURRENCY'(002).
ULINE /(45).
END-OF-SELECTION.
CLEAR LFA1-LIFNR.
at line-selection.
WRITE: 'PF13 SY-LSIND = ', SY-LSIND.
CHECK NOT LFA1-LIFNR IS INITIAL.
SELECT * FROM BSIK WHERE LIFNR = LFA1-LIFNR AND BUKRS EQ LFB1-BUKRS.
WRITE: / BSIK-BELNR, BSIK-BUDAT DD/MM/YYYY, BSIK-GSBER, 23
BSIK-DMBTR.
DOCTAB-BELNR = BSIK-BELNR.
DOCTAB-BUDAT = BSIK-BUDAT.
DOCTAB-GSBER = BSIK-GSBER.
DOCTAB-DMBTR = BSIK-DMBTR.
APPEND DOCTAB.
CLEAR DOCTAB.
ENDSELECT.
IF SY-SUBRC NE 0.
SKIP 5.
WRITE: '*** NO DOCUMENTS AVAILABLE. ***'(003).
ENDIF.
CLEAR LFA1-LIFNR.
01-11-2007 7:49 AM
just change ur database table accordingly and use this code to understand the interactive list concept..
reward if helpfull -
Interactive list and upload file on Application server.
&----
*& Report ZGILL_IT *
*& *
&----
*& *
*& *
&----
REPORT zgill_it message-id rp .
INCLUDE <icon> .
TABLES : zgill_main,zgill_details.
selection-screen:
pushbutton 1(20) gocfg user-command amit,
skip 1.
*parameters: p_file default ' '
data d_flag value 'X'.
parameters fpath like rlgrap-filename default 'C:\Temp\ABC.xls' MODIF id 1.
parameters fpath1 like DXFIELDS-LONGPATH default 'D:\usr\sap\D47\DVEBMGS00\data\KISS' .
SELECT-OPTIONS l_pernr FOR zgill_main-pernr OBLIGATORY NO INTERVALS.
data: cursorfield(20).
DATA : BEGIN OF itab OCCURS 0,
pernr like zgill_main-pernr,
name like zgill_main-name,
dob like zgill_main-dob,
org like zgill_main-org,
INCLUDE STRUCTURE zgill_main.
*DATA : fname LIKE zgill_details-fname,
fname LIKE zgill_details-fname,
lname LIKE zgill_details-lname,
dname LIKE zgill_details-dname,
plans LIKE zgill_details-plans,
salary LIKE zgill_details-salary,
hdate LIKE zgill_details-hdate.
DATA: END OF itab.
AT SELECTION-SCREEN OUTPUT.
write icon_configuration as icon to gocfg.
concatenate gocfg 'Feilds for selection/delection' into gocfg.
perform modify_screen.
at selection-screen.
if sy-ucomm = 'AMIT' .
perform toggle_flag.
endif.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR fpath1.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'A'
I_SERVER = '?'
I_PATH =
FILEMASK = '.'
FILEOPERATION = 'R'
IMPORTING
O_LOCATION_FLAG =
O_SERVER =
O_PATH = fpath1
ABEND_FLAG =
EXCEPTIONS
RFC_ERROR = 1
ERROR_WITH_GUI = 2
OTHERS = 3.
START-OF-SELECTION.
PERFORM get_main_data.
********************ki
perform appplication.
if d_flag = 'X'.
PERFORM write_main.
else .
perform download_itab.
endif.
*
END-OF-SELECTION.
AT LINE-SELECTION.
PERFORM get_other_details.
GET CURSOR FIELD CURSORFIELD.
case cursorfield.
when 'ITAB-PERNR' .
PERFORM get_other_details.
when 'ZGILL_DETAILS-FNAME'.
submit ZGILL_CALLREPORT
with P_RNAME EQ SY-REPID .
*submit ZGILL_CALLREPORT exporting list to memory and return.
endcase.
if cursorfield = 'ITAB-PERNR'.
PERFORM get_other_details.
endif.
if cursorfield = 'ZGILL_DETAILS-DNAME'.
submit ZGILL_CALLREPORT
with P_RNAME EQ SY-REPID .
endif.
&----
*& Form get_main_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM get_main_data .
LOOP AT l_pernr.
SELECT SINGLE * FROM zgill_main WHERE pernr = l_pernr-low.
MOVE-CORRESPONDING zgill_main TO itab.
APPEND itab.
ENDLOOP.
ENDFORM. " get_main_data
&----
*& Form write_main
&----
text
----
--> p1 text
<-- p2 text
----
FORM write_main .
FORMAT INTENSIFIED ON COLOR 1.
WRITE: 5'PERNR' ,15 'NAME' ,40 'BirthDate',55 'Org Unit'.
*write: 5'PERNR' color 1 ,15 'NAME' color 1,40 'BirthDate' color 1,55 'Org Unit' color 1 .
SKIP 1.
FORMAT INTENSIFIED OFF COLOR OFF..
LOOP AT itab.
WRITE: 5 itab-pernr HOTSPOT ON COLOR 3 ,15 itab-name COLOR 2,40 itab-dob COLOR 2,55 itab-org COLOR 2.
HIDE itab-pernr.
SKIP 1.
write: 5 'also transfer to application server just look at it open AL11' COLOR 5.
ENDLOOP.
ENDFORM. " write_main
&----
*& Form get_other_details
&----
text
----
--> p1 text
<-- p2 text
----
FORM get_other_details .
SELECT SINGLE * FROM zgill_details WHERE pernr = itab-pernr .
MOVE-CORRESPONDING zgill_details TO itab.
FORMAT INTENSIFIED ON COLOR 1.
WRITE: 5'FNAME' ,20 'LNAME' ,35 'DNAME',50 'Position' ,65 'Salary',85 'HireDate'.
SKIP 1.
FORMAT INTENSIFIED OFF COLOR OFF.
WRITE: 5 zgill_details-fname HOTSPOT ON COLOR 3,20 zgill_details-lname COLOR 2,35 zgill_details-dname COLOR 2,
50 zgill_details-plans COLOR 2,65 zgill_details-salary LEFT-JUSTIFIED COLOR 2,85 zgill_details-hdate COLOR 2.
ENDFORM. " get_other_details
&----
*& Form modify_screen
&----
text
----
--> p1 text
<-- p2 text
----
form modify_screen .
LOOP AT SCREEN.
IF SCREEN-GROUP1 = '1'.
OR SCREEN-GROUP1 = '4'.
IF d_FLAG EQ 'X'.
SCREEN-ACTIVE = 0.
ELSE.
SCREEN-ACTIVE = 1.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
endform. " modify_screen
&----
*& Form toggle_flag
&----
text
----
--> p1 text
<-- p2 text
----
form toggle_flag .
IF d_FLAG = 'X'.
CLEAR d_FLAG.
ELSE.
d_FLAG = 'X'.
ENDIF.
endform. " toggle_flag
&----
*& Form download_itab
&----
text
----
--> p1 text
<-- p2 text
----
form download_itab .
DATA: full_file_name TYPE string.
full_file_name = fpath.
*CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = full_file_name
filetype = 'ASC'
NO_AUTH_CHECK = c_x
codepage = '1160'
IMPORTING
FILELENGTH = z_akt_filesize
CHANGING
data_tab = itab[]
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = full_file_name
FILETYPE = 'ASC'
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 = '1160'
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
FILELENGTH =
tables
data_tab = itab[].
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.
MESSAGE i016 WITH 'Download-Error; RC:' sy-subrc.
else.
write 'successfull'.
ENDIF.
endform. " download_itab
&----
*& Form appplication
&----
text
----
--> p1 text
<-- p2 text
----
FORM appplication .
data:c_tab type c
value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
v_text type string.
open dataset fpath1 for output IN TEXT MODE ENCODING DEFAULT .
if sy-subrc = 0.
loop at itab.
concatenate itab-pernr itab-name itab-dob itab-org into v_text
separated by c_tab.
transfer v_text to fpath1.
endloop.
endif.
close dataset fpath1.
ENDFORM. " appplication
01-11-2007 7:53 AM
U can find them in
ABAPDOCU
-->ABAP User Dialogs
-->Lists
--> User Actions on Lists