Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

onclick with hotsot ABAP

aboooood
Participant
0 Kudos
552

hallo everyone,

i have following problem. im trying to make onklick method with a hotspot and then calling the right transaction.

i selected everything and post it as ALV table then there is 'VBELN' if i klick on should jump into TC VA23 or VA03 depending on if the AUART is B or C

if its B it works fine but if its C it jumps into VA03 but its doesnt skipping the first page so i have to enter the nummber manually wich is not what i want.

CLASS lcl_alv DEFINITION.
PUBLIC SECTION.
METHODS:
set_hotspot
CHANGING
co_alv TYPE REF TO cl_salv_table.
METHODS:
on_klick
FOR EVENT link_click OF cl_salv_events_table
IMPORTING
sender row
column.
ENDCLASS.
 CREATE OBJECT lo_alv.
lo_alv->set_hotspot( CHANGING co_alv = go_alv ).
* Liste anzeigen
go_alv->display( ).

CLASS lcl_alv IMPLEMENTATION.

METHOD set_hotspot.
DATA: lo_cols_tab TYPE REF TO cl_salv_columns_table,
lo_col_tab TYPE REF TO cl_salv_column_table.
lo_cols_tab = go_alv->get_columns( ).

TRY.
CAST cl_salv_column_table( lo_cols_tab->get_column('VBELN') )->set_cell_type( if_salv_c_cell_type=>hotspot ).
CATCH cx_salv_not_found.
ENDTRY.

DATA: lo_events TYPE REF TO cl_salv_events_table.
lo_events = go_alv->get_event( ).
SET HANDLER me->on_klick FOR lo_events.
ENDMETHOD.
METHOD on_klick.
READ TABLE i_vbak ASSIGNING FIELD-SYMBOL(<fs_vbak>) INDEX row.
IF sy-subrc = 0.

CASE column.
WHEN 'VBELN'.
CHECK <fs_vbak>-vbtyp IS NOT INITIAL.
IF <fs_vbak>-vbtyp = 'C'.

SET PARAMETER ID 'AFN' FIELD <fs_vbak>-vbeln.
CALL TRANSACTION 'VA03' WITH AUTHORITY-CHECK AND SKIP FIRST SCREEN.

ELSEIF <fs_vbak>-vbtyp = 'B'.
CHECK <fs_vbak>-vbtyp IS NOT INITIAL.
SET PARAMETER ID 'AGN' FIELD <fs_vbak>-vbeln.
CALL TRANSACTION 'VA23' WITH AUTHORITY-CHECK AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.

ENDIF.
ENDMETHOD.
ENDCLASS.
1 ACCEPTED SOLUTION

matt
Active Contributor
448

Just checked on the value help for the sales order/quotation field. It says:

  • AFN - Inquiry number
  • AGN - Quotation number
  • AUN - Order number
  • LPN - Scheduling agreement number
  • KTN - Contract number
  • AMN - Assortment number

So for quotation, it works as you're using AGN, but for sales order you need to use AUN.

4 REPLIES 4

FredericGirod
Active Contributor
0 Kudos
448

you have to use CALL TRANSACTION '....' USING ...

it is exactly like a batch input.

matt
Active Contributor
448

I had something similar. Are you sure you've got the right parameter ID. VA03 is AUN, isn't it?

matt
Active Contributor
449

Just checked on the value help for the sales order/quotation field. It says:

  • AFN - Inquiry number
  • AGN - Quotation number
  • AUN - Order number
  • LPN - Scheduling agreement number
  • KTN - Contract number
  • AMN - Assortment number

So for quotation, it works as you're using AGN, but for sales order you need to use AUN.

aboooood
Participant
448

oh my god i just used the wrong parameter ID cuz thats what my boss told me zo use.

thank u so much matthew.billingham