End of Page in Line Selection
I want to trigger the end of page for the secondary list. The secondary list is displayed as a window. Is there any way to do this ?
Thanks in advance.
hi,
The end-of-page events get triggered for secondary list also. if the list is not long enough to cover the page and reaches the page end then it does not print. in that case, use skip line to skip that number of lines and reach the page end and then the end of page gets triggered and you will get the data that you have written in end of page.
Regards,
Richa
Similar Messages
-
TOP-OF-PAGE During line-selection in alv report
Hi Expart
In intractive Alv report u using top-of-page during line-selection . If u using so u give me one example with codeing .
Regards
BhabaniHi,
try this code...
*& Report ZCS_PRG8
REPORT Z_SJALV__PRG8.
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
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.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'this is my first alv pgm'.
HLINE-TYP = 'H'.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
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.
ENDFORM. "display_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
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.
ENDFORM. "event_call_ekpo
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
*retreiving values from the database table ekko
FORM DATA_RETRIEVAL_EKPO.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
ENDFORM.
FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: HLINE1 TYPE SLIS_LISTHEADER.
HLINE1-TYP = 'H'.
HLINE1-INFO = 'CHECKING PGM'.
ENDFORM.
FORM DISPLAY_ALV_EKPO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = '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_TITLE_EKPO
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT =
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKPO
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.
ENDFORM.
reward if helpful
regards
Shashi -
How To Print Field Value in TOP-OF-PAGE During Line Selection.
How To Print Field Value in TOP-OF-PAGE During Line Selection when double click on field.
(If my memory serves me well (not used for long time ago)
Assign values to system fields sy-tvar0 - sy-tvar9, they will replace the placeholders "&0" through "&9" in the list headers and column headers.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE: / 'Interactive Report &3'.
WRITE record-vbeln TO sy-tvar3.
Regards,
Raymond -
Page number in Top of page during line selection
Hi All,
I am generating an interactive report.
I want to display the same header at each page break.
How to restrict the page size in At line-selection?
I want to display page in format Page X of Y for each page break?How to handle it?
Thanks in advance.
Regards,
SandyHi,
Try the code:
REPORT ZPAGETEST NO STANDARD PAGE HEADING LINE-SIZE 40
LINE-COUNT 20.
DATA:COUNT(6) TYPE N.
DATA: LAST_PAGE_NO LIKE SY-PAGNO.
DATA: TOTPAGE(6) TYPE C .
TOP-OF-PAGE.
WRITE:20 SY-PAGNO ,'of', '££££££'.
START-OF-SELECTION.
DO 100 TIMES.
WRITE: / COUNT.
COUNT = COUNT + 1.
ENDDO.
LAST_PAGE_NO = SY-PAGNO.
TOTPAGE = SY-PAGNO.
DO LAST_PAGE_NO TIMES.
READ LINE 1 OF PAGE SY-INDEX .
REPLACE '££££££' WITH TOTPAGE INTO SY-LISEL.
MODIFY CURRENT LINE.
ENDDO.
Regards,
Sesh -
How to handle at line-selection event for 2 different fields
Hi,
The requirement is there are 2 fields in a report output.
One is Material number
and the other is Material document number.
On clicking the material number, the user should be taken to MM03 screen.
On clicking the Material document number, the user should be taken to MB03 screen.
I am able to take care of the first one by putting a HOTSPOT on material number and I am using at line-Selection event, call transaction MM03 and it is working fine
I want to know how can I handle similarly for the document number?
Thanks,
Kumar.Hi,
chk this sample code.
Some part of code is higlighted which meets ur rewuirement.
REPORT z50871sd_rept_interactiverept NO STANDARD PAGE HEADING.
STRUCTURE DECLARATIONS*
INTERNAL TABLE DECLARATIONS*
WORKAREA DECLARATIONS*
TYPES : BEGIN OF st_kna1,
kunnr TYPE kna1-kunnr, "CUSTOMER NUMBER
name1 TYPE kna1-name1, "CUSTOMER NAME
END OF st_kna1.
TYPES : BEGIN OF st_vbak,
kunnr TYPE kna1-kunnr,
vbeln TYPE vbak-vbeln, "SALES DOCUMENT NUMBER
erdat TYPE vbak-erdat, "DATE ON WHICH THE RECORD WAS CREATED
audat TYPE vbak-audat, "DOCUMENT DATE
auart TYPE vbak-auart, "SALES DOCUMENT TYPE
ernam TYPE vbak-ernam, "NAME OF PERSON WHO CREATED THE OBJECT.
augru TYPE vbak-augru, "ORDER REASON
END OF st_vbak.
TYPES : BEGIN OF st_vbap,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr, "SALES DOCUMENT ITEM
matnr TYPE vbap-matnr, "MATERIAL NUMBER
charg TYPE vbap-charg, "BATCH NUMBER
matkl TYPE vbap-matkl, "MATERIAL GROUP
posar TYPE vbap-posar, "ITEM TYPE
END OF st_vbap.
DATA : it_kna1 TYPE STANDARD TABLE OF st_kna1,
it_vbak TYPE STANDARD TABLE OF st_vbak,
it_vbap TYPE STANDARD TABLE OF st_vbap,
wa_kna1 TYPE st_kna1,
wa_vbak TYPE st_vbak,
wa_vbap TYPE st_vbap.
DATA : v_fld(15),
v_kunnr TYPE kna1-kunnr,
v_vbeln TYPE vbak-vbeln.
SELECT-OPTIONS*
PARAMETERS*
SELECT-OPTIONS so_kunnr FOR v_kunnr. "CUSTOMER NUMBER
PARAMETERS : p_max TYPE i. "NUMBER OF HITS
START-OF-SELECTION*
START-OF-SELECTION.
PERFORM get_customerdata.
SET PF-STATUS 'MENU1'.
AT LINE-SELECTION**
*AT LINE-SELECTION.*
*IF sy-lsind = 1.*
*PERFORM get_salesheader.*
*ELSEIF sy-lsind = 2.*
*PERFORM get_salesitemdata.*
*ENDIF.*
AT USER-COMMAND*
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'DISP'.
PERFORM get_salesheader.
WHEN 'ITEM'.
PERFORM get_salesitemdata.
WHEN 'VA03'.
SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
TOP-OF-PAGE*
TOP-OF-PAGE.
ULINE AT /1(56).
WRITE : /1 sy-vline ,
2(15) text-004 COLOR 1 ,
sy-vline ,
20(35) text-005 COLOR 1 ,
sy-vline.
ULINE AT /1(56).
TOP-OF-PAGE DURING LINE-SELECTION.*
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
PERFORM get_topofpage1.
WHEN 2.
PERFORM get_topofpage2.
ENDCASE.
FORM GET_CUSTOMERDATA*
FORM get_customerdata.
SELECT kunnr name1
FROM kna1
INTO TABLE it_kna1
UP TO p_max ROWS
WHERE kunnr IN so_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_kna1 INTO wa_kna1.
WRITE : / sy-vline,
2(15) wa_kna1-kunnr ,
sy-vline ,
20 wa_kna1-name1,
sy-vline.
HIDE : wa_kna1-kunnr , wa_kna1-name1.
CLEAR wa_kna1.
ENDLOOP.
ULINE AT : /1(56).
ELSE.
MESSAGE w000(z50871msg).
ENDIF.
ENDFORM. "GET_CUSTOMERDATA
FORM GET_SALESHEADER*
FORM get_salesheader.
SET PF-STATUS 'MENU2'.
GET CURSOR FIELD v_fld VALUE v_kunnr.
IF v_fld = 'WA_KNA1-KUNNR'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kunnr
IMPORTING
output = v_kunnr.
SELECT kunnr vbeln erdat audat auart ernam augru
FROM vbak
INTO TABLE it_vbak
WHERE kunnr = v_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_vbak INTO wa_vbak.
WRITE : / sy-vline ,
2(22) wa_vbak-vbeln ,
sy-vline,
27(25) wa_vbak-erdat ,
sy-vline ,
55(15) wa_vbak-audat ,
sy-vline ,
73(15) wa_vbak-auart ,
sy-vline,
91(16) wa_vbak-ernam ,
sy-vline,
109(13) wa_vbak-augru,
123 sy-vline.
HIDE : wa_vbak-vbeln.
CLEAR wa_vbak.
ENDLOOP.
*ULINE AT : /1(123).*
ELSE.
MESSAGE i015(z50871msg).
ENDIF.
ELSE.
MESSAGE i013(z50871msg).
ENDIF.
ENDFORM. "GET_SALESHEADER
FORM GET_SALESITEMDATA
FORM get_salesitemdata.
SET PF-STATUS space.
GET CURSOR FIELD v_fld VALUE v_vbeln.
IF v_fld = 'WA_VBAK-VBELN'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_vbeln
IMPORTING
output = v_vbeln.
SELECT vbeln posnr matnr charg matkl posar
FROM vbap
INTO TABLE it_vbap
WHERE vbeln = v_vbeln.
LOOP AT it_vbap INTO wa_vbap.
WRITE : /1 sy-vline,
2(13) wa_vbap-posnr ,
sy-vline,
18(18) wa_vbap-matnr ,
sy-vline,
40(13) wa_vbap-charg ,
sy-vline,
56(16) wa_vbap-matkl ,
sy-vline,
75 wa_vbap-posar,
112 sy-vline.
CLEAR wa_vbap.
ENDLOOP.
ULINE AT : /1(112).
ELSE.
MESSAGE i014(z50871msg).
ENDIF.
ENDFORM. "GET_SALESITEMDATA
FORM GET_TOPOFPAGE1
FORM get_topofpage1.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
75 text-001 ,
wa_kna1-name1,
123 sy-vline.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2(22) text-006 COLOR 1,
sy-vline,
27(25) text-007 COLOR 1 ,
sy-vline ,
55(15) text-008 COLOR 1 ,
sy-vline ,
73(15) text-009 COLOR 1 ,
sy-vline,
91(16) text-010 COLOR 1 ,
sy-vline,
109(13) text-011 COLOR 1,
123 sy-vline.
ULINE AT : /1(123).
ENDFORM. "GET_TOPOFPAGE1
FORM GET_TOPOFPAGE2
FORM get_topofpage2.
ULINE AT : /1(112).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
35 text-001 ,
wa_kna1-name1 ,
85 text-003 ,
wa_vbak-vbeln ,
112 sy-vline.
ULINE AT : /1(112).
WRITE : /1 sy-vline,
2(13) text-012 COLOR 1,
sy-vline,
18(18) text-013 COLOR 1 ,
sy-vline,
40(13) text-014 COLOR 1 ,
sy-vline,
56(16) text-015 COLOR 1 ,
sy-vline,
75 text-016 COLOR 1 ,
112 sy-vline.
ULINE AT : /1(112).
ENDFORM. "GET_TOPOFPAGE2
Regards
Sandeep Reddy -
Multiple line selection in report list
HI All,
I have a requirment to display multiple line items with a checkbox prefixed, and i should be able to select multiple line items with the checkbox provided and should keep the selectd line items in an internal table(note the list is not ALG LIST or GRID)
can anybody please tell me how to select multiple line items and and keep the selected items in a in a normal report list.
RegardsHii,
Have a look at this sample code
Report z_sdn.
*" Data declarations...................................................
* Work variables *
DATA:
BEGIN OF fs_spfli,
carrid LIKE spfli-carrid, " Airline Code
connid LIKE spfli-connid, " Flight Connection Number
airpfrom LIKE spfli-airpfrom, " Departure airport
airpto LIKE spfli-airpto, " Destination airport
deptime LIKE spfli-deptime, " Departure time
arrtime LIKE spfli-arrtime, " Arrival time
END OF fs_spfli,
BEGIN OF fs_sflight,
carrid LIKE sflight-carrid, " Airline Code
connid LIKE sflight-connid, " Flight Connection Number
fldate LIKE sflight-fldate, " Flight date
seatsmax LIKE sflight-seatsmax, " Maximum seats in economy class
seatsocc LIKE sflight-seatsocc, " Occupied seats in economyclass
END OF fs_sflight,
w_checkbox TYPE c, " Variable for checkbox
w_currentline TYPE i, " Variable to display current
" line
w_lines TYPE i,
w_read TYPE c .
* Internal Table to hold flight schedule information *
DATA:
t_spfli LIKE
TABLE OF
fs_spfli.
* Internal Table to hold flight information *
DATA:
t_sflight LIKE
TABLE OF
fs_sflight,
t_sflight1 LIKE t_sflight.
* START-OF-SELECTION Event *
START-OF-SELECTION.
PERFORM get_data_spfli.
* END-OF-SELECTION Event *
END-OF-SELECTION.
SET PF-STATUS 'MENU'.
PERFORM display_data_spfli.
* TOP-OF-PAGE Event *
TOP-OF-PAGE.
PERFORM header_table_spfli.
* AT LINE-SELECTION EVENT *
AT LINE-SELECTION.
SET PF-STATUS space.
IF sy-lsind EQ 1 AND sy-lilli GE 4.
PERFORM get_data_sflight.
PERFORM display_data_sflight.
PERFORM flag_line.
ENDIF. " IF sy-lsind EQ 1..
* AT USER-COMMAND *
AT USER-COMMAND.
IF sy-lsind EQ 1.
SET PF-STATUS space.
CASE sy-ucomm.
WHEN 'DISPLAY'.
PERFORM get_data_sflight1.
PERFORM display_data_sflight.
WHEN 'SELECTALL'.
PERFORM select_all.
PERFORM flag_line.
WHEN 'DESELECTAL'.
PERFORM deselect_all.
PERFORM flag_line.
ENDCASE. " CASE sy-ucomm
ENDIF. " IF sy-lsind EQ 1
* TOP-OF-PAGE DURING LINE-SELECTION *
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM sec_list_heading.
*& Form get_data_spfli
* This subroutine fetches the data from SPFLI
* This subroutine does not have parameters to pass
FORM get_data_spfli .
SELECT carrid " Airline Code
connid " Flight Connection Number
airpfrom " Departure airport
airpto " Destination airport
deptime " Departure time
arrtime " Arrival time
FROM spfli
INTO TABLE t_spfli.
ENDFORM. " GET_DATA_SPFLI
*& Form display_data_spfli
* This subroutine displays the data of SPFLI
* This subroutine does not have parameters to pass
FORM display_data_spfli .
LOOP AT t_spfli INTO fs_spfli.
WRITE: /02 w_checkbox AS CHECKBOX,
05 w_read,
fs_spfli-carrid UNDER text-001,
fs_spfli-connid UNDER text-002,
fs_spfli-airpfrom UNDER text-003,
fs_spfli-airpto UNDER text-004,
fs_spfli-deptime UNDER text-005,
fs_spfli-arrtime UNDER text-006.
HIDE:
fs_spfli-carrid,
fs_spfli-connid.
ENDLOOP. " LOOP AT t_spfli..
ENDFORM. " DISPLAY_DATA_SPFLI
*& Form header_table_spfli
* This subroutine diplays the headings of table spfli
* This subroutine does not have parameters to pass
FORM header_table_spfli .
WRITE: /10 text-001 COLOR 4,
25 text-002 COLOR 4,
40 text-003 COLOR 4,
55 text-004 COLOR 4,
70 text-005 COLOR 4,
85 text-006 COLOR 4.
ENDFORM. " HEADER_TABLE
*& Form get_data_sflight
* This subroutine fetches the data from SFLIGHT
* This subroutine does not have interface parameters to pass
FORM get_data_sflight .
SELECT carrid " Airline Code
connid " Flight Connection Number
fldate " Flight date
seatsmax " Maximum seats in economy class
seatsocc " Occupied seats in economyclass
FROM sflight
INTO TABLE t_sflight
WHERE carrid EQ fs_spfli-carrid
AND connid EQ fs_spfli-connid.
ENDFORM. " GET_DATA_SFLIGHT
*& Form display_data_sflight
* This subroutine displays the SFLIGHT data
* This subroutine does not have interface parameters to pass
FORM display_data_sflight .
LOOP AT t_sflight INTO fs_sflight.
WRITE: / fs_sflight-carrid UNDER text-001,
fs_sflight-connid UNDER text-002,
fs_sflight-fldate UNDER text-007,
fs_sflight-seatsmax UNDER text-008 LEFT-JUSTIFIED,
fs_sflight-seatsocc UNDER text-009 LEFT-JUSTIFIED.
ENDLOOP.
CLEAR: fs_sflight.
ENDFORM. " DISPLAY_DATA_sflight
*& Form sec_list_heading
* This subroutine diplays the headings of table spfli
* This subroutine does not have interface parameters to pass
FORM sec_list_heading .
WRITE: /2 text-001 COLOR 4,
15 text-002 COLOR 4,
33 text-007 COLOR 4,
45 text-008 COLOR 4,
60 text-009 COLOR 4.
ENDFORM. " SEC_LIST_HEADING
*& Form get_data_sflight1
* This subroutine displays the data from SFLIGHT according to checkbox
* clicked.
* This subroutine does not have interface parameters to pass
FORM get_data_sflight1 .
DATA:
lw_checkbox TYPE c.
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_currentline = 3 + sy-index.
CLEAR:
w_checkbox,
fs_spfli.
READ LINE w_currentline FIELD VALUE
w_checkbox INTO lw_checkbox
fs_spfli-carrid INTO fs_spfli-carrid
fs_spfli-connid INTO fs_spfli-connid.
IF sy-subrc EQ 0.
IF lw_checkbox EQ 'X'.
SELECT carrid " Airline Code
connid " Flight Connection Number
fldate " Flight Date
seatsmax " Max Seats
seatsocc " Occupied Seats
FROM sflight
INTO TABLE t_sflight1
WHERE carrid EQ fs_spfli-carrid
AND connid EQ fs_spfli-connid.
IF sy-subrc EQ 0.
APPEND LINES OF t_sflight1 TO t_sflight.
ENDIF. " IF sy-subrc EQ 0.
ENDIF. " IF lw_checkbox EQ 'X'
ENDIF. " IF sy-subrc EQ 0.
ENDDO. " DO w_lines TIMES
ENDFORM. " GET_DATA_SFLIGHT1
*& Form select_all
* This subroutine selects all the records of SPFLI
* This subroutine does not have interface parameters to pass
FORM select_all .
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_currentline = sy-index + 3.
READ LINE w_currentline FIELD VALUE
w_checkbox INTO w_checkbox.
IF sy-subrc = 0.
MODIFY LINE w_currentline FIELD VALUE
w_checkbox FROM 'X'.
ENDIF. " IF sy-subrc = 0.
ENDDO. " DO lw_line TIMES.
ENDFORM. " SELECT_ALL
*& Form deselect_all
* This subroutine deselects all the records of SPFLI
* This subroutine does not have interface parameters to pass
FORM deselect_all .
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_currentline = sy-index + 3.
READ LINE w_currentline FIELD VALUE
w_checkbox INTO w_checkbox.
IF sy-subrc = 0.
MODIFY LINE w_currentline FIELD VALUE
w_checkbox FROM ' '.
ENDIF. " IF sy-subrc = 0.
ENDDO. " DO lw_line TIMES.
ENDFORM. " DESELECT_ALL
*& Form flag_line
* This subroutine flags the line which has been read
* This subroutine does not have interface parameters to pass
FORM flag_line .
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_checkbox = 'X'.
READ LINE sy-lilli FIELD VALUE
w_read INTO w_read
w_checkbox INTO w_checkbox.
IF sy-subrc EQ 0.
MODIFY CURRENT LINE
FIELD FORMAT w_checkbox INPUT OFF
FIELD VALUE w_read FROM '*'.
ENDIF. " IF sy-subrc EQ 0
ENDDO. " DO w_lines TIMES
ENDFORM. " FLAG_LINE
Regards
Abhijeet -
In my report,from basic list I want to call my customized transaction and want to fill that clicked field to that customised transaction.
problem is :
I am using at line selection.
In basic list I have header then many no of rows of data.
When I click header also it its taking me to cutomise transaction which I dont want.
I want to call my customise transactions after the header information and when i double click it it should take me to customise transaction and that row data should be filled in that transaction.
Can any body suggest me how to do it ?
thanks
kumarHi Kumar,
Try to refer the following code :
*" Table declarations...................................................
TABLES :
vbak, " Sales Document: Header Data
vbap. " Sales Document: Item Data
*" Selection Screen Elements...........................................
SELECT-OPTIONS :
s_kunnr FOR vbak-kunnr. " Customer Number
*" Data declarations...................................................
* Work Variables *
DATA :
w_fname(20) TYPE c. " Holds Fieldname
* Structure to hold Sales Document: Header Data *
DATA :
BEGIN OF fs_vbak,
vbeln LIKE vbak-vbeln, " Sales Document
kunnr LIKE vbak-kunnr, " Customer Number
bstnk LIKE vbak-bstnk, " Customer Purchase Order Number
END OF fs_vbak.
* Structure to hold Sales Document: Item Data *
DATA :
BEGIN OF fs_vbap,
vbeln LIKE vbap-vbeln, " Sales Document
posnr LIKE vbap-posnr, " Sales Document Item
matnr LIKE vbap-matnr, " Material Number
kwmeng LIKE vbap-kwmeng, " Cumulative Order Quantity
netpr LIKE vbap-netpr, " Price
END OF fs_vbap.
* Structure to hold General Data in Customer Master *
DATA :
BEGIN OF fs_kna1,
kunnr LIKE kna1-kunnr, " Customer Number
name LIKE kna1-name1, " Customer Name
END OF fs_kna1.
* Internal table to hold Sales Document: Header Data *
DATA :
t_vbak LIKE
STANDARD TABLE
OF fs_vbak.
* Internal table to hold Sales Document: Item Data *
DATA :
t_vbap LIKE
STANDARD TABLE
OF fs_vbap.
* Internal table to hold General Data in Customer Master *
DATA :
t_kna1 LIKE
STANDARD TABLE
OF fs_kna1.
* TOP-OF-PAGE EVENT *
TOP-OF-PAGE.
PERFORM top_of_page.
* TOP-OF-PAGE DURING LINE-SELECTION EVENT *
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM topofpage_during_linesel.
* AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN.
PERFORM at_selection_screen.
* START-OF-SELECTION EVENT *
START-OF-SELECTION.
PERFORM start_of_selection.
* AT USER-COMMAND EVENT *
AT USER-COMMAND.
PERFORM user_command.
* AT LINE-SELECTION EVENT *
AT LINE-SELECTION.
PERFORM at_line_selection.
*& Form top_of_page
* This Subroutine Performs the Event Top-Of-Page *
* There are no interface parameters to be passed to this subroutine. *
FORM top_of_page .
WRITE :/50 'Customer Information'(001).
ULINE.
FORMAT COLOR 1.
WRITE :/10 'Customer Number'(002),
40 'Customer Name'(003),
80 'Order number'(004),
100 space.
ENDFORM. " FORM TOP_OF_PAGE
*& Form TOPOFPAGE_DURING_LINESEL *
* This Subroutine Performs the Event Top-Of-Page During Line-Selection *
* There are no interface parameters to be passed to this subroutine. *
FORM topofpage_during_linesel .
WRITE :/50 'Item Details'(007).
ULINE.
FORMAT COLOR 1.
WRITE :/5 'Sales Doc No.'(008),
23 'Sales Doc Item'(009),
42 'Material No.'(010),
59 'Order Qty'(011),
73 'Price'(012),
83 space.
ENDFORM. " FORM TOPOFPAGE_DURING_LINESEL
*& Form AT_SELECTION_SCREEN *
* This Subroutine Performs the Required Input Validations *
* There are no interface parameters to be passed to this subroutine. *
FORM at_selection_screen .
SELECT SINGLE kunnr
FROM vbak
INTO fs_vbak-kunnr
WHERE kunnr IN s_kunnr.
IF sy-subrc NE 0.
MESSAGE e184(bc_global) WITH text-013.
ENDIF. " IF SY-SUBRC NE 0
IF s_kunnr IS INITIAL.
MESSAGE e184(bc_global) WITH text-014.
ENDIF. " IF S_KUNNR IS INITIAL
ENDFORM. " FORM AT_SELECTION_SCREEN
*& Form start_of_selection
* This Subroutine Performs the Event START-OF-SELECTION *
* There are no interface parameters to be passed to this subroutine. *
FORM start_of_selection .
SET PF-STATUS 'YMENU1'.
SELECT vbeln " Sales Document
kunnr " Customer Number
bstnk " Customer Purchase Order Number
FROM vbak
INTO TABLE t_vbak
WHERE kunnr IN s_kunnr.
IF sy-subrc EQ 0.
SELECT kunnr " Customer Number
name1 " Customer Name
FROM kna1
INTO TABLE t_kna1
FOR ALL ENTRIES IN t_vbak
WHERE kunnr = t_vbak-kunnr.
IF sy-subrc EQ 0.
LOOP AT t_vbak INTO fs_vbak.
LOOP AT t_kna1 INTO fs_kna1 WHERE kunnr = fs_vbak-kunnr.
WRITE :/ fs_vbak-kunnr UNDER text-002,
fs_kna1-name UNDER text-003,
fs_vbak-bstnk UNDER text-004.
HIDE : fs_vbak-kunnr,
fs_vbak-bstnk,
fs_vbak-vbeln.
ENDLOOP. " LOOP AT KNA1 INTO FS_KNA1
ENDLOOP. " LOOP AT T_VBAK INTO FS_VBAK
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDFORM. " FORM START_OF_SELECTION
*& Form AT_LINE_SELECTION
* This Subroutine performs AT LINE-SELECTION Event *
* There are no interface parameters to be passed to this subroutine. *
FORM at_line_selection .
IF sy-lsind = 1.
SET PF-STATUS space.
SELECT vbeln " Sales Doc No.
posnr " Sales Doc Item
matnr " Material Number
kwmeng " Cumulative Order Quantity
netpr " Net Price
FROM vbap
INTO TABLE t_vbap
WHERE vbeln = fs_vbak-vbeln.
IF sy-subrc EQ 0.
LOOP AT t_vbap INTO fs_vbap.
WRITE :/ fs_vbap-vbeln UNDER text-008,
fs_vbap-posnr UNDER text-009,
fs_vbap-matnr UNDER text-010,
49 fs_vbap-kwmeng,
67 fs_vbap-netpr,
83 space.
ENDLOOP. " LOOP AT T_VBAP INTO FS_VBAP
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-LSIND = 1
ENDFORM. " FORM AT_LINE_SELECTION
*& Form USER_COMMAND *
* This Subroutine performs operations according to the User Command *
* There are no interface parameters to be passed to this subroutine. *
FORM user_command .
GET CURSOR FIELD w_fname.
CASE sy-ucomm.
WHEN 'CUSTINFO'.
IF w_fname EQ 'FS_KNA1-KUNNR'.
SET PARAMETER ID 'KUN' FIELD fs_kna1-kunnr.
CALL TRANSACTION 'XD03'.
ELSE.
MESSAGE e184(bc_global) WITH text-005.
ENDIF. " IF W_FNAME EQ 'FS_KNA1-KUNNR'
WHEN 'ORDERINFO'.
IF w_fname EQ 'FS_VBAK-BSTNK'.
SET PARAMETER ID 'AUN' FIELD fs_vbak-bstnk.
CALL TRANSACTION 'VA03'.
ELSE.
MESSAGE e184(bc_global) WITH text-006.
ENDIF. " IF W_FNAME EQ 'FS_VBAK-BSTNK'
ENDCASE. " CASE SY-UCOMM
ENDFORM. " FORM USER_COMMAND
This report is used to Fetch & Display the Customer Number, Name and the Customer Purchase Order Number from Tables VBAK & KNA1.When the user places the cursor on the customer and clicks on the button u2018Customer Infou2019,the User is taken to the Transaction 'XD03'. When the user places the cursor on the order & clicks on the button u2018Order Infou2019, the User is taken to the transacion 'VA03'. When the User selects a line on the List the order details are Displayed
Please relate this to your requirement.
Regards,
Swapna. -
Always Use Primary Line / Auto Line Select CM 4.1(3)sr3c
Is it correct that the "Always Use Primary Line" system parameter and the phone device page "Auto Line Select" setting work together to affect a phone's off-hook behavior for incoming calls? I changed the Always Use Primary Line from the default (False to True) to change the behavior and force primary line only when the phone goes off-hook. When I then enabled Auto Line Select on the 7960G, I expected to reverse this global setting for that device only. But, that did not happen. In fact, no matter how Always Use Primary Line is set (True or False), the device page setting Auto Line Select (enable or disable) does not appear to cause any change at all. Has anyone else encountered this? If changing the Service Parameter takes effect without restarting callmanagers, wouldn't resetting the phone device force the change on the device page to take effect? Or, do I not understand the relationship between these two settings?
Auto Line Select comes into play when you are already on the phone and you have a new incoming call on another line, then should the focus change to that new ringing line so it can show you the caller-id or should the focus be on the active line. Depending on this, the softkeys and everything change on your screen and you don't have to press the line button to see all the keys.
Always use Prime Line is primary used when the phone goes off-hook. This determines if you want to go off-hook on the primary line all the time or not. If you choose to always use primary line, then everytime you go
off-hook, we use the first line on the phone and it does not matter if there is a call ringing on another line.
If its set to false, then when you go off-hook, it will go off hook on a line which is ringing and not your primary line. -
At line-selection & At user-command
Hi friends,
I have a small doubt. Can we user AT LINE-SELECTION & AT USER-COMMAND in one report..plz gimme an example.
Thanks is advance,
regards,
Ramhi, try these with example i have given.
Write the set pf-status under start-of-selection,
In the set pf-status under the function keys give
F2 Pick Choose.
u can validate the at line-selection by taking..
At line-selection.
case sy-lsind.
when 1.
message....
when 2.
message....
endcase.
similarly, for At user-command.
case sy-ucomm.
when 'back'.
message...
when...
endcase.
Syntax
AT USER-COMMAND.
Effect
This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
Note
Self-defined function codes are all those that include character combinations, except for the following:
The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
Table 1
Function code Function
%CTX Call a context menu
%EX Exit
%PC Save to file
%PRI Print
%SC Search for ...
%SC+ Find next
%SL Search in office
%ST Save to report tree
Table 2
Function code Function
BACK Back
P- Scroll to previous page
P-- Scroll to first page
P+ Scroll to next page
P++ Scroll to last page
PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
PL- Scroll to first line of the page
PL-n Scroll n lines back
PL+ Scroll to last line of the page
PL+n Scroll n lines up
PNOP No effect
PP- Scroll back one page
PP-n Scroll n pages back
PP+ Scroll one page forward
PP+n Scroll n pages forwad
PPn Scroll to beginning of page n
PRI, PRINT Print
PS-- Scroll to first column
PS++ Scroll to last column
PS- Scroll one column to the left
PS-n Scroll n columns to the left
PS+ Scroll one column to the right
PS+n Scroll n columns to the right
PSn Scroll to column n
PZn Scroll to line n
RW Cancel
here is an example handling both the commands in a program.
EXAMPLE:
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
Hope this may be helpful.
Sri.
pls:award points. -
At line-selection and At-user command
Hi friends,
Can we use both those events at a time in report?
If so can any body provide me sample code?
Regards<b>Example for AT LINE-SELECTION</b>
REPORT demo_list_at_line_selection.
START-OF-SELECTION.
WRITE 'Basic List'.
AT LINE-SELECTION.
WRITE: 'Secondary List by Line-Selection',
/ 'SY-UCOMM =', sy-ucomm.
When you run the program, the basic list appears with the standard list status. The detail list shows that SY-UCOMM has the value PICK.
<b>Example for AT USER-COMMAND</b>
REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
When you run the program, the system displays the following basic list with a the page header defined in the program:
You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
I hope it helps.
For more details have a look at below link.
http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
Best Regards,
Vibha
*Please mark all the helpful answers -
How to handle the single line selection in table control
Hi All,
I am facing a problem in the table control of modulepool program.
I have line selection as "Single" in the table control attributes. But when i am selecting a line in the table control as long as it is in the same page,the line selection is single but when i am selecting the line in the next page,the previous selection is not deselected. So I am seeing two selection for "Single line selector" attribute.
Could any one help me solve this problem?
Thanks & Regards,
S.LakshmiHi Lakshmi,
Just Go to Table control , click on it , you can see the attributes screen , there you can see option for
<b>Line selection</b>
none
multiple selection
single selection
check the radio button single selection.
that will solve your problem..
regards
vijay -
Where does the control moves at first at END-OF PAGE or END-OF-SELECTION
Is END-OF PAGE triggered like TOP-OF-PAGE from the AT-SELECTON-SCREEN automatically with a write statement & where does the control moves at first
at END-OF PAGE or END-OF-SELECTION?Hi,
1. End-of-selection:
This event is triggered after the start-of-selection. to display the contents on the report.
2.Top-of-page: Every time a new page is triggered. Mainly this is used for header of the report.
3. End-of-page : every time the list data reaches the footer region of the page.
This way first data is disaplyed then it reaches the footer..
first End-of-selection then End-of-page
These example may help u in detail...
Leaving Event Blocks Using STOP
If you use the STOP statement within an event block, the system stops processing the block immediately. The ABAP runtime environment triggers the next event according to the following diagram:
Before and during selection screen processing, the next event in the prescribed sequence is always called. From the AT SELECTION-SCREEN event onwards, the system always jumps from a STOP statement directly to the END-OF-SELECTION statement. Once the corresponding event block has been processed, the system displays the list.
The following program is connected to the logical database F1S.
REPORT EVENT_TEST.
NODES: SPFLI, SFLIGHT, SBOOK.
START-OF-SELECTION.
WRITE 'Test program for STOP'.
GET SBOOK.
WRITE: 'Bookid', SBOOK-BOOKID.
STOP.
END-OF-SELECTION.
WRITE: / 'End of Selection'.
This produces the following output:
Test Program for STOP
Bookid 00010001
End of Selection
As soon as the first line of SBOOK has been read, the system calls the END-OF-SELECTION event block.
Exiting Event Blocks Using EXIT
If you use the EXIT statement within an event block but not in a loop, the system stops processing the block immediately. The ABAP runtime environment triggers the next event according to the following diagram:
Before and during selection screen processing, the next event in the prescribed sequence is always called. From the START-OF-SELECTION event onwards, the system starts the list processor directly when the EXITstatement occurs, and displays the list.
If the EXIT statement occurs inside a DO, WHILE, or LOOP loop, it is the loop that terminates, not the processing block.
The following executable program is connected to the logical database F1S.
REPORT demo_program_exit_1.
NODES: spfli, sflight, sbook.
START-OF-SELECTION.
WRITE 'Test Program for EXIT'.
GET sbook.
WRITE: 'Bookid', sbook-bookid.
EXIT.
END-OF-SELECTION.
WRITE: / 'End of selection'.
This produces the following output:
Test Program for EXIT
Bookid 00010001
After the first line of SBOOK has been read, the list is displayed immediately.
The following executable program is connected to the logical database F1S.
REPORT demo_program_exit_2.
NODES: spfli, sflight, sbook.
DATA flag(1) TYPE c.
AT SELECTION-SCREEN.
IF carrid-low IS INITIAL.
flag = 'X'.
EXIT.
ENDIF.
START-OF-SELECTION.
IF flag = 'X'.
WRITE / 'No input for CARRID'.
EXIT.
ENDIF.
GET spfli.
GET sflight.
GET sbook.
END-OF-SELECTION.
WRITE / 'End of Selection'.
If the user does not enter a value for CARRID-LOW, the output appears as follows:
No selection made for CARRID
After the first EXIT statement, the next START-OF-SELECTION event is triggered. After the second EXITstatement, the output list is displayed.
Regards. -
How to go to previous pages using AT LINE-SELECTION
Using AT LINE-SELECTION we can move on to next page up to 20 pages.
Is it possible to go navigate to the previous pages?
Letu2019s say, now I am in 15th page. I have to go to 5th page from 15th.
Any comments appreciated.Hi,
set your list index = 5 when u reach list 15.
case:
when Sy-lsind = 15.
sy-lsind = 5.
thanks, -
End of Page event not triggering in ALV report
Hello,
I am developing an ALV report using REUSE_ALV_LIST_DISPLAY. Whatever I write in top_of_page, it will be displayed in the header portion of the output.
But I want to display some footer text at the end of the page. The problem I am facing is, the WRITE statements within end_of_page are not displayed when the report is run.
I have populated the i_events as follows :
FORM f_events CHANGING p_i_events TYPE slis_t_event.
CONSTANTS : l_c_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
l_c_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.
DATA : l_wa_event TYPE slis_alv_event.
Returns table of possible events
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_i_events.
To append internal table holding event names with event 'TOP OF PAGE'
READ TABLE p_i_events INTO l_wa_event
WITH KEY name = slis_ev_top_of_page.
IF sy-subrc = 0.
MOVE l_c_top_of_page TO l_wa_event-form.
APPEND l_wa_event TO p_i_events.
ENDIF.
To append internal table holding event names with event 'END OF PAGE'
READ TABLE p_i_events INTO l_wa_event
WITH KEY name = slis_ev_end_of_page.
IF sy-subrc = 0.
MOVE l_c_end_of_page TO l_wa_event-form.
APPEND l_wa_event TO p_i_events.
ENDIF.
ENDFORM. "f_events
Regds
RajeshHi have a look at the following code, and change ur code for end of page accordingly. this will resolve ur problem.
This is a basic ALV with the followings:-
- Page Heading
- Page No
- Sub-Total
- Grand Total
REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
*END OF ZALV PROGRAM
Satish -
How to use AT LINE-SELECTION and AT USER-COMMAND in one report????
Dear all,
I have a problem in reports I want to use AT USER-COMMAND.and AT LINE-SELECTION.both in the one report.
But as soon as I use SET PF-STATUS my AT LINE-SELECTION event stop workingand only AT USER-COMMAND is working.
How can I use both of them in one report for your reference I am giving my test program below.
REPORT ZTEST111 .
SET PF-STATUS '100'.
DO 10 TIMES.
WRITE:/ SY-INDEX.
HIDE SY-INDEX.
ENDDO.
START-OF-SELECTION.
AT LINE-SELECTION.
MESSAGE I002(SY) WITH SY-INDEX.
AT USER-COMMAND.
MESSAGE I002(SY) WITH 'USER COMMAND'.
END-OF-SELECTION.
Thanks in advance
Sachin Gautamhi
Syntax
AT USER-COMMAND.
Effect
This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
Note
Self-defined function codes are all those that include character combinations, except for the following:
The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
Table 1
Function code Function
%CTX Call a context menu
%EX Exit
%PC Save to file
%PRI Print
%SC Search for ...
%SC+ Find next
%SL Search in office
%ST Save to report tree
Table 2
Function code Function
BACK Back
P- Scroll to previous page
P-- Scroll to first page
P+ Scroll to next page
P++ Scroll to last page
PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
PL- Scroll to first line of the page
PL-n Scroll n lines back
PL+ Scroll to last line of the page
PL+n Scroll n lines up
PNOP No effect
PP- Scroll back one page
PP-n Scroll n pages back
PP+ Scroll one page forward
PP+n Scroll n pages forwad
PPn Scroll to beginning of page n
PRI, PRINT Print
PS-- Scroll to first column
PS++ Scroll to last column
PS- Scroll one column to the left
PS-n Scroll n columns to the left
PS+ Scroll one column to the right
PS+n Scroll n columns to the right
PSn Scroll to column n
PZn Scroll to line n
RW Cancel
Maybe you are looking for
-
Not able to access a file referenced from a HTML file
Hi, Using UCM i am checking two files aboutus.html and aboutusBanner.png in About Us FOLDER.Checkin is happening perfectly well. Now In JDEVELOPER I am creating a webcenter application (named MyPortalApplication) and accessing those file using a conn
-
Cineform files don't work well on Mavericks
Quicktime converts a CineForm file before playback in Mavericks. Why is that? Before Mavericks it worked just fine. Even previewing in a Finder-window isn't possible anymore. Anybody out there who knows why Apple has done this? Is there a workarround
-
How to use java script on click of JSF TAB
Hello Guies... I want to use some java script on the click of JSF Tab. Any suggestion will be appriciated.... Regard Roshan
-
My airport express disconnects intermitently
Hi all, My airport express keeps disconnecting repeatedly. It's connected to a router via ethernet, using DHCP, and in bridge mode, to create a wireless network, has all the latest updates and it has been reset. But still, all in a sudden, the light
-
I'm replicating to a DVD-9 and my final project in DVDSP is coming in at 7.6. I haven't built yet, so I don't know if that will go up even higher, but am I already too close to the edge to have my project replicated safely? I believe there is a certa