Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes problem (inheritance) #58

Closed
PShumilov opened this issue Nov 21, 2020 · 5 comments
Closed

Attributes problem (inheritance) #58

PShumilov opened this issue Nov 21, 2020 · 5 comments
Assignees
Labels

Comments

@PShumilov
Copy link

Hello @fidley!
On zcl_falv inherition I add new methods and attributes.
Before calling lo_alv->display( ). I use lo_alv->set_autosave( abap_true )..
On redefinition method evf_user_command I try to get attribute autosave, but it is empty. It happends if class instance is created as popup screen. If i_popup = abap_false evertything is OK.
For example:

CLASS lcl_alv DEFINITION INHERITING FROM zcl_falv.
  PUBLIC SECTION.
    METHODS set_autosave
      IMPORTING
        iv_autosave TYPE abap_bool.

    METHODS get_autosave
      RETURNING
        VALUE(rv_autosave) TYPE abap_bool.

  PROTECTED SECTION.
    METHODS evf_user_command REDEFINITION.

  PRIVATE SECTION.
    DATA mv_autosave TYPE abap_bool.
ENDCLASS.

CLASS lcl_alv IMPLEMENTATION.
  METHOD set_autosave.
    mv_autosave = iv_autosave.
  ENDMETHOD.

  METHOD get_autosave.
    rv_autosave = mv_autosave.
  ENDMETHOD.

  METHOD evf_user_command.
     ...
    IF get_autosave( ) = abap_true.
      ...
    ENDIF.
  ENDMETHOD.
ENDCLASS.

I figured out that in metod create_by_copy creating new object.
Can you fix it?

@fidley
Copy link
Owner

fidley commented Nov 21, 2020

Hi @PShumilov,
it is the same issue like #41. I don't know why it is this way, but when I want to display grid in the popup, then the instance of grid should be created inside the PBO event of the popup.

If I could solve this problem then your issue and #41 would be solved. I need to check if there is a way for that.

Maybe you have an idea?

Cheers
Łukasz

@fidley fidley self-assigned this Nov 21, 2020
@fidley fidley added the bug label Nov 21, 2020
@PShumilov
Copy link
Author

I tried to fix the bug different ways. In case that instance of grid should be created in PBO event I invented horrible bad solution (but it works). Maybe this could lead you to find good solvation.

I added new EXPORTING parametr eo_falv like io_falv in FM Z_FALV_DISPLAY and call it in method create for popup:

rv_falv->layout_save = 'A'.
rv_falv->variant-report = sy-cprog.
rv_falv->variant-username = sy-uname.
rv_falv->grid = cast #(  rv_falv ).

if i_popup = abap_true.
  call function 'Z_FALV_DISPLAY'
    exporting
      io_falv         = rv_falv
      iv_start_row    = 1
      iv_start_column = 1
  importing
      eo_falv         = rv_falv
endif.

After create_by_copy in PBO event:

falv->pbo( iv_dynnr = iv_dynnr ).
falv->display( iv_force_grid = abap_true ).
LEAVE TO SCREEN 0.

Then replace "old" instance with instance of grid created in PBO:

if io_falv->screen eq io_falv->c_screen_popup.
  call screen io_falv->screen starting at  iv_start_column iv_start_row
                              ending at    iv_end_column iv_end_row.
  eo_falv ?= <out>->falv.
else.
  call screen io_falv->screen.
endif.

@fidley
Copy link
Owner

fidley commented Nov 23, 2020

Perfect, I haven't thought about such way! Thanks I will try to implement similar thing inside to get rid of create_by_copy :D

I'll keep you informed.

fidley added a commit that referenced this issue Nov 23, 2020
@fidley
Copy link
Owner

fidley commented Nov 23, 2020

Please update your FALV, I've used your approach but bit pimped :)

I am creating a main GUI container in the screen and then I quit, then I pass it to grid object and now copying of objects is not necessary. :)

@PShumilov
Copy link
Author

Thanks @fidley! it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants