on 2006 Feb 16 5:49 PM
Hi
I created a GUI-STATUS using se41 and added it in my abap report:
start-of-selection.
set pf-status 's001'.
I also added an icon in the GUI-STATUS to use for calling a function 'ALVG', now, where do I add the code that will execute this function, is it in SE41 or in the report itself? I also tried modifying screen 1000 but got an error message that this screen should not be modified.
Need some advice on this one, thanks!
You will need to put it directly in your program under the AT USER-COMMAND event.
start-of-selection.
...
AT USER-COMMAND.
case sy-ucomm.
when 'ALVG'.
* do something.
endcase.
REgards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ricky
You can as well write the write statemants and get the report list.
The PF status set will reflect only on the report list that has come up for your write statements. and once you reach this screen you will get your icon too so if the user clicks here the control jumps to "at user-command" event so you can write your ALV code under this event.
I guess I have answers you correctly... let me know if I am wrong.
Regards
Santosh
Ricky, this is working good for me.
button shows up on the list, user presess it and the AT USER COMMAND event is fire.
report zrich_0003.
parameters: p_check.
start-of-selection.
set pf-status 'TEST'.
do 100 times.
write:/ sy-index.
enddo.
at user-command.
case sy-ucomm.
when 'ALVG'.
* Do something.
check sy-subrc = 0.
endcase.
Regards,
RIch Heilman
REPORT ZTEST_REPORT_ALV.
type-pools: slis.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: BEGIN OF I_TAB OCCURS 0,
FIELD1 TYPE I,
FIELD2 TYPE I,
END OF I_TAB.
start-of-selection.
set pf-status 'AAA'.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
loop at I_TAB.
write:/ I_TAB-FIELD1,
I_TAB-FIELD2.
endloop.
at user-command.
case sy-ucomm.
when 'ALVG'.
PERFORM INITIALIZE_FIELDCAT USING GT_FIELDCAT[].
PERFORM CALL_ALV TABLES I_TAB[]
USING GT_FIELDCAT.
when 'BACk'.
endcase.
*&---------------------------------------------------------------------*
*& Form initialize_fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GT_FIELDCAT[] text
*----------------------------------------------------------------------*
FORM INITIALIZE_FIELDCAT USING L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
LS_FIELDCAT-FIELDNAME = 'FIELD1'.
LS_FIELDCAT-KEY = 'X'.
LS_FIELDCAT-COL_POS = 1.
LS_FIELDCAT-SELTEXT_S = 'field1'.
APPEND LS_FIELDCAT TO L_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'FIELD2'.
LS_FIELDCAT-KEY = ' '.
LS_FIELDCAT-COL_POS = 2.
LS_FIELDCAT-SELTEXT_S = 'field2'.
APPEND LS_FIELDCAT TO L_FIELDCAT.
CLEAR LS_FIELDCAT.
ENDFORM. " initialize_fieldcat
FORM CALL_ALV TABLES P_TAB
USING P_GT_FIELDCAT .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = P_GT_FIELDCAT
TABLES
T_OUTTAB = P_TAB[]
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. " call_alv
Please see this example program. When the user clics on the button in the list, the alv grid is fired, then the user clicks back from the ALV grid, the list is again displayed.
report zrich_0003.
data: imara type table of mara with header line.
start-of-selection.
set pf-status 'TEST'.
select * into table imara from mara up to 100 rows.
perform write_list.
at user-command.
case sy-ucomm.
when 'ALVG'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'MARA'
tables
t_outtab = imara.
endcase.
*---------------------------------------------------------------------*
* FORM write_list *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form write_list.
loop at imara.
write:/ imara-matnr.
endloop.
endform.
Regards,
Rich Heilman
Hi Ricky,
why do you need a PF-status?
is there any special requirement?
start-of-selection.
set pf-status 'S001'.
at use-command.
case sy-ucomm.
when 'BACK'.
leave to screen 0.
when 'SAVE'.
when 'EXIT'.
when 'CANC'.
endcase.
Regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ricky
You got to write the code for this function in your report program itself.
write this piece of code in "at usercommand " event.
under this event have a case endcase. condition where in you can check for 'ALVG' and here write the necessary code for the same.
Regards
Santosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
13 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.