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: 

Screen refresh

Former Member
0 Kudos

In screen ,have a ALV object and a field object, after double click the ALV object,i want ot transfer the value from ALV to the field, so in the double click event,i set the field value equal the value in ALV,and i debug it that it's OK, but the value of the field is not refresh on the screen ,so i want to know after i double click the ALV, how to refresh the screen automatically?

Thanks!

14 REPLIES 14

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You need to fire a PAI in the event handler. This is so you will get a round trip thru the screen.

In your event handler method for double click, add the method call below to the end of the method.



  method handle_double_click.

........

* cause PAI
      call method cl_gui_cfw=>set_new_ok_code
                 exporting
                      new_code = 'REFR'.

    endif.

  endmethod.


Regards,

RIch Heilman

Former Member
0 Kudos

First thanks for you!

I have tried it ,It is OK when i douck click the ALV in first time, but when i double click another row, the value of the screen is not changed,so......

0 Kudos

Hmmm.... interesting. Can you post your code? I need to see the PBO, the PAI and the event handler.

REgards,

RIch Heilman

Former Member
0 Kudos

the double click code as follows:

FORM DOUBLE_CLICK_B USING P_E_ROW TYPE LVC_S_ROW

P_E_COLUMN TYPE LVC_S_COL.

DATA:RC TYPE I.

DATA:NEW_CODE TYPE SYUCOMM.

PERFORM CLEAR.

READ TABLE I_STOCK INDEX P_E_ROW-INDEX.

IF SY-SUBRC = 0 AND I_STOCK-VERME > 0.

MATNR = I_STOCK-MATNR.

MENGE = I_STOCK-VERME.

CHARG = I_STOCK-CHARG.

LGPLA = I_STOCK-LGPLA.

FLDCUR = 'MENGE'.

ENDIF.

NEW_CODE = 'REFR'.

CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE

EXPORTING NEW_CODE = NEW_CODE

IMPORTING RC = RC.

  • CLEAR:NEW_CODE.

ENDFORM. " DOUBLE_CLICK_A

PAI:

CALL METHOD CL_GUI_CFW=>DISPATCH.

CASE SY-UCOMM.

WHEN 'BACK'. LEAVE TO SCREEN 0.

WHEN 'SAVE'.

PERFORM SAVE.

WHEN 'ENTR'.

PERFORM PRESS_ENTR.

WHEN 'CLEAR'.

PERFORM CLEAR.

ENDCASE.

CALL METHOD CL_GUI_CFW=>FLUSH.

CLEAR SY-UCOMM.

0 Kudos

Nothing jumping out at me. Can you debug and make sure that the event is being fired when you double click the second time?

Regards,

Rich Heilman

Former Member
0 Kudos

Yes,i am sure , i debug it again

the value is changed and call the function but the screen is not refreshed

0 Kudos

Please put a breakpoint in the PAI, and see if the PAI is being fired the second time.

Regards,

RIch Heilman

Former Member
0 Kudos

yes ,the PAI is being fired the second time

0 Kudos

Ok, so then we know the problem probably lies in your existing code rather than the new method call that I suggest that you add. If the PAI is being fired that means that something may be preventing the field from being updated. Put in debug mode and check the value in the PBO and the PAI and try to figure out what is going on.

Regards,

RIch Heilman

Former Member
0 Kudos

I debug it and found that when in the the method double click, the value is changed to the new ,but when out of the method,the value was changed to the old value

0 Kudos

Ok, make sure that the DATA statement for the screen field is a global declaration, meaning that it is not inside of any FORM of METHOD.

If still a problem post the entire program or send to my email address if not comfortable posting the entire code.

Regards,

RIch Heilman

Former Member
0 Kudos

Thanks a lot,i solved it.

0 Kudos

So what was the problem?

Please make sure to award points for any helpful answers and mark your thread as solved. Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos

before modification , i put the function in the double click method,

after your suggestion, i put the function and modify the value of field in PAI ,so it woks.