08-25-2009 5:24 PM
Hello all,
I have created a list using CL_SALV_TABLE. When you click on a line, a new mode must be opened. There, the user will fill in some data that must be retrieved and shown in the main list when the user closes the new mode. To do so Iu2019ve used u201CCALL FUNCTION func STARTING NEW TASK task CALLING meth ON END OF TASKu201D statement.
Iu2019ve tried to refresh the list within meth (called on end of task) but it doesn't work. I've also tried to get all the data again, but it prompts a short dump, set a new ok code using method cl_gui_cfw=>set_new_ok_code, even a WAIT until process is finished (not valid because I need process 1 active all the timeu2026)
SAP help says u201CThe SET USER-COMMAND u2018OKCDu2019 statement replaces the REFRESH SCREEN commandu201D
CALL FUNCTION 'function'
STARTING NEW TASK w_taskname
PERFORMING end_of_creation ON END OF TASK
EXPORTING
i_zzta = ztztl_zzta
i_manual_order = space
EXCEPTIONS
communication_failure = 1 MESSAGE w_msg
system_failure = 2 MESSAGE w_msg.
[u2026]
FORM end_of_creation USING p_taskname.
RECEIVE RESULTS FROM FUNCTION 'function'
IMPORTING
e_zzta = ztztl_zzta
EXCEPTIONS
communication_failure = 1 MESSAGE w_msg
system_failure = 2 MESSAGE w_msg.
[Modify list]
SET USER-COMMAND 'OKCD'.
[u2026]
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'OKCD'.
Perform get_data.
How can I have the same behaviour when using CL_SALV_TABLE??
Thanks in advance!
08-26-2009 8:43 AM
> Iu2019ve tried to refresh the list within meth (called on end of task) but it doesn't work. I've also tried to get all the data again, but it prompts a short dump,
Precisely what do you mean by but it doesn't work. Also what short dump do you get?
I would first get the program working without parallel processing. I.e. call the function module, ( or a dummy equivalent for test purposes, that just changes the data somehow ), and see whether you can get the table updated correctly.
After that, try again with the parallel processing.
You might also like to read the FAQs here where Richard Harper discusses self-refreshing screens.
matt
08-25-2009 5:33 PM
Hello,
You can use REFRESH method from following classes:
CL_SALV_TABLE
CL_SALV_HIERSEQ_TABLE
For more information please refer to link: [SALV|http://help.sap.com/saphelp_sm32/helpdata/en/37/d0ee406b657e7fe10000000a1550b0/frameset.htm]
Hope this helps!
Thanks,
Augustin.
08-25-2009 5:44 PM
Hello Augustin,
that's the first thing I tried and it didn't work, probably because it's still in the parallel process. Anyway, thanks for your reply.
08-26-2009 8:43 AM
> Iu2019ve tried to refresh the list within meth (called on end of task) but it doesn't work. I've also tried to get all the data again, but it prompts a short dump,
Precisely what do you mean by but it doesn't work. Also what short dump do you get?
I would first get the program working without parallel processing. I.e. call the function module, ( or a dummy equivalent for test purposes, that just changes the data somehow ), and see whether you can get the table updated correctly.
After that, try again with the parallel processing.
You might also like to read the FAQs here where Richard Harper discusses self-refreshing screens.
matt
08-26-2009 9:17 AM
Hello Matt,<br><br>
does not work means that if I write the following within method ON END OF TASK, the report is not refreshed.
<br><br>
<pre>
o_alv->refresh( ).
</pre><br><br>
I've also tried:
<br><br>
<pre>
o_alv->refresh( ).
o_alv->display( ).
data: o_alv TYPE REF TO cl_salv_table</pre><br><br>
<pre>Short dump: RPERF_ILLEGAL_STATEMENT
Error analysis
There is probably an error in the program
"SAPLSLVC_FULLSCREEN".
The program was probably called in a conversion exit
or in a field exit. These are implemented by
function modules called CONVERSION_EXIT_xxxxx_INPUT/OUTPUT or
USER_EXIT_xxxxx_INPUT.
Conversion exits are triggered during screen field transports or
WRITE statements, field exits during field transports from the
screen to the ABAP/4 program.
In this connection, the following ABAP/4 statements are not allowed:
- CALL SCREEN
- CALL DIALOG
- CALL TRANSACTION
- SUBMIT
- MESSAGE W... and MESSAGE I...
- COMMIT WORK, ROLLBACK WORK
- COMMUNICATION RECEIVE
- STOP
- REJECT
- EXIT FROM STEP-LOOP
Moreover, conversion exits for output conversion
(implemented by function modules called
CONVERSION_EXIT_xxxxx_OUTPUT) do not allow
- MESSAGE E...
to be used.
Trigger Location of Runtime Error
Program SAPLSLVC_FULLSCREEN
Include LSLVC_FULLSCREENU01
Row 187
Module type (FUNCTION)
Module Name REUSE_ALV_GRID_DISPLAY</pre><br><br>
But this short dump is expected since CALL FUNCTION - STARTING NEW TASK help says u201CIn the callback routine, you are not allowed to execute statements that interrupt the program execution or terminate a SAP LUW. Statements for list output are not executed.u201D<br><br>
Thanks Matt, I'll take a look at that forum, but I also tried a self list refresh using a timer and that prompted another short dump: LIST_TOO_MANY_LPROS -> "Error analysis: At present, the maximum permitted number of nested screen levels is restricted to 50." <br><br>
If I find a solution I'll let you know.<br><br>
<br><br>
Thank you!!
Edited by: Matt on Aug 26, 2009 1:16 PM
08-26-2009 12:21 PM
Have you checked that ON END OF TASK procedure is being called?
After the REFRESH, you may well need a CL_GUI_CFW=>FLUSH( ) command as well.
For LIST_TOO_MANY_LPROS, that's easy - you're launching too many lists. SUBTRACT 1 FROM sy-lsind. Or sy-lsind = 1. should fix it.
matt
08-26-2009 1:13 PM
Hi Matt,
yes, ON END OF TASK procedure is being called. The CL_GUI_CFW=>FLUSH( ) after the refresh was other test I did with no results
For the LIST_TOO_MANY_LPROS problem I did check sy-lsind and it's values is always 0 so I couldn't go for that solution... any clues?
Thank you!!
08-26-2009 2:26 PM
Sorry, LIST_TOO_MANY_LPROS is caused by too many CALL SCREENS. Nothing to do with sy-lsind. Normally, you call the screen with the controls just once.
matt
09-15-2009 8:46 AM
you can avoid use CALL SCREEN XXX and ....try with LEAVE TO SCREEN XXX or sET SCREEN XXX.
08-26-2009 2:26 PM
I tried this way and it is working for me by using the WAIT UNTIL after the CALL FUNCTION. I have created a simple RFC FM ZTEST_NP_NEW_TASK. In which I put a wait for 2 seconds.
*----------------------------------------------------------------------*
* CLASS lcl_report DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_report DEFINITION.
*
PUBLIC SECTION.
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE erdat,
auart TYPE auart,
kunnr TYPE kunnr,
END OF ty_vbak.
*
DATA: t_vbak TYPE STANDARD TABLE OF ty_vbak.
DATA: lf_done TYPE flag.
DATA: o_alv TYPE REF TO cl_salv_table.
*
METHODS:
get_data,
generate_output.
METHODS:
refresh_table_m
IMPORTING
p_task TYPE clike.
ENDCLASS. "lcl_report DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function.
ENDCLASS. "lcl_event_handler DEFINITION
DATA: lo_report TYPE REF TO lcl_report.
START-OF-SELECTION.
CREATE OBJECT lo_report.
lo_report->get_data( ).
lo_report->generate_output( ).
08-26-2009 2:31 PM
... Continued ...
*----------------------------------------------------------------------*
* CLASS lcl_report IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_report IMPLEMENTATION.
*
METHOD get_data.
SELECT vbeln erdat auart kunnr
INTO TABLE t_vbak
FROM vbak
UP TO 20 ROWS.
ENDMETHOD. "get_data
METHOD generate_output.
DATA: lx_msg TYPE REF TO cx_salv_msg.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = o_alv
CHANGING
t_table = t_vbak ).
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.
o_alv->set_screen_status(
pfstatus = 'SALV_STANDARD'
report = 'SALV_DEMO_TABLE_EVENTS'
set_functions = o_alv->c_functions_all ).
DATA: lo_events TYPE REF TO cl_salv_events_table,
lo_event_h TYPE REF TO lcl_event_handler.
lo_events = o_alv->get_event( ).
CREATE OBJECT lo_event_h.
SET HANDLER lo_event_h->on_user_command FOR lo_events.
o_alv->display( ).
ENDMETHOD. "generate_output
METHOD refresh_table_m.
me->lf_done = 'X'.
APPEND INITIAL LINE TO me->t_vbak.
me->o_alv->refresh( ).
ENDMETHOD. "refresh_Table_m
ENDCLASS. "lcl_report IMPLEMENTATION
*----------------------------------------------------------------------*
* Event Handler for the SALV
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_user_command.
CASE e_salv_function.
WHEN 'MYFUNCTION'.
CALL FUNCTION 'ZTEST_NP_NEW_TASK' " RFC
STARTING NEW TASK 'TEST1'
CALLING lo_report->refresh_table_m ON END OF TASK.
* Waiting to finish the task
WAIT UNTIL lo_report->lf_done = 'X'. " UP TO 2 SECONDS.
CHECK 1 = 2.
ENDCASE.
ENDMETHOD. "on_user_command
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Regards,
Naimesh Patel
08-26-2009 3:15 PM
Hi Naimesh,
you are right, that works but I can't use it... I need process 1 to be active all the time (the user can open a new mode, delete a line, etc...) and using the WAIT UNTIL, the process 1 gets "blocked" until process 2 is finished.
Anyway, thank you all for your help. I really appreciate it.
Regards,
María José
08-27-2009 4:38 PM
I used the preview but couldn't fix the message, didn't know it was a problem of length... here it is again!
Hi guys,
I've found a solution, it is not the one I wanted but now my program works how I need it.
Let me show you the solution over Naimesh's code.
METHOD generate_output.
DATA: lx_msg TYPE REF TO cx_salv_msg.
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = abap_true " <-- add this
IMPORTING
r_salv_table = o_alv
CHANGING
t_table = t_vbak ).
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.
o_alv->set_screen_status(
pfstatus = 'SALV_STANDARD'
report = 'SALV_DEMO_TABLE_EVENTS'
set_functions = o_alv->c_functions_all ).
DATA: lo_events TYPE REF TO cl_salv_events_table,
lo_event_h TYPE REF TO lcl_event_handler.
lo_events = o_alv->get_event( ).
CREATE OBJECT lo_event_h.
SET HANDLER lo_event_h->on_user_command FOR lo_events.
o_alv->display( ).
ENDMETHOD.
METHOD refresh_table_m.
me->lf_done = 'X'. " <-- remove everything regarding WAIT UNTIL solution
APPEND INITIAL LINE TO me->t_vbak.
SET USER-COMMAND 'OK'. <-- add this
me->o_alv->refresh( ).
ENDMETHOD.
*----------------------------------------------------------------------*
* Event Handler for the SALV
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_user_command.
CASE e_salv_function.
WHEN 'MYFUNCTION'.
CALL FUNCTION 'ZTEST_NP_NEW_TASK' "RFC
STARTING NEW TASK 'TEST1'
CALLING lo_report->refresh_table_m ON END OF TASK.
* Waiting to finish the task " <-- remove this
WAIT UNTIL lo_report->lf_done = 'X'. " <-- remove this
CHECK 1 = 2. " <-- remove this
ENDCASE.
ENDMETHOD.
ENDCLASS.
to be continued
Edited by: María José Torres on Aug 27, 2009 6:04 PM
08-27-2009 5:00 PM
Good to know that it would work with LIST.
Your code in the last post is not easily readable. In forum, I guess, we have 2500 character limit per post. So, we must use the Preview to see how the post will look like. Please make necessary changes in your post.
Regards,
Naimesh Patel
08-27-2009 5:13 PM
continued
The rest of Naimesh's program remains the same.
Solution:
1. Add LIST_DISPLAY parameter to FACTORY method
2. On method/routine called/performed ON END OF TASK:
SET USER-COMMAND 'OK'.
o_alv->refresh( ).
Adding LIST_DISPLAY parameter to FACTORY method displays the report as a list, only then, the REFRESH command will work whenever you set an ok code first. When removing the WAIT UNTIL statement process 1 keeps active all the time.
I still don't understand the problem between GRID and REFRESH.
The report appearance is not as nice as before but the problem is solved
Thank you all!!