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 Report when executed in background get canceled,executes in foreground

Former Member
0 Kudos

Hi All,

Issue :

An ALV report executes fine in forground and short dumps in background.

If executed in background, We are facing the runtime error "OBJECTS_OBJREF_NOT_ASSIGNED" ,

short text 'Access via 'NULL' object reference not possible'

while calling the method 'check_changed_data'

( CALL METHOD galv->check_changed_data

IMPORTING

e_valid = lx_valid. )

This method has been called in the PAI, so I am not sure the reason for error in background.

Can any one please share your thoughts for solving the issue.

Regards,

Krishna

10 REPLIES 10

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Krishna,

This is because in BG mode you don't have an UI available to you, hence this issue. So what's the alternative: check if the UI is available or not, if not then use a docking container to display the ALV.

Check the Rich's response in this thread: you'll know how to handle the scenario!

BR,

Suhas

Former Member
0 Kudos

Thanks Suhas for the quick turn around.

I have made changes using the 'Docking Container' , but the issue still exists while executing in background.

The runtime error occur at

"CALL METHOD galv->check_changed_data "

This method exists in the PAI, where saving the editable fields of the ALV fields to the database table happen.

I just wonder, in the background job ALV is not interactive, but just needs to display.

However, why is the control moving to the PAI event.

Can you please shoot your thoughts for solving the issues.

Appreciate you help in this regard.

Thanks,

Krishna

0 Kudos

Hello Krishna,

As you've mentioned in BG, there is no interaction & PAI should not be triggered at all.

Could you cross-check if the method is indeed triggered in the PAI module? If you want better analysis, post relevant portions of your code with proper formatting !

BR,

Suhas

Former Member
0 Kudos

Hi,

You might need to some thing like the below


 if go_custom_container is initial.
    if sy-batch eq c_x.
      create object go_grid
        exporting
          i_parent = go_parent_grid.
      perform build_fieldcat.
      set handler event_receiver->handle_print_top_of_page for go_grid.
      gv_variant-report = 'ZPR_R_PA425'.
      call method go_grid->set_table_for_first_display
        exporting
          is_layout       = t_lay
          is_variant      = gv_variant
          i_save          = 'X'
        changing
          it_outtab       = i_final
          it_fieldcatalog = t_fieldcat.
*        it_sort         = t_sort.
    else.
      perform build_fieldcat.
      perform create_and_init_alv.
    endif.
  endif.

Former Member
0 Kudos

Thanks a lot Suhas for your help.

I have further checked and the runtime error exists in the PAI itself.

Please find the required details below:

PROCESS BEFORE OUTPUT.

MODULE set_gui_status.

MODULE display_sales_order.

PROCESS AFTER INPUT.

MODULE save.

MODULE exit AT EXIT-COMMAND.

In the PBO event, the module 'display_sales_order' have the method "CALL METHOD gv_alvgrid->set_table_for_first_display"

to display the ALV.

In PAI event, the module 'save' , the runtime exists at the method "check_changed_data" :

CALL METHOD gv_alvgrid->check_changed_data

IMPORTING

e_valid = lv_valid.

Please share your thoughts for resolving the issue.

Thanks Gurucharan for your thought. I shall try your option too.

Regards,

Krishna

Former Member
0 Kudos

may be you have not maintained printer in your user profile..

Clemenss
Active Contributor
0 Kudos

Hi Krishna;

METHOD 'check_changed_data' is triggered by the data_changed evebt that is triggered when you change data within an editable alv.

This is definitely not possible in background because there is no way to change data in editable ALV except via GUI online.

I wonder what this report does and how check_changed_data gets called. If it is user code, enclose it in a check:

IF SY_BATCH IS INITIAL.
  CALL METHOD galv->check_changed_data
    IMPORTING
      e_valid = lx_valid. )
ENDIF.

Regards,

Clemens

Former Member
0 Kudos

Hi

Check this...

IF r_alvgrid IS INITIAL.

lv_dynnr = sy-dynnr.

IF cl_gui_alv_grid=>offline( ) IS INITIAL.

CREATE OBJECT r_customcontainer

EXPORTING

container_name = lv_customcontrol_name1

repid = sy-repid

dynnr = lv_dynnr

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

CREATE OBJECT r_alvgrid

EXPORTING

i_parent = r_customcontainer "Parent: Container

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL METHOD r_alvgrid->set_table_for_first_display

EXPORTING

i_default = c_x

is_layout = x_layout

CHANGING

it_outtab = t_final

it_fieldcatalog = t_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

RETURN.

ENDIF.

With regards,

Aahbha

Former Member
0 Kudos

Thanks Clemens,

I have already implemented the below code, but the job seems to go in an endless loop and not

Gets completed.

IF SY_BATCH IS INITIAL.

CALL METHOD galv->check_changed_data

IMPORTING

e_valid = lx_valid.

ENDIF.

Regards,

Krishna

0 Kudos

Hi Krishna,

that may have a different reason.

If you think there is an endless loop, you can see the process in SM50 process overview. From there you can enter DEBU in the command field and enter debugger.

If the job is scheduled and visible as running in SM37, you can Catch it from there.

Still I wonder what the check_changed_data is used for. Is it an editable ALV or what?

Regards,

Clemens