AT LINE SELECTION AN AT USER-COMMAND IN ONE REPORT
hiiii friends.....
hw can i go for both at line selection an at user comond in one report....
ie if double click on basic list it should shw sm output an when i choose menu optoin it should perform sm other output......
You need to crate a PF-Status and in the PF-staus you need to include some essentials buttons and the button for your list on the USER-COMMAND.
Say,
BACK
EXIT
CANC
PICK ... should be assigned to F2 .. to work with LINE-SELECTION.
NEW_LIST ... for USER-COMMAND
In your report:
START-OF-SELECTION.
SET PF-STATUS 'Z_OWN'.
AT LINE-SELECTION.
WRITE : 'I AM LINE SELECTION'.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'NEW_LIST'.
WRITE / 'I AM CALLED FROM USER COMMAND'.
ENDCASE.
Regards,
Naimesh Patel
Similar Messages
-
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 -
ITS URGENT QUES ON AT LINE-SELECTION AND AT USER-COMMAND
ITS URGENT...WHEN I SELECT MULTIPUL VALUES IN BASIC LIST ,I HAVE TO GET THOSE SELECTED MULTIPUL VALUES IN SECONDARY LIST THAT CAN BE AFTER(AT LINE-SELECTION OR AT USER-COMMAND)............?
hey
this code modify's simlarly u can read n display secondary window
DO .
Reading the internal table whose data is displayed into wrk area.....
READ LINE SY-INDEX FIELD VALUE INT_DISPLAY-SHIPMENT_ID INTO WF_SHIPMENT_ID.
Reading the check box value
READ LINE SY-INDEX FIELD VALUE WG_CHK.
If all the records are read and there is no code left to read
IF SY-SUBRC <> 0 .
EXIT.
ENDIF.
To highlight the line which is selected by the user
IF WG_CHK = WL_X.
MODIFY CURRENT LINE
LINE FORMAT COLOR COL_NEGATIVE INVERSE
FIELD VALUE WG_CHK FROM WL_SPACE.
MODIFY CURRENT LINE
LINE FORMAT INPUT OFF.
Also append the record read into new internal table which u will display in secondary window.......
ENDIF.
ENDDO.
AT USER-COMMAND. or AT LINE SELECTION . u can write this code.........
DISPLAYING A POP-UP WINDOW .
WINDOW STARTING AT 10 50
ENDING AT 120 70.
and then write the table into which u have stored the read entry which user had selected
reward points if useful -
Refresh Report and At Line-Selection and At User-Command
Hi All
I have 2 querries
1) I want to use At Line-selection and At user-command in the same report. But At line-selection is not getting triggered why? When I remove Set pf-status 'xxx' and at user command , then at line selection works . I want to user both at a time.
2) I am giving user ability to edit the report shown and when he comes back by exiting the editing I want to refresh the report which is shown already to him to give effect of his editing.
Thanks in anticipation
pM.i just tried, and no problem at all.
In the <b>Recommended Function Key Settings</b> for F2 key add command "PICK"
Regards
Raja
since you are new to the forum, have a look at this weblog.
/people/mark.finnern/blog/2004/08/10/spread-the-love -
Using both at line-selection and at user-command
hellow friends ,
to use both at line-selection and at user-command in the same report.Hello,
U can do it like this.
AT LINE-SELECTION.
PERFORM at_line_selection.
AT USER-COMMAND.
PERFORM at_user_command.
FORM AT_LINE_SELECTION.
DATA: LV_CURSOR_FIELD(30).
DATA: LV_MATNR TYPE MATNR.
CLEAR H_UCOMM.
GET CURSOR FIELD LV_CURSOR_FIELD.
CASE LV_CURSOR_FIELD.
WHEN 'PSPNR'.
PERFORM LAGER_AN_PSP USING WA_MATNR-M1-RSNUM
WA_MATNR-M1-RSPOS.
WHEN 'PSPNR2'.
H_UCOMM = 'PSPNR2'.
IF NOT PSPNR2 IS INITIAL AND IT_VKBEL-VBELN CN '0123456789'.
PERFORM LAGER_AN_PSP_VKBEL USING IT_VKBEL
0
PSPNR2
H_MAKTX
' '. "keine Blindbuchung
ENDIF.
ENDCASE.
CASE SY-UCOMM.
WHEN 'BACK_NEW'.
PERFORM NEU_START USING 'X'.
WHEN 'EXIT'.
PERFORM NEU_START USING 'X'.
WHEN 'CANC'.
PERFORM NEU_START USING 'X'.
WHEN 'CHECK'.
PERFORM NEU_START USING SPACE.
ENDCASE.
Vasanth -
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 -
AT USER-COMMAND IN NORMAL REPORT
Please do not have your subject in ALL CAPITALS
Hi Experts,
Please advice,
I am having three fields in output first one is directly fetched from table and other two are variables.
ITAB-MENGE = fetched data.
ITAB-UCOMM = user command.
AT SELECTION-SCREEN OUTPUT
when the user press ENTER
ITAB-SUM = ITAB-MENGE + ITAB-UCOMM.
For eq:
Suppose if:
ITAB-MENGE = 100
and if the user enters the value in ITAB-UCOMM = 200
and when the user press enter the sum should display on the other field ITAB-SUM
Note: I am using normal write statement ( not ALV ) & I am not using any parameters in selection screen all these has to fired on output screen
Thanks
R.Karthik
Edited by: Karthik R on Feb 28, 2009 3:34 PM
Edited by: Matt on Mar 1, 2009 7:18 PMHi,
Refer code:-
REPORT Z19TG7_1 NO STANDARD PAGE HEADING.
TABLES : LFA1.
TYPES : BEGIN OF VENDOR,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF VENDOR,
BEGIN OF VENDOR1,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
ORT01 LIKE LFA1-ORT01,
LAND1 LIKE LFA1-LAND1,
BUKRS LIKE LFB1-BUKRS,
END OF VENDOR1.
DATA : VENDOR_TAB TYPE STANDARD TABLE OF VENDOR INITIAL SIZE 20 WITH HEADER LINE,
VENDOR1_TAB TYPE STANDARD TABLE OF VENDOR1 INITIAL SIZE 20 WITH HEADER LINE,
CB.
* WAS_USED.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE SY-LSIND.
START-OF-SELECTION.
SET PF-STATUS 'Z19TG7_1_PF'.
SELECT LIFNR NAME1
FROM LFA1
INTO TABLE VENDOR_TAB.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'VL'.
IF SY-LSIND = 1.
SET PF-STATUS SPACE.
DO.
CLEAR CB.
READ LINE SY-INDEX FIELD VALUE CB.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
CHECK CB = 'X'.
MODIFY CURRENT LINE : FIELD VALUE CB FROM SPACE.
SELECT A~LIFNR A~NAME1 A~ORT01 A~LAND1 B~BUKRS
FROM LFA1 AS A
LEFT OUTER JOIN LFB1 AS B
ON A~LIFNR = B~LIFNR
INTO TABLE VENDOR1_TAB
WHERE A~LIFNR = VENDOR_TAB-LIFNR.
LOOP AT VENDOR1_TAB.
WRITE : / 'Vendor ID:' NO-GAP, VENDOR1_TAB-LIFNR,
/ 'Vendor Name :' NO-GAP, VENDOR1_TAB-NAME1,
/ 'City :' NO-GAP, VENDOR1_TAB-ORT01,
/ 'Land :' NO-GAP, VENDOR1_TAB-LAND1,
/ 'Country Code :' NO-GAP, VENDOR1_TAB-BUKRS.
ULINE.
ENDLOOP.
ENDIF.
ENDDO.
ENDIF.
ENDCASE.
END-OF-SELECTION.
WRITE : /1 'CB', 5 TEXT-001, 18 TEXT-002.
ULINE.
LOOP AT VENDOR_TAB.
WRITE : /1 CB AS CHECKBOX, 5 VENDOR_TAB-LIFNR, 18 VENDOR_TAB-NAME1.
HIDE : VENDOR_TAB-LIFNR.
ENDLOOP.
ULINE.
Hope this helps you.
Regards,
Tarun -
At Line-selection in ALV for more than one field.
How to use At Line-selection in ALV Basic Report where there are more than one field for displaying Secondary Lists.
Ex: In Basic List there are 3 fields Volume_m Volume_y and Volume_i.When i click on any of the field i need to display the secondary list for that particular field.Hi Pavan,
Use User-command event of ALV.
Refer this code :
form BUILD_EVENTCAT using p_i_eventcat TYPE SLIS_T_EVENT.
DATA: I_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_I_EVENTCAT
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.
clear I_event.
read table p_i_eventcat with key name = slis_ev_user_command into I_event.
if sy-subrc = 0.
move 'USER_COMMAND' to I_event-form.
append I_event to p_i_eventcat.
endif.
form USER_COMMAND' using p_ucomm type sy-ucomm
p_selfield type slis_selfield.
case p_ucomm.
WHEN '&IC1'. "&IC1 is the Fcode for double click
Use P_ELFIELD-VALUE for further processing . this will contain the value on which u will double click
endcase.
Reward points if helpful.
Regards,
Hemant -
Problem with User Command in alv report
Hi
I have developed a ALV grid report with drill down capability to transaction code for user command. I am having a trouble with this.
CASE ucomm.
WHEN '&IC1'.
CLEAR: wa_import.
IF selfield-fieldname EQ 'ANLN1'.
READ TABLE t_import INTO wa_import INDEX selfield-tabindex.
SET PARAMETER ID 'BUK' FIELD wa_import-bukrs.
SET PARAMETER ID 'ANl' FIELD wa_import-anln1.
CALL TRANSACTION 'AW01N'.
ENDIF.
here my parameter ids are showing the values but when i call the transaction i am not getting the actual asset numbers.
Can someone help me out this
ThanksHi,
add the AND SKIP FIRST SCREEN...addition..
CALL TRANSACTION 'AW01N' AND SKIP FIRST SCREEN.
Thanks
Naren -
PROBLEM WITH USER COMMAND AT SIMPLE REPORT
HII FRNDS
MY PROBLEM IS
WHEN I AM BRANCHING TO A LIST REPORT FROM MY ALV REPORT BY USING LEAVE TO LIST-PROCESSING . THEN IN MY LIST REPORT I AM HAVING 2 MORE CUSTOMIZED BUTTON . BUT THE THING IS THAT I AM NOT ABLE TO MAKE THAT BUTTON FUNCTION .
CAN ANY BODY HELP ME WITH HOW TO MAKE THAT BUTTON WORK IN THE SIMPLE REPORT . I HAVE USED AT USER COMMAND IN THE BEGINING OF REPORT BUT STILL ITS NOT WORKING .
THANKING YOU
ROHITHII FRNDS THIS IS THE CODE
CASE R_UCOMM.
WHEN 'DISPLAY1'.
LOC_INDEX = 1 .
SET PF-STATUS 'STATUS' EXCLUDING 'DISPLAY1'.
LOOP AT INT_OUTPUT INTO WA_OUTPUT
WHERE CHECKBOX = WC_MARKED.
APPEND WA_OUTPUT TO INT_DISPLAY .
ENDLOOP.
LEAVE TO LIST-PROCESSING .
PERFORM F9100_DISPLAY_DETAILS USING LOC_INDEX.
ENDCASE.
AT USER-COMMAND .
CASE SY-UCOMM.
WHEN 'BACK'.
BREAK-POINT.
PERFORM F9100_DISPLAY_DETAILS USING LOC_INDEX.
ENDCASE.
THE PERFORM F9100 DISPLAYES THE LIST REPORT . THERE ARE NO SPELLING ERRORS FRNDS . -
Add user-command in MM60 report
HI,
when I click on Material in MM60 report out put it should go the MM03 transaction . But it is not happening. please check the below code and help me .
I am doing thid through Implict Enhancment .
FORM cs_callback-user_command USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
data : lw_matnr type matnr.
TABLES : mara.
CASE P_SELFIELD-FIELDNAME.
WHEN 'MATNR'.
IF P_SELFIELD-VALUE NE SPACE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = P_SELFIELD-VALUE
IMPORTING
OUTPUT = lw_matnr.
select single * FROM MARA
WHERE matnr = lw_matnr.
CHECK gt_list-MATNR IS NOT INITIAL.
SET PARAMETER ID 'MAT' FIELD lw_matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
endform.Hi,
Your code looks fine, Just check with the control whether it is reaching to your code on dubble click or not ?
I think your form is not being called, just check with debugging.
Regards
Bikas -
USER-Command at ALV report.
Hi Guys,
I've created one ALV report displaying SALES ORDER created.My requirement is if I click on SALES Document no it should take me into VA03(sales orde display) transaction so that I can see all the data related for that document no. I have used BAPI .Hi guys,
I have written this code but still it is not taking me into VAO3 Transaction. What else I should write?
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BUFFER_ACTIVE = 'X'
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_PROGRAM = L_REPID
I_CALLBACK_PF_STATUS_SET = L_STATUS
I_CALLBACK_USER_COMMAND = L_USER_COMMAND
I_STRUCTURE_NAME = 'VBUK'
IS_LAYOUT = LF_LAYOUT
IT_FIELDCAT = LF_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = LF_SP_GROUP
I_DEFAULT = 'X'
I_SAVE = L_SAVE
IS_VARIANT = L_VARIANT
IT_EVENTS = LF_EVENTS[]
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 = IT_HEADER .
FORM L_USER_COMMAND USING vl_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE vl_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'DOC_NO'
OR rs_selfield-fieldname = 'SO_KUNNR' .
SET PARAMETER ID 'AUN' FIELD rs_selfield-VALUE.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
WHEN OTHERS.
EXIT.
ENDCASE.
ENDFORM. -
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. -
Need clarification on AT LINE SELECTION & AT USER COMMAND
Hi all,
can we use AT LINE SELECTION and AT USER COMMAND events in the same report? If yes what r the precautions that we have to take?
Thanks in advance
venkatHi Venkat,
I had written this code while I was learning Menu Painter. It will help help you.
*& Report YTEST_MENUPAINTER *
REPORT ztest.
*Consider a scenario when the user asks for Material Details(Table : MARA )
*displayed in one List and based on the Material selected he wants the corresponding
*Storage Location Data for that Material (Table : MARD ).
TABLES : mara.
TYPES : BEGIN OF tp_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
matkl TYPE mara-matkl,
END OF tp_mara.
TYPES : BEGIN OF tp_marc,
matnr TYPE marc-matnr,
werks TYPE marc-werks,
pstat TYPE marc-pstat,
ekgrp TYPE marc-ekgrp,
dispr TYPE marc-dispr,
END OF tp_marc.
TYPES : BEGIN OF tp_mard,
matnr TYPE mard-matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
lfgja TYPE mard-lfgja,
labst TYPE mard-labst,
umlme TYPE mard-umlme,
END OF tp_mard.
DATA : t_mara TYPE STANDARD TABLE OF tp_mara,
t_marc TYPE STANDARD TABLE OF tp_marc,
t_mard TYPE STANDARD TABLE OF tp_mard,
wa_mara TYPE tp_mara,
wa_marc TYPE tp_marc,
wa_mard TYPE tp_mard.
DATA : w_werks TYPE werks .
DATA : itab TYPE TABLE OF sy-ucomm.
START-OF-SELECTION.
*Collecting the material details form Table MARA
SELECT matnr
mtart
mbrsh
matkl
FROM mara
INTO TABLE t_mara
UP TO 200 ROWS.
END-OF-SELECTION.
SET PF-STATUS 'DETAIL'.
*Now I am Dispalying the Material Details in the Primary List
CLEAR wa_mara.
LOOP AT t_mara INTO wa_mara.
IF sy-tabix EQ 1.
FORMAT INTENSIFIED ON.
FORMAT COLOR COL_KEY.
WRITE : /5(16) 'Material Number'.
FORMAT COLOR COL_NORMAL.
WRITE : 24(15) 'Material Type',
40(18) 'Industry Sector',
58(18) 'Material Group' .
ENDIF.
FORMAT INTENSIFIED OFF.
FORMAT COLOR COL_KEY.
WRITE : /5(16) wa_mara-matnr.
FORMAT COLOR COL_NORMAL.
WRITE : 24(15) wa_mara-mtart,
40(18) wa_mara-mbrsh,
58(18) wa_mara-matkl.
*You can assume some sort of buffer is created in the memory and the values of
* wa_mara-matnr are put into it when you use the HIDE command
HIDE wa_mara-matnr.
ENDLOOP.
*Now when user Double clicks a line (AT LINE-SELECTION event is trigerred) and
*the line contents of the line selected and the contents buffered using
*command interact and the value for the hidden variable is got into the variable
*refrenced using the HIDE command i.e.. wa_mara-matnr in our case
AT LINE-SELECTION.
IF sy-lsind = 1.
FORMAT INTENSIFIED ON.
WRITE: 'Plant Data for Material ' COLOR COL_NORMAL,
35 wa_mara-matnr COLOR COL_TOTAL.
REFRESH t_marc.
* Now I have the value of the Material in my hidden variable wa_mara-matnr
* Based on this I am selecting the Storage Location Data
SELECT matnr
werks
pstat
ekgrp
dispr
FROM marc
INTO TABLE t_marc
WHERE matnr = wa_mara-matnr.
CLEAR wa_marc.
FORMAT INTENSIFIED OFF.
FORMAT COLOR COL_NORMAL.
LOOP AT t_marc INTO wa_marc.
IF sy-tabix EQ 1.
FORMAT INTENSIFIED ON.
FORMAT COLOR COL_NORMAL.
WRITE : /24(6) 'Plant',
30(22) 'Maintenance status',
52(20) 'Purchasing Group',
72(27) 'Material: MRP profile'.
ENDIF.
WRITE : /24(6) wa_marc-werks,
30(22) wa_marc-pstat,
52(20) wa_marc-ekgrp,
72(27) wa_marc-dispr.
CLEAR wa_marc.
ENDLOOP.
SKIP 5.
FORMAT INTENSIFIED ON.
WRITE: 'Storage Data for Material ' COLOR COL_NORMAL,
35 wa_mara-matnr COLOR COL_TOTAL.
REFRESH t_mard.
SELECT matnr
werks
lgort
lfgja
labst
umlme
FROM mard
INTO TABLE t_mard
WHERE matnr = wa_mara-matnr.
CLEAR wa_mard.
FORMAT COLOR COL_NORMAL.
* Display the Storage Location Data in the Secondary List
LOOP AT t_mard INTO wa_mard.
IF sy-tabix EQ 1.
FORMAT INTENSIFIED ON.
FORMAT COLOR COL_NORMAL.
WRITE : /24(6) 'Plant',
30(20) 'Storage Location',
50(12) 'Fiscal Year',
62(15) 'Valuated stock',
77(20) 'Stock in transfer'.
ENDIF.
WRITE : /24(6) wa_mard-werks,
30(20) wa_mard-lgort,
50(12) wa_mard-lfgja,
62(15) wa_mard-labst,
77(20) wa_mard-labst.
ENDLOOP.
ENDIF.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'PLANT'.
REFRESH itab. CLEAR itab.
APPEND 'PLANT' TO itab.
APPEND 'STORAGE' TO itab.
SET PF-STATUS 'DETAIL' EXCLUDING itab .
FORMAT INTENSIFIED ON.
WRITE: 'Plant Data for Material ' COLOR COL_NORMAL,
35 wa_mara-matnr COLOR COL_TOTAL.
REFRESH t_marc.
SELECT matnr
werks
pstat
ekgrp
dispr
FROM marc
INTO TABLE t_marc
WHERE matnr = wa_mara-matnr.
CLEAR wa_marc.
FORMAT INTENSIFIED OFF.
FORMAT COLOR COL_NORMAL.
LOOP AT t_marc INTO wa_marc.
IF sy-tabix EQ 1.
FORMAT INTENSIFIED ON.
FORMAT COLOR COL_NORMAL.
WRITE : /24(6) 'Plant',
30(22) 'Maintenance status',
52(20) 'Purchasing Group',
72(27) 'Material: MRP profile'.
ENDIF.
WRITE : /24(6) wa_marc-werks,
30(22) wa_marc-pstat,
52(20) wa_marc-ekgrp,
72(27) wa_marc-dispr.
CLEAR wa_marc.
ENDLOOP.
WHEN 'STORAGE'.
REFRESH itab. CLEAR itab.
APPEND 'PLANT' TO itab.
APPEND 'STORAGE' TO itab.
SET PF-STATUS 'DETAIL' EXCLUDING itab .
FORMAT INTENSIFIED ON.
WRITE: 'Storage Data for Material ' COLOR COL_NORMAL,
35 wa_mara-matnr COLOR COL_TOTAL.
REFRESH t_mard.
SELECT matnr
werks
lgort
lfgja
labst
umlme
FROM mard
INTO TABLE t_mard
WHERE matnr = wa_mara-matnr.
CLEAR wa_mard.
FORMAT COLOR COL_NORMAL.
LOOP AT t_mard INTO wa_mard.
IF sy-tabix EQ 1.
FORMAT INTENSIFIED ON.
FORMAT COLOR COL_NORMAL.
WRITE : /24(6) 'Plant',
30(20) 'Storage Location',
50(12) 'Fiscal Year',
62(15) 'Valuated stock',
77(20) 'Stock in transfer'.
ENDIF.
WRITE : /24(6) wa_mard-werks,
30(20) wa_mard-lgort,
50(12) wa_mard-lfgja,
62(15) wa_mard-labst,
77(20) wa_mard-labst.
ENDLOOP.
ENDCASE.
My SE41 settings are.
Application toolbar Test for Material Detail Display
Items 1 - 7 STORAGE PLANT
STORAG PLANT
Items 8 - 14
Items 15 - 21
Items 22 - 28
Items 29 - 35
Function keys Test for Material Detail Display
Standard Toolbar
SAVE BACK EXIT CANCEL PRINT FIND FIND NEXT
Recommended function key settings
F2 PICK Choose
F9 <..> Select
Shift-F2 <..> Delete
Shift-F4 <..> Save without check
Shift-F5 <..> Other <object>
Freely assigned function keys
F5 STORAGE STORAGE
F6 PLANT PLANT
F7
F8
Shift-F1
Hope this will help you.
Regards,
Arun Sambargi.
Message was edited by: Arun Sambargi -
At line-selection & at user-command event issue
hi
i am working on a interactive report,with at line & at user command event,on list 3 i have used a pf status,to trigger the at user command event,till that i was working with at line selection,which are working fine,but on list 3,i am able to see my pf status,but at user command event is not working properly,its still working like at line selection event,if i clk on record,it take to for nxt action,which i want to do through the action button of pf status.
In debugging i checked that it coming to at user command,but the action in sy-user is 'PICK' & its doing the operation.
WHEN '3'.
IF itab4[] IS NOT INITIAL.
SET PF-STATUS 'Z203'.
LOOP AT itab4.
AT FIRST.
WRITE:/1 'Material' ,18 'Name'.
ENDAT.
WRITE:/1 itab4-matnr,8 itab4-maktx.
HIDE:itab4-matnr.
ENDLOOP.
ELSE.
WRITE:/ 'No Data Found'.
ENDIF.
ENDCASE.
BREAK-POINT.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'CALL'.
PERFORM bdc_mm02.
ENDCASE.
pls tel me how to use at line selection & at user command in same report to make both events working efficiently.
regds
vipinCheck whether you have assigned Function Key F2 to your function code 'CALL'. If so change that function key. The function key F2 is always linked to function code 'PICK'.
Regards
Sathar
Maybe you are looking for
-
Why is my MacBook Pro (mid-2012) so unresponsive and slow?
I have been having many huge problems with my MacBook Pro recently. First of all, it takes a minute to two minutes to boot up. Whenever I try to open an application, it usually takes 30 seconds or so to even open, and it remains unresponsive (with th
-
Help with importing audio...
Hi, i've been doing some foley work and using Garage Band to capture my sounds. I'm recording in and exporting in 24 bit and saving as uncompressed to maintain highest clarirty. Now I need to import it into final cut. The files are already saved from
-
Flash ad not working in MACS...
Hi. I created a banner ad in flash. I followed the instructions to make a button in the tutorial. For one layer I created an invisible button, etc. Then on another layer I added a keyframe at the very beginning and entered this actionscript: inv_btn.
-
Using #LOGO# in Apex 3.0 BI Publisher PDF
Hey gurus and guruesses [sp?]... I have an Apex 3.0 application that uses a procedure call to get the logo pending on several factors about the user. I want to be able to display the current logo on any PDF's that I'm generating using BI Publisher. I
-
Hey, I was wondering if 1GB of ram is enough when is comes to SD video on a macbook.... Any ideas?