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

interactive alv issue

Former Member
0 Likes
1,563

hi this is saroj,

i have done one interactive report using vbak and vbap.i gotdata from two tables by using for all entries and populated

to IT_FINAL.i am getting grid display for vbak like VBELN,ERDAT.WHILE DOUBLE CLICKING ON VBELN OF VBAK

all data of vbap came like VBELN POSNR.I NEED ONLY THE CORRESPONDING DATA OF A PARTICULAR RECORD.

MY CODE:

PERFORM USER USING FCODE SELFIELD.

FORM USER FCODE LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.

CASE FCODE.

WHEN '&IC1'.

READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX.

PERFORM FIELDCAT.

PERFORM EVENT.

PERFORM POO_EVENT.

PERFORM GET_DATA.

PERFORM LIST_DIS.

ENDCASE.

I AM NOT READING IT_VBAK, I AM READING IT_FINAL.i have seen many sample alv reports that shows this

'READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX' statement,but i dont think it realy works.

SO abapres plz give me solution to get secondary list for a PARTCULAR RECORD.WAITING FOR RESPONSE.

THANKS

saroj

13 REPLIES 13
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,177

Hello Saroj,

'READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX' statement,but i dont think it realy works

Not sure what you mean by this statement ?

SELFIELD-TABINDEX --> Stores the table index of the output internal table, if you pass IT_FINAL to REUSE* FM then READ TABLE with SELFIELD-TABINDEX should work.

If you want to get the value of the particular cell on which you've double clicked, then you should use SELFIELD-VALUE.

BR,

Suhas

Read only

Former Member
0 Likes
1,177

so suhas you mean in place of READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX i should use

READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-VALUE

SAROJ.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,177

No, in debug mode what is the value in the field SELFIELD-TABINDEX? This should contain the index of the table line on which you've double clicked.

Read only

Former Member
0 Likes
1,177

Hi,

It works perfectly.

Please check why you are calling this perform :

PERFORM USER USING FCODE SELFIELD.

There is no need to call the perform in interactive ALV's.

while calling ALV FM .. pass this parameter

i_callback_user_command = 'USER'.'

Regards,

Srini.

Read only

Former Member
0 Likes
1,177

Hi Saroj,

your code is right. READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX. this will read the particular row(where you clicked) into wa_final. then you can choose the required fields (from vbap). no need to use all teh fields in wa_final. if you want more fileds from VBAP, u can write another select query where vbeln = wa_final-vbeln.

hope this will resolve your issue.

regards,

Christy

Read only

0 Likes
1,177

Christy i am getting secondary list for VBELN POSNR.but i am getting all records of selected range i.e. select-options.my issue is that i should get the partcular POSNR FOR A PARTICULAR VBELN THAT IS THE VBELN NUMBER ON WHICH I DOUBLE CLICK.

by using the code i am not getting the desired output : 'READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX'.

i think i should use the code:

DATA: VALUE1 TYPE VBAK-VBELN

CASE FCODE.

WHEN '&IC1'.

MOVE SELFIELD-VALUE TO VALUE1.

READ TABLE IT_FINAL INTO WA_FINAL WITH KEY VBELN = VALIE1.

PERFORM 'GET ....'.

ENDCASE.

Read only

0 Likes
1,177

Hi,

What is the code written inside?

PERFORM 'GET ....'.

Regards

Vinod

Read only

0 Likes
1,177

it is some perform statements like

PERFORM FIELDCAT_DATA.

PERFORM EVENT_DATA.

PERFORM POPULATE_EVENT.

PERFORM GET_DATA.

PERFORM DIS_DATA.

Read only

0 Likes
1,177

Hi,

Explain the code you have written for displaying the data in secondary List.

PERFORM GET_DATA.
PERFORM DIS_DATA.

Regards

Vinod

Read only

0 Likes
1,177

vinod i have all data in IT_FINAL.MY REQUIREMENT IS TO GET VBELN POSNR FOR A PARTICULAR VBELN OF VBAK.

SO PERFORM GET_DATA IS NOT REQUIRED.

SO TELL ME MY CODE IS CRRECT OR NOT WHICH I HAVE MENTIONED IF IT IS WRONG PLZ GIVE ME CORRECT CODE.

IN GENERAL I HAVE ALL DATA ACCORDING TO SELECTION-SCREEN IN IT_FINAL.SO IF I DOUBLE CLICK ON VBELN OF VBAK

IT SHOULD GIVE CORRESPONDING VBELN POSNR ON WHICH I DOUBLE CLICK.I HAVE ALSO TRIED WITH 'SET PARAMETER AND GET PARAMETER', BUT OF NO USE.

Read only

0 Likes
1,177

Hi,

You cannot use the same internal table for filtered data.

You can use following logic.

define internal table itab_final1 similar to it_final.
define workarea wa_final1 similar to wa_final.

READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX.
refresh : it_final1.
loop at it_final into wa_final1 where vbeln = wa_final-vbeln
                                           and     posnr = wa_final-posnr.
  append wa_final1 to it_final1.
endloop.

Display the content in alv display for secondary list using the internal table it_final1 which will contain the data related to selected VBELN and POSNR.

Regards

Vinod

Read only

0 Likes
1,177

thanks vinod.

saroj

Read only

Former Member
0 Likes
1,177

ANSWERED