2023 Mar 17 6:11 PM
Hello colleagues, I have a problem with the report that I have developed, when I run it on the selection parameters screen, it shows me the alv with the data correctly, but the problem arises when I press the "back" button on that screen and it takes me to another screen, which is the third image that I am showing, I am using 'REUSE_ALV_GRID_DISPLAY', I have already tried several solutions from the forum but none of them work for me. I need your help please
Sorry for not copying the code, it is the following:
I will not put the content of the PERFORM get_data subroutine because of space issues
REPORT zpsr003_hc.
TABLES: proj, tcj41, csks, prps, bkpf, tj02t, syst.
DATA: BEGIN OF ls_presu,
psphi TYPE prps-psphi,
objnr TYPE proj-objnr,
"posid type prps-posid,
pspid TYPE proj-pspid,
presupuesto TYPE rpsco-wlp00,
END OF ls_presu,
lt_presu LIKE STANDARD TABLE OF ls_presu.
data : es_exit_caused_by_user TYPE slis_exit_by_user.
*&---------------------------------------------------------------------*
DATA: gt_repo TYPE STANDARD TABLE OF zsps_fipro. "se uso cuando se creo un tipo de dato(tabla o estructura
DATA : it_items TYPE zt_fichaproyecto."ZIT_PSDESCO. "zTPS_DESCO."ZT_FICHAPROYECTO. "ZTT_FICHAPROYECTO
DATA: gs_repo TYPE zsps_fipro.
DATA:gs_item TYPE zsps_fipro.
DATA: gt_fcat TYPE slis_t_fieldcat_alv,
gs_fcat LIKE LINE OF gt_fcat,
gs_layout TYPE slis_layout_alv,
gs_variant TYPE disvariant,
gv_cnt TYPE i.
DATA : fm_name TYPE rs38l_fnam,
control_parameters TYPE ssfctrlop,
output_options TYPE ssfcompop.
DATA: lt_job_output_info TYPE ssfcrescl,
lv_fm_name TYPE rs38l_fnam,
lv_size TYPE i,
lt_lines TYPE TABLE OF tline.
SELECTION-SCREEN BEGIN OF BLOCK bn1 WITH FRAME TITLE TEXT-t01.
SELECT-OPTIONS : p_pspid FOR proj-pspid.
SELECTION-SCREEN END OF BLOCK bn1.
SELECTION-SCREEN BEGIN OF BLOCK bn2 WITH FRAME TITLE TEXT-t02.
PARAMETERS : r_inicio RADIOBUTTON GROUP rad DEFAULT 'X',
r_cierre RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF BLOCK bn2.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display_data.
END-OF-SELECTION.
FORM display_data.
CLEAR: gv_cnt, gt_fcat[], gs_fcat.
gs_layout-colwidth_optimize = 'X'.
gs_variant-report = sy-repid.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'PROYECTO'.
gs_fcat-seltext_m = 'Proyecto'.
gs_fcat-hotspot = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'NOM_PROYECTO'.
gs_fcat-seltext_m = 'Nom.Proyec'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'SOLICITANTE'.
gs_fcat-seltext_m = 'Solicitante'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'RESPONSABLE'.
gs_fcat-seltext_m = 'Responsable'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'CO_RESPONSABLE'.
gs_fcat-seltext_m = 'Co.Respon'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'AREA'.
gs_fcat-seltext_m = 'Área'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'VIDA_UTIL'.
gs_fcat-seltext_m = 'Vida.Útil'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'TIPO'.
gs_fcat-seltext_m = 'Tipo'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'PRESUPUESTO'.
gs_fcat-seltext_m = 'Presupuesto'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'FECHA_INICIO'.
gs_fcat-seltext_m = 'Fe.Inicio'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'FECHA_FIN'.
gs_fcat-seltext_m = 'Fe.Fin'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'DURACION'.
gs_fcat-seltext_m = 'Duración'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'OBJETIVO'.
gs_fcat-seltext_m = 'Objetivo'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'ALCANCE'.
gs_fcat-seltext_m = 'Alcance'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
IF r_inicio = 'X'.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'AMP_PRESUPUESTO'.
gs_fcat-seltext_m = 'Amp.Presupuesto'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'AMP_CRONOGRAMA'.
gs_fcat-seltext_m = 'Amp.Cronograma'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'JUSTIFICACION'.
gs_fcat-seltext_m = 'Justificación'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'PRESUP_MODIFICADO'.
gs_fcat-seltext_m = 'Pres.Modificado'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'FECHAFIN_MODIFICADA'.
gs_fcat-seltext_m = 'FeFin.Modificada'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'FECHAFIN_REAL'.
gs_fcat-seltext_m = 'FeFin.Real'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'COSTO_REAL'.
gs_fcat-seltext_m = 'Cost.Real'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'DESVI_CRONOGRAMA'.
gs_fcat-seltext_m = 'Desvi.Cronograma'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'DESVIACION_COSTO'.
gs_fcat-seltext_m = 'Desvi.Costo'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'CONCLUSION'.
gs_fcat-seltext_m = 'Conclusión'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
ELSE.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'AMP_PRESUPUESTO'.
gs_fcat-seltext_m = 'Amp.Presupuesto'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'AMP_CRONOGRAMA'.
gs_fcat-seltext_m = 'Amp.Cronograma'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'JUSTIFICACION'.
gs_fcat-seltext_m = 'Justificacion'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'PRESUP_MODIFICADO'.
gs_fcat-seltext_m = 'Pres.Modificado'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'FECHAFIN_MODIFICADA'.
gs_fcat-seltext_m = 'FeFin.Modificada'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'FECHAFIN_REAL'.
gs_fcat-seltext_m = 'FeFin.Real'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'COSTO_REAL'.
gs_fcat-seltext_m = 'Cost.Real'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'DESVI_CRONOGRAMA'.
gs_fcat-seltext_m = 'Desvi.Cronograma'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'DESVIACION_COSTO'.
gs_fcat-seltext_m = 'Desvi.Costo'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'CONCLUSION'.
gs_fcat-seltext_m = 'Conclusión'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
gv_cnt = gv_cnt + 1.
gs_fcat-col_pos = gv_cnt.
gs_fcat-fieldname = 'CORRELATIVO'.
gs_fcat-seltext_m = 'N'.
gs_fcat-no_out = 'X'.
APPEND gs_fcat TO gt_fcat.
CLEAR : gs_fcat.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid " Name of the calling program
"i_callback_pf_status_set = 'PF_STATUS' " Set EXIT routine to status
i_callback_user_command = 'USER_COMMAND'
"i_callback_html_top_of_page = space " EXIT routine for command handling
is_layout = gs_layout " List layout specifications
it_fieldcat = gt_fcat " Field catalog with field descriptions
i_save = 'A' " Variants can be saved
is_variant = gs_variant " Variant information
TABLES
t_outtab = gt_repo "gt_repo " Table with data to be displayed
EXCEPTIONS
program_error = 1 " Program errors
OTHERS = 2.
"ENDCASE.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
CLEAR : gs_repo.
READ TABLE gt_repo INTO gs_repo INDEX rs_selfield-tabindex.
IF gs_repo-proyecto IS NOT INITIAL.
PERFORM call_sf.
ENDIF.
* CASE r_ucomm.
* WHEN 'BACK'.
* LEAVE PROGRAM.
* ENDCASE.
"rs_selfield-refresh = 'X'.
ENDCASE.
CLEAR : gs_repo, sy-ucomm.
ENDFORM.
FORM pf_status USING wa_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
ENDFORM. "pf_status
FORM call_sf.
*SmartForm
CONSTANTS: gc_format TYPE so_obj_tp VALUE 'PDF',
gc_formname TYPE tdsfname VALUE 'ZPSF_FICHAPROYECTOPDF'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = gc_formname
IMPORTING
fm_name = lv_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
control_parameters-preview = 'X'.
"control_parameters-getotf = 'X'.
control_parameters-no_dialog = 'X'.
output_options-tddest = 'LP01'.
SELECT ps~pspnr,p~pspid,
zt~correlativo,zt~proyecto, zt~descripcion, zt~modelo,zt~year_fabricacion, zt~marca, zt~serie, zt~costo_us, zt~vida_util_desco, zt~porcentaje
INTO TABLE @DATA(lt_items)
FROM proj AS p
INNER JOIN prps AS ps ON p~pspnr = ps~psphi
INNER JOIN ztt_psdesco AS zt ON ps~pspnr = zt~proyecto
WHERE" p~pspid IN @p_pspid and
p~pspid = @gs_repo-proyecto.
DATA: vg_variable TYPE num6.
"DATA: vg_costous type string.
LOOP AT lt_items INTO DATA(ls_items).
CLEAR gs_item.
"gs_item-correlativo = ls_items-correlativo.
vg_variable = ls_items-correlativo.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = vg_variable
IMPORTING
output = vg_variable.
gs_item-correlativo = vg_variable.
gs_item-descripcion = ls_items-descripcion.
gs_item-modelo = ls_items-modelo.
gs_item-year_fabricacion = ls_items-year_fabricacion.
gs_item-marca = ls_items-marca.
gs_item-serie = ls_items-serie.
gs_item-costo_us = ls_items-costo_us.
* vg_costous = ls_items-costo_us.
* CONDENSE vg_costous.
* gs_item-costo_us = vg_costous
.
gs_item-vida_util_desco = ls_items-vida_util_desco.
gs_item-porcentaje = ls_items-porcentaje.
APPEND gs_item TO it_items.
CLEAR vg_variable.
ENDLOOP.
CALL FUNCTION lv_fm_name
EXPORTING
control_parameters = control_parameters
output_options = output_options
user_settings = space
iv_cod_proyecto = gs_repo-proyecto
iv_nom_proyecto = gs_repo-nom_proyecto
iv_solicitante = gs_repo-solicitante
iv_responsable = gs_repo-responsable
iv_co_responsable = gs_repo-co_responsable
iv_area = gs_repo-area
iv_vida_util = gs_repo-vida_util
iv_tipo = gs_repo-tipo
iv_presupuesto = gs_repo-presupuesto
iv_fecha_inicio = gs_repo-fecha_inicio
iv_fecha_fin = gs_repo-fecha_fin
iv_duracion = gs_repo-duracion
iv_objetivo = gs_repo-objetivo
iv_alcance = gs_repo-alcance
iv_amp_presupuesto = gs_repo-amp_presupuesto
iv_amp_cronograma = gs_repo-amp_cronograma
iv_justificacion = gs_repo-justificacion
iv_presup_modificado = gs_repo-presup_modificado
iv_fechafin_modificada = gs_repo-fechafin_modificada
iv_fechafin_real = gs_repo-fechafin_real
iv_costo_real = gs_repo-costo_real
iv_desvi_cronograma = gs_repo-desvi_cronograma
iv_desviacion_costo = gs_repo-desviacion_costo
iv_conclusion = gs_repo-conclusion
IMPORTING
job_output_info = lt_job_output_info
TABLES
it_items = it_items
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 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.
*
CLEAR it_items.
ENDFORM.
2023 Mar 17 6:44 PM
Please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!
2023 Mar 17 6:59 PM
Back should terminate REUSE_ALV_GRID_DISPLAY but you don't show the code after CALL FUNCTION, and you don't show the code which leads to displaying the ABAP List ("3rd screen") so difficult to help.
2023 Mar 18 1:51 PM
When you press the back the FM is returning and probably you have WRITE statements in call_sf form or after the fm.
Have you tried to CALL SELECTION-SCREEN 1000. or set screen 0.
2023 Mar 18 5:37 PM
Thanks for the aside, I was able to solve it, I had a hidden write. I had not seen it well
2023 Mar 18 4:04 PM
You didn't handle the back function key, so the program continues after the call of the (old) reuse FM and continue to list-processing as you seem to have some WRITE statement - look for Abap Reporting Events and Classic Lists.
Try to remove the WRITE or actually handle the returned parameters of the FM such as E_EXIT_CAUSED_BY_CALLER and ES_EXIT_CAUSED_BY_USER to trigger some LEAVE PROGRAM (exit) or LEAVE TO SCREEN 0 (back)
2023 Mar 18 5:42 PM
Hello , you were right , it was solved , I can not believe that I did not realize that I had a write hidden in my code , thanks for that .
2023 Mar 18 5:12 PM
Sorry, I already put all the code so you can understand it better. thank you