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: 

ALV output button event

Former Member
0 Kudos

Hi

We are using ALV grid FM, when you click addon <List> button in ALV grid

it displays list as output. In list output, i have add <Export> button and defined gui status and displayed at application bar.

when i click that export button , i am not able to catch the function code SY-UCOMM value.when i add standard <Print> button in applciation bar, its working by debugging into standard screen.

Does event is required to catch that?

In the list

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-CPROG

I_CALLBACK_PF_STATUS_SET = GUIST_LIST

I_CALLBACK_USER_COMMAND = UCOMM_LIST

I have codded as below too.

FORM UCOMM_LIST USING r_ucomm LIKE sy-ucomm rs_selfield TYPE

slis_selfield.

WHEN SY-UCOMM.

  • i can get func code for ALV <list> button. Not the <Export> button function of output list.

...no value

ENDFORM.

17 REPLIES 17

Former Member
0 Kudos

Hi guys

Can somebody shed light on this.

Little tips will help to continue..

REgards

Chandra

Former Member
0 Kudos

Hi,

Use below code..

**************For user command define*************
data: g_form_user_command type slis_formname value 'USER_COMMAND_L'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_PF_STATUS_SET = GUIST_LIST
I_CALLBACK_USER_COMMAND = g_form_user_command

******Declare form...endform for handle user command**********
form user_command_l using p_ucomm type sy-ucomm
                          p_selfield type slis_selfield.

  case p_ucomm.

    when <function code used for alv list button>.                       " CALL LIST
     Write your code to display list
  endcase.
endform.

BR

Vijay

0 Kudos

Hello Vikram

thanks for your reply.

My problem is not in ALV list buttion, I have problem in Export button in Output screen.

When i click LIST button in ALV Grid, Output display screen opens, in that screen i have added the Export button.

I am not able to handle that button in that screen(not in Alv screen or Alv grid button).

Pls let me know if you need more input.

Regards

Chandra

0 Kudos
Output display screen opens

How you are displaying second output screen i mean by using REUSE ALV** FM or somthing else.

Vijay

0 Kudos

Hi Vikram

yes, From ALV grid, i am displaying second output screen.

pls see below source outcode. When i click button from ALV grid below i am able to get the function code inside below form.

But not able to get function code in Second output screen Button.

form user_command_l using p_ucomm type sy-ucomm

p_selfield type slis_selfield.

case p_ucomm.

when <function code used for alv list button>. " CALL LIST

->calling second output screen where i have export button.

How to handle here?

endcase.

endform.

How to handle that.

Regards

Chandra

Edited by: princeck on Nov 12, 2011 12:58 PM

Former Member
0 Kudos

Hi Chandra,

Pass the same variable against parameter I_CALLBACK_USER_COMMAND in both alv's FM,s so in both cases same form USER_COMMAND_L will be called.

As i mentioned below.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_PF_STATUS_SET = GUIST_LIST
I_CALLBACK_USER_COMMAND = g_form_user_command  <--Pass this variable in second REUSE_ALV** FM also

Vijay

0 Kudos

Hello Vikram

Thanks for your reply.

Hope you did not got my question. Let me explain it more detail.

Actually i am using only one FM 'REUSE_ALV_GRID_DISPLAY' to display EKPO items in Screen A.

When i Click custom button(LIST) from ALV grid from Screen A, item details are output as List in new Screen B(Here No ALV grid is used).

In Screen B i have added onecustom button(Export) in application bar(Using GUISTATUS)to download the item in excel.

Here is the problem. From Screen B, when i click Export button, nothing is happened(even not able to debug(/h) to find out where it goes). why?

In same gui status i have added Print button also, but it works fine in Screen B. Its debugging to standard Program.

Anything missing in GUI Status to define in Export button or Any events has to be handled properly?

Is it related to ALV grid FM parameter problems? like adding Event etc?

Pls shed some light on this.

Regards

Chandra

Edited by: princeck on Nov 13, 2011 2:23 PM

Edited by: princeck on Nov 13, 2011 2:24 PM

0 Kudos

Hi Chandra,

Then how you are displaying your second output screen.

BR,

Vijay

0 Kudos

Hi Vikram

Second screen is just list screen(standard one).

Used Write statement to display few items in list. thats it.

