At line-selection issues
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
kumar
Hi 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.
Similar Messages
-
Hi Great minds,
How can i achieve this requirement in a report.
Scenario is :
On the Initial screen there is this accumulated value of PR and PO quantities for a paricular period(that way i have monthly break up quantities for 5 months per material).
And the reqruirement now is when i click on that value i should be able to see all those PR's and PO's which resulted in that accumaulation.
I know it has to be addressed thru At line -selection,but the value is not a field in internal table.
Please help...ThanksHi,
Here's the partial code where iam trying to get the dates in At-line Selection.
FORM MRP USING VALUE(L_DATE) VALUE(H_DATE).
DO.
if h_date(6) ge l_date(6).
perform LAST_DAY_IN_MONTH in program SAPFP500
USING l_date
com_month-endda.
select a~menge into ekpo-menge from ekpo as a inner join eket as b on
aebeln = bebeln and aebelp = bebelp
where a~matnr = itab1-matnr
and b~eindt between l_date and com_month-endda
and a~loekz ne 'X'.
po_quan = po_quan + ekpo-menge.
endselect.
write : po_quan.
hide : l_date,com_month-endda.
clear : po_quan.
else.
clear : l_date,h_date.
exit.
endif.
ENDDO.
ENDFORM.
In the above code when i click on "po_quan" i must be able to get all the PO's in that partuclar month per material.
Now in the At Line-selection iam getting the final iteration dates(ie last month only).
please advice... -
Table control line selection issue
HI im facing a problem in table control.
I have a table control with selection column ( single ).
First time when i select a row its is marked X in the internal table,
Now again when i select another row .. The old row still holds the value X and the new row is gettign marked as X.
The problem here is the old selection is not getting cleared in the internal table.
This is the statement used in PAI
MODIFY gt_header INDEX tbl_header-current_line FROM wa_header .
Here the previous value is not getting cleared.KSD,
During PAI Loop, the screen flow logic loops only through the visible table control lines. In your case, the user has scrolled down and seeing line 30 to 40 (say for example) after selecting a line in first page view. This is very common with any table control.
Now user is viewing 1 to 10 lines of the TC and have selected 3rd line. User then scrolls down by pressing page-down - now PAI is triggered and the internal table's 3rd line is modified with MARK='X'. User then views lines 30 to 40 and selects 33rd line. Now table control will automatically clear the MARK in 3rd line in the Table Control only. But it is the responsibility of the developer written code to clear the same in the Internal Table.
So within PAI Table Loop, you have to check the MARK which is coming from Screen to ABAP program every-time and if it is 'X', you have to clear any other line's MARK. Remeber you should not do this for multi-select. There is an attribute of the table control LINE_SEL_MODE. The above logic of clearing other lines' MARK should be implemented only after checking this attribute.
So incidentally your solution was the appropriate one.
Cheers,
Suresh -
Table control: Line selection single issue
Hi experts,
I have created a table control and in the screen painter I have defined the line selection as "Single" for table control.
The table control can display upto 20 lines in a screen and i can select a single record only which pertains to my requirement. if I try to select two records it will not allow.
Issue: consider i select a single record from the first 20 lines displayed in screen, then i scroll the records in the table control so that it displays the records from 21 to 40. if I select a single record now from line 21 to 40, the first record that i selected is not getting deselected. That is, totally two lines are getting selected.
How to overcome this issue
Thanks in advance
Regards
AnandOk
The "problem" is here:
Types: Begin of ty_ic,
ic(20),
desc(20),
sel(1) <--------------------------------
End of ty_ic.
You've ha a field for selected line and that field is used in table control definition as you've written:
"Note: wa_ic is the structure used in table control and wa_ic-sel is the mark field defined the table control attributes"
So you're using the structure WA_IC as header line of internal table IT_IC and also as input/put field of your table control (I mean the screen fields of table control are based on WA_IC).
You don't need any code in PBO to move the data from internal table to table control, because the headerline of IT_IC and field of table control are the same, infact you've implemented only the code in PAI to save the data from table control to IT_IC:
Loop at it_ic.
Modify it_ic from wa_ic index tc_ic-current_line
Endloop
t's a good solution if it needs to transfer all data to table control automatically: it doesn't need any code in PBO
but, of course, there'll be a problem when you don't need to display something, in this case you have to think a solution, I mean you have to write a code in order to avoid to display those data.
It's the case of the selected line: in your situation all selected lines keep the selection, because the code to clear IT_IC-SEL is missing: only the user can deselect a line, but if he doesn't do it, the line will remain selected after navigation.
So you make to be sure to clear all selected lines are not displayed.
You need to create a code in PAI out of the loop of table control where you clear the flag SEL, in order to do it you need to consider:
- The index of the first record displayed in table control is stored in field TC_IC-TOP_LINE
- The index of the last record displayed in table control can be calculated: the variable SY-LOOPC indicates how many rows can be displayed in table control, so the last record will be: TC_IC-TOP_LINE + SY-LOOPC.
So you need to clear the field SEL for all records not displayed, a code like this:
PROCESS PAI.
LOOP AT IT_IC.
MODULE GET_LOOPC.
ENDLOOP.
MODULE CLEAR_SEL.
MODULE GET_LOOPC..
TOT_LINE_DISPLAYED = SY-LOOPC.
ENDMODULE
MODULE CLEAR_SEL.
* Here you need to clear the selection of the records before of TOP_LINE
IF TC_IC-TOP_LINE > 1.
LOOP AT IT_IC INTO WA_IC TO TC_IC-TOP_LINE.
CLEAR WA_IC-SEL.
MODIFY IT_IC FROM WA_IC.
ENDLOOP.
ENDIF.
* Here you need to clear the selection of the records after the last one:
LAST_INDEX = TOT_LINE_DISPLAYED + TC_IC-TOP_LINE.
DESCRIBE TABLE IT_IC LINES SY-TABIX,
IF SY-TABIX > LAST_INDEX.
LOOP AT IT_IC INTO WA_IC FROM LAST_INDEX.
CLEAR WA_IC-SEL.
MODIFY IT_IC FROM WA_IC.
ENDLOOP.
ENDIF.
ENDMODULE. -
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 -
At line-selection event triggering issue?
hi,
I am working on a interactive report using at line-selection event, in that i have 3 list & now on 4 list i have to perform a BDC operation,for that I have used the PF-STATUS syntax, & at user command code.
but for this particular list my at user command is not working properly. if 1 clk on a record its move to nxt action,but it shd happen when i clk on a record & than press the icon for action set by PF STATUS.
Code is below:
WHEN '3'.
SET PF-STATUS 'Z203'.
LOOP AT itab4.
AT FIRST.
WRITE:/1 'Material' ,8 'Descp'.
ENDAT.
WRITE:/1 itab4-matnr,8 itab4-maktx.
ENDLOOP.
ELSE.
WRITE:/ 'No Data Found'.
ENDIF.
ENDCASE.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'CALL'.
PERFORM bdc_mm02.
pls tell how to use it.
reds
Vipinin your AT LINE-SELECTION event, add this code
CHECK sy-lsind NE 3.
(this is valid if your list is 4th list displayed as it begins with 0) -
How the Pop UP window got closed on line select
Hi All,
at BP_ADDR component we are calling component BP_SEARCH_HELPS by cross component usage on F4,
then we are doing bank details search, then on single line select at View BP_SEARCH_HELPS/BankKeySearchHelpResult
then it goes to event handler method EH_ONSELECT then.
inside this method we have code for to call window outbound plug RETURNRESULT'
METHOD eh_onselect.
via viewmanager:
DATA: lr_window TYPE REF TO cl_bsp_wd_window.
lr_window ?= me->view_manager->get_window_controller( ).
lr_window->call_outbound_plug( iv_outbound_plug = 'RETURNRESULT' ).
endmethod.
but at Window out bound plug there is no code for cross comp Window navigation (like Fire_outbound_plug with navigation link)
then also popup is closing and it gets navigating to BP_ADDR component, how it happenning...?
code at window BP_SEARCH_HELPS/BankKeySearchHelpW outbound plug is
method OP_RETURNRESULT.
endmethod.
there is no navigation link also defined for window BP_SEARCH_HELPS/BankKeySearchHelpW at Runtime repository.
one more question is how the event handler method EH_ONSELECT is executed for line select (we r not define any server event for any field of table's context node), is it property of Table context node?
Thanks,
VjMhydHi VJ,
I hope you are able to find the answer to your question that "how pop up is closing and navigation is done to BP_ADDR component" if not here is the answer.
Go to your window class and search for method call_outbound_plug ( remove the filter check box ). inside that method firstly your outbound plug method RETURNRESULT will be called and then you will find another method fire_outbound_plug. inside this method there is code to navigate back and close the pop up. this code is only triggered for pop up cases and that's how navigations takes places.
check if this is a popup rep. view
if ME->IS_TOPLEVEL_WINDOW = ABAP_TRUE.
We ignore the navigation for popups but save the outbound plug if given
and tell the current popup to get closed
data: LV_VIEW_MANAGER type ref to LCL_VIEW_MANAGER,
LV_APPL_CONTROLLER type ref to CL_BSP_WD_APPL_CONTROLLER.
try.
LV_VIEW_MANAGER ?= ME->VIEW_MANAGER.
LV_APPL_CONTROLLER ?= LV_VIEW_MANAGER->GET_APPLICATION_CONTROLLER( ).
LV_APPL_CONTROLLER->POPUP_MANAGER->CLOSE_POPUP( IV_OUTBOUND_PLUG ).
catch CX_SY_MOVE_CAST_ERROR. "#EC NO_HANDLER
endtry.
I hope this clarifies your issue.
Thanks
Sudhir Grover -
"AT LINE-SELECTION" event in a Query (SQ01 or SQ02)
Hi there
I want to know if it's possible to put "AT LINE-SELECTION" event in an ABAP Query? I'm trying that in SQ02 - the infoset - but nothing happens when I double-click on the output lines. I cannot find any place to type codes in SQ01.
The purpose is to call a transaction VA03 when people double-click on the output field "sales order number" and here is the code I put in "Free coding" section of SQ02.
AT LINE-SELECTION.
DATA: w_cucol TYPE sy-cucol.
w_cucol = sy-cucol + sy-staco.
w_cucol = w_cucol - 2.
IF w_cucol BETWEEN 103 AND 119.
SET PARAMETER ID 'AUN' FIELD vbkd-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
yuHi ,
You must create infoset based on join VBKD with VBAK and LIPS.
Also you must put VBAK-VBELN and LIPS-VBELN as a column output.
There is no problem to use 2 report assignment ( there is no loss ).
There is no necessity to use " some ABAP code at line-selection ".
This works.
By the way is more correct from the beginning to formulate the issue including all the data about your problem and not include them by adding a little at a time.
Regards. -
hi,
iam stuck up with AT LINE-SELECTION problem ie i designed a screen where they need month list on clicking F4. i got the month list using month_names_get in the screen but while clicking the relevant month no.it's not entering into the required parameter. i have attached the codings,
MODULE MONTH_DIS OUTPUT.
SUPPRESS DIALOG.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
SET PF-STATUS SPACE.
NEW-PAGE NO-TITLE.
WRITE:/ 'SELECT MONTH' COLOR COL_HEADING.
ULINE.
DATA: T_MNTH LIKE T247 OCCURS 12 WITH HEADER LINE.
refresh t_mnth.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
IMPORTING
RETURN_CODE =
TABLES
MONTH_NAMES = T_MNTH
EXCEPTIONS
MONTH_NAMES_NOT_FOUND = 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.
loop at t_mnth.
write:/ t_mnth-mnr, t_mnth-ltx.
endloop.
CLEAR T_MNTH-MNR.
ENDMODULE. " MONTH_DIS OUTPUT
AT LINE-SELECTION.
p_period = t_mnth-mnr.
CHECK NOT p_period IS INITIAL.
LEAVE TO SCREEN 0.
here in the AT LINE-SELECTION, the selected month is not coming to the required parameter.
pls help me in this issue,
Thanks in advance,
Premnath.You need to set a "Hide" after the write... I suggest you also set your own dialog PF-STATUS too so you can have just a PF2 "pick" button and a Cancel button ( this will look better to the user).
loop at t_mnth.
write:/ t_mnth-mnr, t_mnth-ltx.
hide: t_mnth. "needs this
endloop.
clear: t_mnth. -
I am using flex builder 2.01 and have been using datagrids
for a while now. I have recently ran into a weird situation where I
have one datagrid out of three that just will not allow a manual
selection. If I set the index to 0 for instance, the initial view
of the datagrid shows the first item selected. If I go to select a
different item, the first item becomes unselected and no other item
can be selected. If I leave the initial state to be no item
selected, I can never select an item. All other datagrids are
working fine. I have tried to set selectable to true but that
didn't help. This is really odd, any assistance would be greatly
appreciated.Mmmm... Well the good news is I fixed it. The bad news is I
have no clue why it fixed it. This particular datagrid is in a
different tab in a tabnavigator panel. Attached is the expanded
working code. On the line:
<mx:Canvas label="Archived" width="100%" height="100%"
id="ArchiveTab">
I had a click="{GetPropertyArchive()}" to refresh the data on
tab selection. This was old code that was made unnecessary at a
later date but I did not remove the code. My guess is the datagrid
assumed the characteristics of the parent tabnavigator and instead
of ... wait that can't be right. If that was the case then changing
the datasource would not have fixed the select issue because the
'click' definition on the tabnavigator still existed. I would
really like to understand why this mattered so I could avoid this
issue in the future. Any ideas?? -
TX BDLS - Syntax error in program SBDLS21020100127145818 line SELECT SINGLE
Hi All,
I am in the process of configuring a QAS system taken from a copy of th production system, I am going into TX BDLS and getting the following error message Syntax error in program SBDLS21020100127145818 line SELECT SINGLE AWSYS FROM DFKKKO has anyone got any ideas about this issue?
Thanks
JayForce manual activation in se11 this tables: (SE11 -> display -> menu 'table' -> actívate)
DFKKKO
DFKKCOLFILE_P_W
DFKKMKO
DFKKREP06
DFKKREP06_S
DFKKREP07
DFKKREV06
DFKKREV07
Try again the BDLS.
Regards. -
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 -
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 -
At line selection in alv report
hi,
i had developed a code in which at 1st execution the normal output is displayed and if i click on a purticular Itemid it displays the whole of items and i want to display only that item's data which i had clicked on.
following is the code which i am using for the at line-selection.
**BEGIN - TEST CODE FOR LINE SELECTION**
data: fld LIKE ITAB-ITEMID,
val LIKE ITAB-ITEMID.
at line-selection.
get cursor field fld value val.
IF fld = 'ITAB-ITEMID'.
SET PARAMETER ID 'ANR' FIELD val.
CLEAR ITAB-ITEMID.
ENDIF.
PERFORM PRN_SMSTOCK_ALV USING VAL.
IF SY-SUBRC <> 0.
MESSAGE 'NO RECORD FOUND' TYPE 'W'.
ENDIF.
FORM PRN_SMSTOCK_ALV USING VAL.
*****END OF TEST CODE FOR LINE SELECTION******
plzz help me out by providing the solution for this problem.Hi,
You need to add extra piece of code as below:
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
I_callback_user_command = 'USER_COMMAND' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
"For further information please refer the link below :
http://www.sapdev.co.uk/reporting/alv/alvgrid_ucomm.htm
Thanks,
Sriram Ponna. -
Hi guys: I need to double click on a field in the ALV report that should bring up another structure (which I have created) called s_det
s_det has only document number & company code.
Please provide the code for doing this in ALV. I know I cant use At Line Selection. Please give me simple code.
thanks so much
BrianHi
take this as an example for ur solution.
In this if we double click on first level display then it opens second level display.Just have a look on the following code.
This is Interactive ALV report of displaying each row with colours and Headers.
TYPE-POOLS SLIS.
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,
L_COLOR(4) TYPE C,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
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,
L_COLOR1(4) TYPE C,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO.
DATA: V_REPID TYPE SY-REPID,
I_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FLDCAT TYPE SLIS_FIELDCAT_ALV,
I_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST ALV REPORT',
I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDARY ALV REPORT'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM FLDCATALOG.
PERFORM CALL_EVENTS.
PERFORM POPULATE_EVENT.
PERFORM BLD_LAYOUT.
PERFORM BLD_LAYOUT1.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM DISPLAY_ALV_REPORT.
FORM FLDCATALOG.
WA_FLDCAT-TABNAME = 'IT_EKKO'.
WA_FLDCAT-FIELDNAME = 'EBELN'.
WA_FLDCAT-SELTEXT_M = 'PO NUMBER'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
WA_FLDCAT-TABNAME = 'IT_EKKO'.
WA_FLDCAT-FIELDNAME = 'AEDAT'.
WA_FLDCAT-SELTEXT_M = 'DATE'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
WA_FLDCAT-TABNAME = 'IT_EKKO'.
WA_FLDCAT-FIELDNAME = 'BUKRS'.
WA_FLDCAT-SELTEXT_M = 'DOCUMENT TYPE'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
WA_FLDCAT-TABNAME = 'IT_EKKO'.
WA_FLDCAT-FIELDNAME = 'LIFNR'.
WA_FLDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
ENDFORM.
FORM CALL_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_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.
FORM POPULATE_EVENT.
*READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
*IF SY-SUBRC = 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-FORM.
*ENDIF.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC = 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
ENDIF.
ENDFORM.
FORM BLD_LAYOUT.
GD_LAYOUT-INFO_FIELDNAME = 'L_COLOR'.
ENDFORM.
FORM DATA_RETRIEVAL.
DATA LN_COLOR(1) TYPE C.
SELECT EBELN AEDAT BUKRS BSART LIFNR
FROM EKKO INTO TABLE IT_EKKO.
LOOP AT IT_EKKO INTO WA_EKKO.
LN_COLOR = LN_COLOR + 1.
IF LN_COLOR = 8.
LN_COLOR = 1.
ENDIF.
CONCATENATE 'C' LN_COLOR '11' INTO WA_EKKO-L_COLOR.
MODIFY IT_EKKO FROM WA_EKKO.
ENDLOOP.
ENDFORM.
FORM DISPLAY_ALV_REPORT.
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 = '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_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = I_FLDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = I_EVENTS
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_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.
FORM TOP_OF_PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'THIS IS MY FIRST ALV'.
APPEND WA_HEADER TO T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM.
FORM USER_COMMAND USING R_COMM TYPE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_COMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM FLDCAT_EKPO.
PERFORM CALL_EVENT_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM DISPLAY_ALV_REPORT_EKPO.
ENDCASE.
ENDFORM.
FORM FLDCAT_EKPO.
WA_FLDCAT-TABNAME = 'IT_EKPO'.
WA_FLDCAT-FIELDNAME = 'EBELN'.
WA_FLDCAT-SELTEXT_M = 'PO NUMBER'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_EKPO.
WA_FLDCAT-TABNAME = 'IT_EKPO'.
WA_FLDCAT-FIELDNAME = 'EBELP'.
WA_FLDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_EKPO.
WA_FLDCAT-TABNAME = 'IT_EKPO'.
WA_FLDCAT-FIELDNAME = 'MATNR'.
WA_FLDCAT-SELTEXT_M = 'MATERIAL NUMBER'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
WA_FLDCAT-TABNAME = 'IT_EKPO'.
WA_FLDCAT-FIELDNAME = 'MENGE'.
WA_FLDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
WA_FLDCAT-TABNAME = 'IT_EKPO'.
WA_FLDCAT-FIELDNAME = 'MEINS'.
WA_FLDCAT-SELTEXT_M = 'BASE UNIT OF MEASURE'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
WA_FLDCAT-TABNAME = 'IT_EKPO'.
WA_FLDCAT-FIELDNAME = 'NETPR'.
WA_FLDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FLDCAT TO I_FLDCAT.
CLEAR WA_FLDCAT.
ENDFORM.
FORM CALL_EVENT_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_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.
*FORM POPULATE_EVENT_EKPO.
*READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
*IF SY-SUBRC = 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-FORM.
*ENDIF.
*ENDFORM.
FORM BLD_LAYOUT1.
GD_LAYOUT1-INFO_FIELDNAME = 'L_COLOR1'.
ENDFORM.
FORM DATA_RETRIEVAL_EKPO.
DATA LN_COLOR1(1) TYPE C.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR
INTO TABLE IT_EKPO
FROM EKPO.
LOOP AT IT_EKPO INTO WA_EKPO.
LN_COLOR1 = LN_COLOR1 + 1.
IF LN_COLOR1 = 8.
LN_COLOR1 = 1.
ENDIF.
CONCATENATE 'C' LN_COLOR1 '11' INTO WA_EKPO-L_COLOR1.
MODIFY IT_EKPO FROM WA_EKPO.
ENDLOOP.
ENDFORM.
FORM DISPLAY_ALV_REPORT_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 = ' '
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE1'
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 = GD_LAYOUT1
IT_FIELDCAT = I_FLDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = I_EVENTS
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_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.
FORM TOP_OF_PAGE1.
DATA: T_HEADER1 TYPE SLIS_T_LISTHEADER,
WA_HEADER1 TYPE SLIS_LISTHEADER.
WA_HEADER1-TYP = 'H'.
WA_HEADER1-INFO = 'SECONDARY ALV LEVEL'.
APPEND WA_HEADER1 TO T_HEADER1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER1
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM = .
ENDFORM.
reward points,if it is useful.
Thanks,
chandu.
Maybe you are looking for
-
Unable to restore System Recovery Files in desktop folder
I owned an HP Pavilion A6037C desktop computer (Running Vista). It began to give me serious issues in July so i used the HP System Backup and Restore program to create a backup of all my files. i saved these files on an external HD so i wouldn't lo
-
Can do everything but Remote Control.
I have a 99 client Pro subscription. One particular computer will let me login and do everything but Remote Control. I can use the File Manger, Chat, etc. Remote Control client shows an error after it tries to authenticate. Other clients work just
-
Hi Experts, in the standard transaction S_AHR_61015512 when i pass the values for data selection period between '01.11.2008' to '07.11.2008' and i cleared status(overall) and Applicant action is '04'. i am getting all the records bel
-
Help solve the problem after restor iphone 5 ios 7 asks email
Help solve the problem after restor iphone 5 ios 7 asks apple ID I Forgot apple ID
-
Error: OQ78YWIW when repeating values in a pivot
All, I'm receiving the following error on a pivot table: Assertion failure: rTotalPosition.tCellInfo.iLayerCell != rTotalPosition.tCellInfo.iEndLayerCell at line 310 of e:\views_e\nightly\sun\10134\windows\vobs\080726.1900\analytics_web\main\project\