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

Changing Function Code of a Push Button

Former Member
0 Likes
2,676

Hi Experts,

In my table control, I have a column of push buttons, each per row.

As the FCODE of all the push buttons are same, so same set of actions are getting triggered on

click of any of these buttons.

I mean, if data is present only in the first row, then the push button of the first row should work, but

right now even if I click the 5th row's button same thing is happening.

So Can we change the function code of these push buttons every time the table control loop is

processed ??

Thanks

Chandan

18 REPLIES 18
Read only

Former Member
0 Likes
2,182

yeah fcode remains same , but when u look st sy-ucomm , u will get to know from which line it was triggered.

sample code looks like

l_lin = ytc_10-top_line + sy-ucomm+2(2) - 1.

regards

Prabhu

Read only

0 Likes
2,182

Hey Prabhu can you please elaborate it more as in what should I do ?

Read only

0 Likes
2,182

check values of sy-ucomm in debug mode.

in PAI

at user-command.

ok_code = sy-ucomm.

l_lin = ytc_10-top_line + sy-ucomm+2(2) - 1.---> current line.

read itab index l_lin.-->this will give current line details.

regards

Prabhu

Read only

0 Likes
2,182

Prabhu,

sy-ucomm is 'BUT', the fcode that I have assigned to the button.

Its not a number.

Read only

0 Likes
2,182

sorry , forgot to tell IMP thing when u are using Button on ROW,

fcode should be like thi BU%%

regards

Prabhu

Read only

0 Likes
2,182

That means, if I change the FCODE from BUT to BU%% it will work ???

Read only

0 Likes
2,182

Prabhu,

Where is your sample code, can u please show me ?

Thanks

Chandan

Edited by: chandan sinha on May 19, 2009 9:32 AM

Read only

0 Likes
2,182

Hi,

Disable the rows which doesn't have any values. In PBO, use describe statement to find the no. of lines in internal table. Then for table control, use the lines count to enable/ disable a particular row. For that use screen-input inside loop..endloop.

Read only

Former Member
0 Likes
2,182

same solution......... without try u never know what i'm saying...how it works...

yupe it should work...

%% or %%%( which can holds record no ) will contain current row details, so in PAI u need to have code just like my sample code ....

in PAI

at user-command.

ok_code = sy-ucomm.

l_lin = ytc_10-top_line + sy-ucomm+2(2) - 1.---> current line.

read itab index l_lin.-->this will give current line details.

regards

Prabhu

Edited by: Prabhu Peram on May 19, 2009 3:21 PM

Edited by: Prabhu Peram on May 19, 2009 4:07 PM

Read only

0 Likes
2,182

Prabhu,

BU%% is giving BU01, BU02 like wise for each time the button is clicked and not depending on the row.

This change in sy-ucomm should be row dependent and not button click dependent.

I mean, when row = 1, only then sy-ucomm = BU01( Not depending on the click made on the button)

row = 2, only then sy-ucomm = BU02 ( Not depending on the click made on the button)

Can you please suggest on this ?

Thanks

Chandan

Read only

0 Likes
2,182

dude .....

i dont how is ur TC design ..... but it should give selected row no itself...

see where is ur cursor postion.

regards

Prabhu

Read only

0 Likes
2,182

Hey Prabhu,

Fine I agree, that from your formula, I will get the selected row, but then what should I write in the below

blank :

CASE OK_CODE.
   WHEN  '_____'.
    CALL SCREEN 110.
ENDCASE.

Based on that row, I need to trigger the corresponding button, which will then open a pop-up input screen, where I need to enter data. When I will press the same button next time it should show the values which I had entered. Like this it should work for all the rows.

what should I write in the above condition ?

seems I am close, please reply to the earliest.

Thanks

Chandan

Read only

0 Likes
2,182
  
*screen 100
data: l_function like sy-ucomm,
        l_lin      type sy-stepl.
  clear: ok_code,l_function,error.
  ok_code = sy-ucomm.
  l_function = ok_code.
  if l_function(2)  = 'BU'.
    clear l_lin.
    l_lin = gt_cat09-top_line + l_function+2(2) - 1.
   read itab into ls_itab index l_line.--->current line. basedon conditions u can call popup message.
    perform get_relations.
    if gt_cat06[] is initial.
      perform display_popup.--->pop up select options.
    else.
     saved = 'X'.
    endif.
    if error ne 'X'.
      call screen '0101'.-->i'm calling another screen.
    endif.
  endif.
  case ok_code.
    when 'SAVE'.
    when 'DELE'.
    when others.
  endcase.

dude..... i dont do copy & paste my code... ...... u should try .....anyhow i hope u got the logic....so try to do it on ur own ...

regards

Prabhu

Read only

0 Likes
2,182

Hey Prabhu, that BU%% is working yaar, cool

Thanks a lot,

Now can you tell me is this possible: To get the row number of a table control where the cursor is currently

placed and the processing should start from that row ??

Prabhu, See the above message.

Thanks

Chandan

Edited by: chandan sinha on May 20, 2009 7:55 AM

Read only

0 Likes
2,182

To get the row number of a table control where the cursor is currently

placed and the processing should start from that row ??

what processing ?

-


>see my sample code , that will give u current row only. based on the l_lin u can read ur internal table.

Read only

0 Likes
2,182

Ok Fine....let me tell you my scenario then, please do help me

Scenario:

1) I have a table control with 2 radio buttons, 7 columns and 1 column of push buttons.

2) On click of radio button 2, the push button gets enabled and on click of the push button, a pop-up

screen comes up.

3) After entering data on the pop-up screen, control should come back to the main screen and whatever

data the user has entered should get displayed.

4) Now say user has entered 7 rows of data by repeating the above process. Suddenly, the user wants to

see what he entered in the first row's pop-up, then the user has to press the first row's push button in order

to see what he had entered in the pop-up.

My Problem is with the 4th Point, how can I achieve this.

Challenges I am facing: Even though I am clicking the 5th row's push button, it is showing me the 1st row's

data.

The Pop-up screen's values should change row wise depending on the data.

Please help me out, this issue is eating me up.

Thanks

Chandan

Read only

Former Member
0 Likes
2,182

Hi,

The PAI code to handle the click event of a pushbutton should be done inside the LOOP ENDLOOP of the coulmn of pushbuttons. So that when the appropriate column is clicked the apt code (which you need to do for the particular column cell) shall be executed.

Shankar

Read only

Former Member
0 Likes
2,182

not done