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

Working with user command

Former Member
0 Likes
745

Hi,

I have to develop a report which will get no of queries (sq01) generated in SAP system, then I( have to segregate it to the Functional area which I have done, now on my final output list, I am having a description like

*No. of queries generated * some number.

similarly it will display for each functional area, now my problem is, when I click on particular decription it should get the data related to that area, how can I get this done.

Best Regards.

1 ACCEPTED SOLUTION
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
671

Hi Vikram Kagada,

To use USER COMMAND.

First you need to create a PF-STATUS and set this pf in your report program.

Create some buttons. For each button, there is a function code associated.

Now, you need to handle the click event of the buttons at event 'AT USER-COMMAND' using their function code.

When you click any button, system field sy-ucomm will store its function code.

You can use this dummy code:-


REPORT z_demo.

data : ok_code type sy-ucomm.

ok_code = sy-ucomm.

START-OF-SELECTION.
set pf-status 'Z_PF'. "this is the pf-status associated with the report program.

AT USER-COMMAND.
case ok_code.
when 'ADD'. "for button having function code ADD
*code
when 'DEL'. "for button having function code DEL
*code
endcase.

Hope this solves your problem.

Thanks & Regards.

Tarun Gambhir.

3 REPLIES 3
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
672

Hi Vikram Kagada,

To use USER COMMAND.

First you need to create a PF-STATUS and set this pf in your report program.

Create some buttons. For each button, there is a function code associated.

Now, you need to handle the click event of the buttons at event 'AT USER-COMMAND' using their function code.

When you click any button, system field sy-ucomm will store its function code.

You can use this dummy code:-


REPORT z_demo.

data : ok_code type sy-ucomm.

ok_code = sy-ucomm.

START-OF-SELECTION.
set pf-status 'Z_PF'. "this is the pf-status associated with the report program.

AT USER-COMMAND.
case ok_code.
when 'ADD'. "for button having function code ADD
*code
when 'DEL'. "for button having function code DEL
*code
endcase.

Hope this solves your problem.

Thanks & Regards.

Tarun Gambhir.

Read only

Former Member
0 Likes
671

Hi,

One point missed in Tarun's reply is,

You can make use of GET CURSOR FIELD fname VALUE fval. to get the field name and field value after the user clicks on the screen.

Thanks,

Lakshmi

Read only

Former Member
0 Likes
671

Hi,

Thanks for the reply but I am not having button, I was able to resolve it, I have used CP.