2007 Jul 17 11:38 AM
hi,
My requriement is I have to create an interactive reporting.
In the BASIC list I need to create a buuton. How to do that?
In Secondary list I neeed to create menu item. How to do that?
2007 Jul 17 1:27 PM
Hi,
Check this program:
Program Name: Z_SLN_INT_REP
----
Change Log *
Date :
Author :
Description :
Transport No:
----
Tables *
----
TABLES: vbak,
vbap.
----
Constants *
----
CONSTANTS: gc_or TYPE vbak-auart VALUE 'OR'.
----
Variables *
----
*Data: xxxx like yyyy.
----
Structures *
----
TYPES : BEGIN OF gt_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
netwr TYPE vbak-netwr,
waerk TYPE vbak-waerk,
END OF gt_vbak,
BEGIN OF gt_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
END OF gt_vbap,
BEGIN OF gt_fcode,
code(4) TYPE c,
END OF gt_fcode.
----
Internal Tables *
----
DATA : git_vbak TYPE TABLE OF gt_vbak,
git_vbap TYPE TABLE OF gt_vbap,
git_fcode TYPE TABLE OF gt_fcode.
DATA : wa_vbak TYPE gt_vbak,
wa_vbap TYPE gt_vbap,
wa_fcode TYPE gt_fcode.
----
Selection Screen *
----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln OBLIGATORY.
PARAMETERS: p_auart LIKE vbak-auart.
SELECTION-SCREEN END OF BLOCK b1.
----
Initialization *
----
INITIALIZATION.
p_auart = gc_or.
----
At Selection Screen Output *
----
AT SELECTION-SCREEN OUTPUT.
----
At Selection Screen *
----
AT SELECTION-SCREEN.
PERFORM validate_entries.
----
Start Of Selection *
----
START-OF-SELECTION.
SET TITLEBAR 'AAA'.
SET PF-STATUS 'ABC'.
PERFORM get_sales_orders.
PERFORM get_items.
----
End Of Selection *
----
END-OF-SELECTION.
PERFORM display_output.
----
Top Of Page *
----
TOP-OF-PAGE.
PERFORM report_header.
----
Top Of Page DURING LINE SELECTION *
----
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM secondary_list_header.
----
End Of Page *
----
END-OF-PAGE.
----
At Line Selection *
----
AT LINE-SELECTION.
PERFORM get_items_list.
----
At User Command *
----
AT USER-COMMAND.
PERFORM get_items_user_command.
&----
*& Form validate_entries
&----
Validate Entries on Selection Screen
----
FORM validate_entries .
DATA : lv_vbeln TYPE vbak-vbeln.
SELECT SINGLE vbeln
FROM vbak
INTO lv_vbeln
WHERE vbeln IN s_vbeln.
IF sy-subrc NE 0.
SET CURSOR FIELD 'S_VBAK-VBELN'.
MESSAGE e000 WITH 'Invalid Sales Orders'(002).
ENDIF.
ENDFORM. " validate_entries
&----
*& Form get_sales_orders
&----
List of Sales Orders
----
FORM get_sales_orders .
CLEAR : git_vbak[].
SELECT vbeln
erdat
ernam
auart
netwr
waerk
FROM vbak
INTO TABLE git_vbak
WHERE vbeln IN s_vbeln
AND auart EQ p_auart.
IF sy-subrc EQ 0.
SORT git_vbak BY vbeln.
ENDIF.
ENDFORM. " get_sales_orders
&----
*& Form display_output
&----
Display List of Sales Orders
----
FORM display_output .
LOOP AT git_vbak INTO wa_vbak.
WRITE :/1(10) wa_vbak-vbeln HOTSPOT ON,
(10) wa_vbak-erdat,
(10) wa_vbak-ernam,
(4) wa_vbak-auart,
(20) wa_vbak-netwr,
(5) wa_vbak-waerk.
HIDE wa_vbak-vbeln.
CLEAR wa_vbak.
ENDLOOP.
ENDFORM. " display_output
&----
*& Form report_header
&----
text
----
FORM report_header .
WRITE :/1(10) 'SalesOrder'(003),
(10) 'Crt. Date'(004),
(10) 'SalesOrder'(005),
(4) 'OrdT'(006),
(20) 'Amount'(007),
(5) 'Curr'(008).
ENDFORM. " report_header
&----
*& Form get_items
&----
Get Line items
----
FORM get_items .
IF NOT git_vbak[] IS INITIAL.
CLEAR : git_vbap[].
SELECT vbeln
posnr
matnr
netwr
FROM vbap
INTO TABLE git_vbap
FOR ALL ENTRIES IN git_vbak
WHERE vbeln EQ git_vbak-vbeln.
IF sy-subrc EQ 0.
SORT git_vbap BY vbeln posnr.
ENDIF.
ENDIF.
ENDFORM. " get_items
&----
*& Form secondary_list_header
&----
Secondary List Header
----
FORM secondary_list_header .
WRITE 😕 'This is my secondary list:'(009), sy-lsind.
ENDFORM. " secondary_list_header
&----
*& Form get_items_list
&----
text
----
FORM get_items_list .
DATA: lv_fname(14) TYPE c VALUE 'WA_VBAK-VBELN',
lv_value TYPE vbak-vbeln.
GET CURSOR FIELD lv_fname VALUE lv_value.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_value
IMPORTING
output = lv_value.
WRITE 😕 ' I AMIN AT SELECTION-SCREEN'.
LOOP AT git_vbap INTO wa_vbap
WHERE vbeln EQ lv_value.
WRITE :/1(10) wa_vbap-vbeln,
(10) wa_vbap-posnr,
(18) wa_vbap-matnr,
(20) wa_vbap-netwr.
CLEAR : wa_vbap.
ENDLOOP.
ENDFORM. " get_items_list
&----
*& Form get_items_user_command
&----
text
----
FORM get_items_user_command .
WRITE 😕 ' I AMIN USER-COMMAND'.
CASE sy-ucomm.
WHEN 'DISP' OR 'DISM'.
LOOP AT git_vbap INTO wa_vbap
WHERE vbeln EQ wa_vbak-vbeln.
WRITE :/1(10) wa_vbap-vbeln,
(10) wa_vbap-posnr,
(18) wa_vbap-matnr,
(20) wa_vbap-netwr.
ENDLOOP.
CLEAR : git_fcode[],
wa_fcode.
wa_fcode-code = 'DISP'.
APPEND wa_fcode TO git_fcode.
wa_fcode-code = 'DISM'.
APPEND wa_fcode TO git_fcode.
ENDCASE.
SET PF-STATUS 'ABC' EXCLUDING git_fcode.
SET TITLEBAR 'AAA' WITH wa_vbak-vbeln.
ENDFORM. " get_items_user_command
Regards,
Bhaskar
2007 Jul 17 11:46 AM
Hi...
You can Create the Application toolbar buttons and Menus using Menu painter SE41.
Each buttom must have a Function code Eg: CREATE
START-OF-SELECTION.
Set pf-status 'GUI1'.
<basic list Logic>
AT user-command.
case sy-ucomm.
when 'CREATE'.
Set pf-status 'GUI2'.
<detail list Logic>
Endcase.
<b>Reward if helpful.</b>
2007 Jul 17 11:52 AM
HI
refer to following code:
ABLES: eban,
SSCRFIELDS.
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETER:rad1 RADIOBUTTON GROUP rad USER-COMMAND frad1 DEFAULT 'X',
rad2 RADIOBUTTON GROUP rad .
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETER: mtr AS CHECKBOX MODIF ID g3 USER-COMMAND chk1,
p_matnr TYPE eban-matnr MODIF ID g1,
sloc AS CHECKBOX MODIF ID g3 USER-COMMAND chk2,
str_loc TYPE eban-lgort MODIF ID g4.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
SELECT-OPTIONS: matnr1 FOR eban-matnr MODIF ID g2.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN PUSHBUTTON /20(10) name USER-COMMAND UCOM.
SELECTION-SCREEN END OF SCREEN 100.
name = 'FETCH'.
title = 'Test Report'.
CALL SELECTION-SCREEN '100'.
TYPE-POOLS slis.
declaration of internal tables and work areas to be used
DATA: BEGIN OF it_pr OCCURS 0,
banfn TYPE eban-banfn,
bnfpo TYPE eban-bnfpo,
loekz TYPE eban-loekz,
statu TYPE eban-statu,
ekgrp TYPE eban-ekgrp,
matnr TYPE eban-matnr,
werks TYPE eban-werks,
lgort TYPE eban-lgort,
preis TYPE eban-preis,
peinh TYPE eban-peinh,
END OF it_pr.
DATA: BEGIN OF it_mat OCCURS 0,
matnr TYPE eban-matnr,
END OF it_mat.
*DATA:BEGIN OF ITAB1 OCCURS 0,
DATA: l_answer.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat,
it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event.
declaration of variables to be used
DATA: r_ucomm TYPE sy-ucomm,
mat_no TYPE eban-matnr,
len TYPE i VALUE 1,
count TYPE i VALUE IS INITIAL,
iflag TYPE i VALUE IS INITIAL,
iflag1 TYPE i VALUE 0.
DATA :pr_id TYPE sy-repid,
rt_extab TYPE slis_t_extab.
INITIALIZATION.
pr_id = sy-repid.
AT SELECTION-SCREEN OUTPUT.
IF rad1 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'G1' OR screen-group1 = 'G4'.
screen-active = '1'.
screen-input = 0.
ELSEIF screen-group1 = 'G2'.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF rad2 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'G1' OR screen-group1 = 'G4' OR screen-group1 = 'G3' OR screen-group1 = 'G5'.
screen-active = '0'.
ELSEIF screen-group1 = 'G2'.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
IF mtr = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'G1'.
screen-input = 1 .
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
IF sloc = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'G4'.
screen-input = 1 .
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
clear sy-ucomm.
iflag = 1.
endif.
AT SELECTION-SCREEN.
PERFORM TO FETCH DATA
CASE SSCRFIELDS.
WHEN 'UCOM'.
PERFORM dataselection.
ENDCASE.
&----
*& Form user_command
&----
text
----
-->R_UCOMM text
-->SELFIELD text
----
FORM user_command USING r_ucomm TYPE sy-ucomm
selfield TYPE slis_selfield .
on the basis of the button clicked, execution of a code
CASE r_ucomm.
WHEN 'SAVE'.
DATA: t_spopli LIKE spopli OCCURS 0 WITH HEADER LINE.
t_spopli-varoption = 'PDF'.
APPEND t_spopli.
t_spopli-varoption = 'EXCEL'.
APPEND t_spopli .
CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
EXPORTING
CURSORLINE = 1
MARK_FLAG = ' '
MARK_MAX = 1
START_COL = 0
START_ROW = 0
textline1 = 'SELECT THE FORMAT OF THE OUTPUT'
TEXTLINE2 = ' '
TEXTLINE3 = ' '
titel = 'SAVE AS'
DISPLAY_ONLY = ' '
IMPORTING
ANSWER = l_answer
tables
t_spopli = t_spopli
EXCEPTIONS
NOT_ENOUGH_ANSWERS = 1
TOO_MUCH_ANSWERS = 2
TOO_MUCH_MARKS = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM DOWNLOAD.
exit when back or exit button is pressed
WHEN 'BACK'.
LEAVE PROGRAM .
WHEN 'EXIT'.
LEAVE PROGRAM .
ENDCASE.
ENDFORM. " user_command
END-OF-SELECTION.
&----
*& Form dataselection
&----
text
----
--> p1 text
<-- p2 text
----
FORM dataselection .
fetching details from database table on the basis of material number fetched.
IF mtr = 'X' AND sloc = 'X'.
SELECT banfn
bnfpo
loekz
statu
ekgrp
matnr
werks
lgort
preis
peinh
FROM eban INTO TABLE it_pr WHERE matnr = p_matnr AND lgort = str_loc .
ELSEIF mtr = 'X'.
SELECT banfn
bnfpo
loekz
statu
ekgrp
matnr
werks
lgort
preis
peinh
FROM eban INTO TABLE it_pr WHERE matnr = p_matnr.
ELSEIF sloc = 'X'.
SELECT banfn
bnfpo
loekz
statu
ekgrp
matnr
werks
lgort
preis
peinh
FROM eban INTO TABLE it_pr WHERE lgort = str_loc.
ELSE.
MESSAGE e002(zpurreq_msg).
endif.
flag to check single access of the database
IF iflag = 0.
PERFORM build_catalog.
ENDIF.
perform build_events
perform build_events.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
i_callback_program = pr_id
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = it_event
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_pr
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM set_pf_status USING rt_extab.
ENDFORM. " dataselection
&----
*& Form set_pf_status
&----
text
----
-->P_RT_EXTAB text
-->P_TYPE text
-->P_SLIS_EXTAB text
----
FORM set_pf_status USING p_rt_extab.
SET PF-STATUS 'Z_71945_STATUS'.
ENDFORM.
form
build_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
read contents of table it_event into work area
READ TABLE it_event WITH KEY name = slis_ev_top_of_page
INTO wa_event.
IF sy-subrc EQ 0.
MOVE 'ALV_TOP_OF_PAGE' TO wa_event-form.
MODIFY it_event FROM wa_event INDEX sy-tabix.
ENDIF.
READ TABLE it_event WITH KEY name = slis_ev_end_of_list
INTO wa_event.
IF sy-subrc EQ 0.
MOVE 'ALV_END_OF_LIST' TO wa_event-form.
MODIFY it_event FROM wa_event INDEX sy-tabix.
ENDIF.
ENDFORM. " build_events
&----
*& Form ALV_TOP_OF_PAGE
&----
text
----
FORM alv_top_of_page.
DATA:h_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
building the header of the list
wa_header-typ = 'H'.
CONCATENATE 'Purchase'
'Requisition'
INTO wa_header-info SEPARATED BY space.
APPEND wa_header TO h_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = 'Name:'.
wa_header-info = 'Infosys technologies limited'.
APPEND wa_header TO h_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = 'Address:'.
wa_header-info = 'IT PARK Chandigarh'.
APPEND wa_header TO h_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = 'DATE:'.
CONCATENATE sy-datum+6(2)'-'
sy-datum+4(2)'-'
sy-datum(4)
INTO wa_header-info.
APPEND wa_header TO h_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = 'TIME:'.
CONCATENATE sy-uzeit(2)':'
sy-uzeit+2(2)':'
sy-uzeit+4(2)
INTO wa_header-info.
APPEND wa_header TO h_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = 'Material Number:'.
wa_header-info = p_matnr.
APPEND wa_header TO h_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = h_header
i_logo = 'INFY1'.
ENDFORM. "ALV_TOP_OF_PAGE
&----
*& Form ALV_END_OF_LIST
&----
text
----
FORM alv_end_of_list.
building the footer
DATA: f_footer TYPE slis_t_listheader,
wa_footer TYPE slis_listheader.
wa_footer-typ = 'A'.
CONCATENATE 'Authorized'
'Signature'
':'
INTO wa_footer-info SEPARATED BY space.
APPEND wa_footer TO f_footer.
CLEAR wa_footer.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = f_footer.
ENDFORM. "ALV_END_OF_LIST
&----
*& Form build_catalog
&----
text
----
--> p1 text
<-- p2 text
----
form build_catalog .
building the catalog.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'BANFN'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-seltext_l = 'PUR_REQ'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C511'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'BNFPO'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '9'.
wa_fieldcat-seltext_l = 'ITEM_REQ'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C611'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'LOEKZ'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '7'.
wa_fieldcat-seltext_l = 'DEL_IND'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C511'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-fieldname = 'STATU'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-seltext_l = 'PROC_STAT'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C611'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 5.
wa_fieldcat-fieldname = 'EKGRP'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-seltext_l = 'PUR_GRP'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C511'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 6.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '18'.
wa_fieldcat-seltext_l = 'MATERIAL NO'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C611'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 7.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '8'.
wa_fieldcat-seltext_l = 'PLANT'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C511'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 8.
wa_fieldcat-fieldname = 'LGORT'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-seltext_l = 'STRG_LOC'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C611'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 9.
wa_fieldcat-fieldname = 'PREIS'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-seltext_l = 'VAL_PRICE'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C511'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 10.
wa_fieldcat-fieldname = 'PEINH'.
wa_fieldcat-tabname = 'eban'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-seltext_l = 'PRICE_UNIT'.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-emphasize = 'C611'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
iflag = 1.
endform. " build_catalog
&----
*& Form DOWNLOAD
&----
text
----
--> p1 text
<-- p2 text
----
form DOWNLOAD .
IF l_answer = '2'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'C:\REPORT.XLS'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
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 = IT_PR
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.
ENDIF.
endform. " DOWNLOAD
Regards
Ravish Garg
<b>
REWARD IF USEFUL</b>
2007 Jul 17 11:53 AM
hi...
In the basic list display and second list display use different pf-status for your requirement .You can also use set pf-status 'STATUS' excluding itab for your new pf-status.
regards,
veeresh
2007 Jul 17 11:53 AM
hi,
for creating buttons in application tool bar in reports use have to use a event SET PF-STATUS 's1'. -> double click on s1 -> system navigates u to a menu painter [SE41] -> give menu name and report name and save -> expand the list and select all buttons u want in application tool bar and assign function codes for them and activate.
in interactive program use AT USER_COMMAND event to do what all actions u want to have from that button.
in secondary lists in interactive reports u cant have menus.
if helpful reward some points.
with regards,
Suresh.A
2007 Jul 17 1:27 PM
Hi,
Check this program:
Program Name: Z_SLN_INT_REP
----
Change Log *
Date :
Author :
Description :
Transport No:
----
Tables *
----
TABLES: vbak,
vbap.
----
Constants *
----
CONSTANTS: gc_or TYPE vbak-auart VALUE 'OR'.
----
Variables *
----
*Data: xxxx like yyyy.
----
Structures *
----
TYPES : BEGIN OF gt_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
netwr TYPE vbak-netwr,
waerk TYPE vbak-waerk,
END OF gt_vbak,
BEGIN OF gt_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
END OF gt_vbap,
BEGIN OF gt_fcode,
code(4) TYPE c,
END OF gt_fcode.
----
Internal Tables *
----
DATA : git_vbak TYPE TABLE OF gt_vbak,
git_vbap TYPE TABLE OF gt_vbap,
git_fcode TYPE TABLE OF gt_fcode.
DATA : wa_vbak TYPE gt_vbak,
wa_vbap TYPE gt_vbap,
wa_fcode TYPE gt_fcode.
----
Selection Screen *
----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln OBLIGATORY.
PARAMETERS: p_auart LIKE vbak-auart.
SELECTION-SCREEN END OF BLOCK b1.
----
Initialization *
----
INITIALIZATION.
p_auart = gc_or.
----
At Selection Screen Output *
----
AT SELECTION-SCREEN OUTPUT.
----
At Selection Screen *
----
AT SELECTION-SCREEN.
PERFORM validate_entries.
----
Start Of Selection *
----
START-OF-SELECTION.
SET TITLEBAR 'AAA'.
SET PF-STATUS 'ABC'.
PERFORM get_sales_orders.
PERFORM get_items.
----
End Of Selection *
----
END-OF-SELECTION.
PERFORM display_output.
----
Top Of Page *
----
TOP-OF-PAGE.
PERFORM report_header.
----
Top Of Page DURING LINE SELECTION *
----
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM secondary_list_header.
----
End Of Page *
----
END-OF-PAGE.
----
At Line Selection *
----
AT LINE-SELECTION.
PERFORM get_items_list.
----
At User Command *
----
AT USER-COMMAND.
PERFORM get_items_user_command.
&----
*& Form validate_entries
&----
Validate Entries on Selection Screen
----
FORM validate_entries .
DATA : lv_vbeln TYPE vbak-vbeln.
SELECT SINGLE vbeln
FROM vbak
INTO lv_vbeln
WHERE vbeln IN s_vbeln.
IF sy-subrc NE 0.
SET CURSOR FIELD 'S_VBAK-VBELN'.
MESSAGE e000 WITH 'Invalid Sales Orders'(002).
ENDIF.
ENDFORM. " validate_entries
&----
*& Form get_sales_orders
&----
List of Sales Orders
----
FORM get_sales_orders .
CLEAR : git_vbak[].
SELECT vbeln
erdat
ernam
auart
netwr
waerk
FROM vbak
INTO TABLE git_vbak
WHERE vbeln IN s_vbeln
AND auart EQ p_auart.
IF sy-subrc EQ 0.
SORT git_vbak BY vbeln.
ENDIF.
ENDFORM. " get_sales_orders
&----
*& Form display_output
&----
Display List of Sales Orders
----
FORM display_output .
LOOP AT git_vbak INTO wa_vbak.
WRITE :/1(10) wa_vbak-vbeln HOTSPOT ON,
(10) wa_vbak-erdat,
(10) wa_vbak-ernam,
(4) wa_vbak-auart,
(20) wa_vbak-netwr,
(5) wa_vbak-waerk.
HIDE wa_vbak-vbeln.
CLEAR wa_vbak.
ENDLOOP.
ENDFORM. " display_output
&----
*& Form report_header
&----
text
----
FORM report_header .
WRITE :/1(10) 'SalesOrder'(003),
(10) 'Crt. Date'(004),
(10) 'SalesOrder'(005),
(4) 'OrdT'(006),
(20) 'Amount'(007),
(5) 'Curr'(008).
ENDFORM. " report_header
&----
*& Form get_items
&----
Get Line items
----
FORM get_items .
IF NOT git_vbak[] IS INITIAL.
CLEAR : git_vbap[].
SELECT vbeln
posnr
matnr
netwr
FROM vbap
INTO TABLE git_vbap
FOR ALL ENTRIES IN git_vbak
WHERE vbeln EQ git_vbak-vbeln.
IF sy-subrc EQ 0.
SORT git_vbap BY vbeln posnr.
ENDIF.
ENDIF.
ENDFORM. " get_items
&----
*& Form secondary_list_header
&----
Secondary List Header
----
FORM secondary_list_header .
WRITE 😕 'This is my secondary list:'(009), sy-lsind.
ENDFORM. " secondary_list_header
&----
*& Form get_items_list
&----
text
----
FORM get_items_list .
DATA: lv_fname(14) TYPE c VALUE 'WA_VBAK-VBELN',
lv_value TYPE vbak-vbeln.
GET CURSOR FIELD lv_fname VALUE lv_value.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_value
IMPORTING
output = lv_value.
WRITE 😕 ' I AMIN AT SELECTION-SCREEN'.
LOOP AT git_vbap INTO wa_vbap
WHERE vbeln EQ lv_value.
WRITE :/1(10) wa_vbap-vbeln,
(10) wa_vbap-posnr,
(18) wa_vbap-matnr,
(20) wa_vbap-netwr.
CLEAR : wa_vbap.
ENDLOOP.
ENDFORM. " get_items_list
&----
*& Form get_items_user_command
&----
text
----
FORM get_items_user_command .
WRITE 😕 ' I AMIN USER-COMMAND'.
CASE sy-ucomm.
WHEN 'DISP' OR 'DISM'.
LOOP AT git_vbap INTO wa_vbap
WHERE vbeln EQ wa_vbak-vbeln.
WRITE :/1(10) wa_vbap-vbeln,
(10) wa_vbap-posnr,
(18) wa_vbap-matnr,
(20) wa_vbap-netwr.
ENDLOOP.
CLEAR : git_fcode[],
wa_fcode.
wa_fcode-code = 'DISP'.
APPEND wa_fcode TO git_fcode.
wa_fcode-code = 'DISM'.
APPEND wa_fcode TO git_fcode.
ENDCASE.
SET PF-STATUS 'ABC' EXCLUDING git_fcode.
SET TITLEBAR 'AAA' WITH wa_vbak-vbeln.
ENDFORM. " get_items_user_command
Regards,
Bhaskar
2007 Jul 17 1:41 PM