In that screen i have added custom button(export) using Gui status. when i click that button in /h debug mode atleast it should show some program but nothing happends. just stays in same screen itself.

Can you imagine my problem. pls let me know where u could not understand. i can explain more.

To display a secondary list when you click on one of the row items in an alv grid. The secondary list should also be an alv. ?

regards

Edited by: princeck on Nov 13, 2011 3:02 PM

0 Kudos

Hi Chandra,

No Dear, Then how you are thinking to capture that sy-ucomm (you explicitly added that tab "EXPORT".

Because you are just displaying second report by writes statments.

Do one thing display second report by using FM reuse_alv* the take the reference of code mentioned in above comments.

Try this hope this will solve your problem.

Thanks,

Vijay

0 Kudos

Hi Vikram

Thanks for immediately reply.

Sorry i could not understand below explanation. can you explain little bit?

>>No Dear, Then how you are thinking to capture that sy-ucomm (you explicitly added that tab "EXPORT".

Appreciate your response.

Regards

Chandra

0 Kudos

In second output screen you created one "EXPORT" button using GUI-STATUS. You assigned some function code to that button "EXPORT".

But you displaying second output screen by using writes statement so there is no code to capture sy-ucomm for your button custom "EXPORT".

0 Kudos

Hi Vijay

Thanks for you rreply.

So you mean , i can only capture the function code if the second screen is using only ALV ?

If i am able to add custom button EXPORT in Second screen using GUI status, then why it does not allow me to capture sy-ucomm ?

I dont understand this point?

Sorry if you can clear above explanation would be great help. could not understand in which case SY-UCOMM is allowed to capture and not.

Thanks for follow up, i will reward points to you. Would be great if reply me for above.too

Regards

Edited by: princeck on Nov 13, 2011 3:42 PM

Edited by: princeck on Nov 13, 2011 4:10 PM

0 Kudos

Hi Chandra,

I got the solution of your problem.

Actually second output you are displaying through classical way like using write statements.

So after displaying your report through write statement declare event AT USER-COMMAND.

Take the reference below.

AT USER-COMMAND.

CASE sy-ucomm.
    WHEN .
 ENDCASE.

Second solution:

I think you added "EXPORT" button on second output screen to download secondary report to your PC.

FOr this in your secondary report APPLICATION TOOLBAR add standard function code "%PC" to download report to PC and activate. This will create a button at secondary screen output screen which allow you to download report.

BR,

Vijay

0 Kudos

Hello Vikram

Thanks for your reply.

Regarding solution 1.

we use CALL FUNCTION 'GET_PRINT_PARAMETERS' to send spool and print classic list.

NEW-PAGE PRINT ON PARAMETERS L_PARAMETERS NO DIALOG NEW-SECTION.

we used AT USER-COMMAND in many places after ending the Write statement.

but still it does not work.

Below is the code structre.

FM REUSE....DISPLAY

FORM CONTROL_UCOMM_LIST USING WA_UCOMM    LIKE SY-UCOMM
  CASE SY-UCOMM.
  WHEN 'LIST'
  PERFORM SPOOLlist   'Here call function GET_PRINT_PARAMTERS is used to sendspool and display classic list.
 PERFORM  LAYOUT_JL.  displays output in list.
ENDFORM.

Above code is flow, where to write AT USER-COMMAND ,CASE sy-ucomm.?

we cannot use AT statement inside FORM..ENDFORM.

Regarding solution 2.

%PC solution does not work out for us. because its standard.

we want to create csv file as per our format. so we need addon button.

0 Kudos

Hi Chandra,

FORM CONTROL_UCOMM_LIST USING WA_UCOMM    LIKE SY-UCOMM
  CASE SY-UCOMM.
   WHEN 'LIST'
   PERFORM  LAYOUT_JL.  displays output in list.
ENDFORM.

 AT USER-COMMAND.
 CASE SY-UCOMM.
 WHEN 'EXPORT'
 PERFORM SPOOLLIST.  
 
 FORM SPOOLLIST.
  .................
  ................
 ENDFORM.

Use above structure of code.

And remove rest of the AT USER-COMMAND statements from your code as you mentioned you declared AT USER-COMMANT statements so many place in your code.

Thanks,

Vijay

Former Member
0 Kudos

thanks