Application Development and Automation 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: 
Read only

user command

Former Member
0 Likes
644

i have arequirement that i am having two internal tables

in the ouput when the user clicks on the line item of the header table that time only the data from the second internal table should be displayed for the line selected

how can it be done?

7 REPLIES 7
Read only

Former Member
0 Likes
623

Hi,

Use At Line-Selection event and Hide statement to get the relavant data.

Reagrds,

Shafi

Read only

Former Member
Read only

Former Member
0 Likes
623

Hi,

Check the Interactive reports.

Use "At Selection-screen" event.

Regards,

Raghu

Read only

Former Member
0 Likes
623

Hi,

You need to use interactive reporting to acheive your requirement.

Use the event At Line-Selection and in that event use the HIDE keyword to hold the value using which you want to display the corresponding data in the second Internal table. For more easiness, you can also use HOTSPOT Keyword also to get a handsymbol, which we get in the case of clicking Hyperlinks.

Hope this is helpful to you. If you need further information, revert back.

Reward all the helpful answers.

Regards

Nagaraj T

Read only

Former Member
0 Likes
623

Hi,

you will need two function calls for the reuse alv grid display

For the first one create a subroutine USER_COMMAND


*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND                                             *
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.

  
  DATA: lw_idx TYPE i.

  
  CASE r_ucomm.

    WHEN '&IC1'.  "this ok code fro double click
* The index of the selected line is present in the varaible *rs_selfield-tabindex.
      READ TABLE i_data INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
Now loop at the items table, using the key of the header record that was read, and store them in a   separate  temperory itab then call the second alv with the the temporary itab.
endif

When you call first ALV grid pass the USER_COMMAND to the parameter user_command as below so that it know which subroutine it should call when a action is performed on the ALV


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'STATUS'
      i_callback_user_command  = 'USER_COMMAND'
      is_layout                = layout
      it_fieldcat              = fieldcat[]
      i_default                = 'X'
      i_save                   = 'A'
      it_events                = eventcat[]
    TABLES
      t_outtab                 = i_data
    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.

regards,

Advait

Read only

Former Member
0 Likes
623

hi,

TABLES : kna1,vbak,vbap.

  • Types Delclaration

TYPES : BEGIN OF ty_kna1,

kunnr LIKE kna1-kunnr,

name1 LIKE kna1-name1,

land1 LIKE kna1-land1,

END OF ty_kna1.

TYPES : BEGIN OF ty_vbak,

vbeln LIKE vbak-vbeln,

erdat LIKE vbak-erdat,

ernam LIKE vbak-ernam,

END OF ty_vbak.

TYPES : BEGIN OF ty_vbap,

posnr LIKE vbap-posnr,

matnr LIKE vbap-matnr,

netwr LIKE vbap-netwr,

END OF ty_vbap.

  • internal table declaration

DATA : it_kna1 TYPE TABLE OF ty_kna1,

wa_kna1 TYPE ty_kna1.

DATA : it_vbak TYPE TABLE OF ty_vbak,

wa_vbak TYPE ty_vbak.

DATA : it_vbap TYPE TABLE OF ty_vbap,

wa_vbap TYPE ty_vbap.

*data : v_fld(20) type c.

SELECT-OPTIONS : s_kunnr FOR kna1-kunnr DEFAULT 1000 TO 1002.

*set pf-status 'BASIC'.

  • slecting data for basic list(kna1)

SELECT kunnr name1 land1

FROM kna1

INTO TABLE it_kna1

WHERE kunnr IN s_kunnr.

  • writng the list

LOOP AT it_kna1 INTO wa_kna1.

WRITE 😕 wa_kna1-kunnr hotspot on,

wa_kna1-name1 hotspot on,

wa_kna1-land1 hotspot on.

HIDE wa_kna1-kunnr.

*get cursor field wa_kna1-kunnr value v_fld.

ENDLOOP.

AT LINE-SELECTION.

IF sy-lsind = 1.

  • slecting data for 1st secondary list(vbak)

SELECT vbeln erdat ernam

FROM vbak

INTO TABLE it_vbak

WHERE kunnr = wa_kna1-kunnr.

  • writng the list

LOOP AT it_vbak INTO wa_vbak.

WRITE 😕 wa_vbak-vbeln hotspot on,

wa_vbak-erdat hotspot on,

wa_vbak-ernam hotspot on.

HIDE wa_vbak-vbeln.

ENDLOOP.

ENDIF.

IF sy-lsind = 2.

  • slecting data for 2nd secondary list(vbap)

SELECT posnr matnr netwr

FROM vbap

INTO TABLE it_vbap

WHERE vbeln = wa_vbak-vbeln.

  • writng the list

LOOP AT it_vbap INTO wa_vbap.

WRITE 😕 wa_vbap-posnr,

wa_vbap-matnr,

wa_vbap-netwr.

ENDLOOP.

ENDIF.

thnks,

raji

Read only

Former Member
0 Likes
623

hi,

At User-command :moment at which a user presses a function key.

Top-of -page during line-selection moment during the list processing of a secondary list at which new page starts.

pls reward if useful.