‎2009 Sep 29 6:10 AM
Dear Experts,
I hv created an ALV report. when in double click on the record it take me to the required tcode (FB03).
But the problem is ,it always display last record of internal table if I clicked on first record,
Can any one suggest me something.
Regards,
Maverick
‎2009 Sep 29 6:15 AM
Hi,
Can u be clear with u r requirement?
are u using oops alv or normal alv.
‎2009 Sep 29 6:15 AM
Hi,
Can u be clear with u r requirement?
are u using oops alv or normal alv.
‎2009 Sep 29 6:30 AM
Thanks for ur reply.
I m using normal ALV. go through the following
form display_all_item_alv.
w_repid = sy-repid.
perform update_catalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = w_repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IT_FIELDCAT = I_FCAT[]
I_SAVE = 'X'
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_faglflexa_all
* 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 USER_COMMAND *
*------------------------------------------------------------------*
* --> R_UCOMM *
* --> RS_SELFIELD *
*------------------------------------------------------------------*
form user_command using r_ucomm like sy-ucomm
rs_selfield TYPE slis_selfield.
w_gjahr = p_gjahr.
case r_ucomm.
when '&IC1'.
if r_open = 'X'.
set parameter id 'BLN' field i_faglflexa_open-belnr.
elseif r_clear = 'X'.
set parameter id 'BLN' field i_faglflexa_clear-belnr.
else.
set parameter id 'BLN' field i_faglflexa_clear-belnr.
endif.
set parameter id 'BUK' field p_bukrs.
set parameter id 'GJR' field w_gjahr. "i_faglflexa_clear-gjahr.
call transaction 'FB03' and skip first screen.
endcase.
endform. "user_command
Regards,
Maverick
‎2009 Sep 29 6:37 AM
Hello
form user_command using r_ucomm like sy-ucomm
rs_selfield TYPE slis_selfield.
w_gjahr = p_gjahr.
case r_ucomm.
when '&IC1'.
if r_open = 'X'.
read table i_faglflexa_open index rs_selfield-tabindex. " <- add this
set parameter id 'BLN' field i_faglflexa_open-belnr.
elseif r_clear = 'X'.
read table i_faglflexa_clear index rs_selfield-tabindex. " <- add this
set parameter id 'BLN' field i_faglflexa_clear-belnr.
else.
read table i_faglflexa_clear index rs_selfield-tabindex. " <- add this
set parameter id 'BLN' field i_faglflexa_clear-belnr.
endif.
set parameter id 'BUK' field p_bukrs.
set parameter id 'GJR' field w_gjahr. "i_faglflexa_clear-gjahr.
call transaction 'FB03' and skip first screen.
endcase.
endform.
‎2009 Sep 29 6:41 AM
Hi Maverick44,
it's showing last record because in SET parameter you are using the internal table header line... if i am not wrong then you are using internal table with header line... as header line contains last record it always shows last record...
Do the changes which i have made in below code and it will work...
data : l_belnr type bseg-belnr.
form user_command using r_ucomm like sy-ucomm
rs_selfield TYPE slis_selfield.
w_gjahr = p_gjahr.
case r_ucomm.
when '&IC1'.
l_belnr = rs_selfield-value. " Assigen value to L_BELNR
if r_open = 'X'.
set parameter id 'BLN' field l_belnr. " Change here.. you were using internal table header line before
elseif r_clear = 'X'.
set parameter id 'BLN' field l_belnr. " Change here.. you were using internal table header line before
else.
set parameter id 'BLN' field l_belnr. " Change here.. you were using internal table header line before
endif.
set parameter id 'BUK' field p_bukrs.
set parameter id 'GJR' field w_gjahr. "i_faglflexa_clear-gjahr.
call transaction 'FB03' and skip first screen.
endcase.
endform. "user_commandHope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya
‎2009 Sep 29 6:31 AM
by default txn FB03 has the cursor on first record.
Are you settting the last row using set_selected_rows?
‎2009 Sep 29 6:34 AM
Hi,
Please share the part of code where you have handled double click.
For cl_gui_alv_grid It should be like
class class1 definition.
public section.
methods:
double_click for event double_click
of cl_gui_alv_grid
importing e_row.
endclass.
class class1 implementation.
method double_click.
READ TABLE it_table INTO l_table
INDEX e_row-INDEX. "Index of selected row during double click
* Set the parameter using selected value and call transaction
endmethod.
endclass.Regards
‎2009 Sep 29 6:36 AM
Thanks for ur reply.
But i m using normal ALV not OOPs.
Regards,
Maverick