cancel
Showing results for 
Search instead for 
Did you mean: 

SUBMIT rfitemgl problem

ronaldo_aparecido
Contributor
0 Kudos
203

Hi guys 

I'm using submit to get data from FBL3n and put it in an internal table. The problem is: When I execute submit it's displaying the fbl3n selection screen and I don't want that, see my code:

FORM f_get_and_fill_data .

  FIELD-SYMBOLS: <fs_t_data> TYPE ANY TABLE,
                 <fs_s_data> TYPE any,
                 <fs_x_whs>  TYPE any,
                 <fs_saida>  TYPE ty_saida.

  DATA:  lf_ref              TYPE REF TO data,
         lt_texpr            TYPE rsds_texpr.

  " ********************************************************************
  " Chamada da Transação FBL3N
  " ********************************************************************

  " Ativa exportação de dados do ALV
  cl_salv_bs_runtime_info=>set(
    EXPORTING display  = abap_false
      metadata = abap_true
      data     = abap_true ).

*  SUBMIT zrsd242
*    WITH FREE SELECTIONS lt_texpr
*    WITH p_bukrs   EQ p_bukrs
*    WITH s_branch  IN s_branch
*    WITH s_docnum  IN s_docnum
*    WITH s_docdat  IN s_docdat
*    WITH s_oper    IN s_oper
*    WITH s_cat_nf  IN s_cat_nf
*    WITH p_j1b1n   EQ abap_false
*    WITH p_zt082   EQ abap_false
*    WITH p_dois    EQ abap_true
*    WITH r_detail  EQ abap_true
*    WITH r_sintet  EQ abap_false
*  USING SELECTION-SCREEN 1000 AND
*        RETURN EXPORTING LIST TO MEMORY.

SUBMIT rfitemgl
WITH FREE SELECTIONS lt_texpr
  WITH p_SAKNR IN p_SAKNR
  WITH p_wlbuk IN p_wlbuk
  WITH p_budat IN p_budat
  WITH x_opsel  EQ abap_false
  WITH x_clsel  EQ abap_false
  WITH x_aisel  EQ abap_true
  WITH x_norm   EQ abap_true
*  WITH pa_vari  EQ '/OES_EXT'
  USING SELECTION-SCREEN 1000 AND
        RETURN EXPORTING LIST TO MEMORY.

  " ********************************************************************
  " Recupera tabela ALV
  " ********************************************************************
  TRY.
      cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = lf_ref ).
      ASSIGN lf_ref->* TO <fs_t_data>.
    CATCH cx_salv_bs_sc_runtime_info.
      MESSAGE 'Erro ao recuperar dados do ALV - zt0388' TYPE 'E'.
  ENDTRY.

  cl_salv_bs_runtime_info=>clear_all( ).

  IF <fs_t_data>[] IS ASSIGNED.
    IF NOT <fs_t_data> IS INITIAL.
      LOOP AT <fs_t_data> ASSIGNING <fs_s_data>.
        MOVE-CORRESPONDING <fs_s_data> TO gs_saida.
        gs_saida-datum = sy-datum.
        gs_saida-uzeit = sy-uzeit.
        APPEND gs_saida TO gt_saida.
      ENDLOOP.
    ELSE.
      MESSAGE text-e01 TYPE 'S' DISPLAY LIKE 'E'.
      LEAVE LIST-PROCESSING.
    ENDIF.
  ELSE.
    MESSAGE text-e01 TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.
View Entire Topic
raymond_giuseppi
Active Contributor
0 Kudos

You didn't use VIA SELECTION-SCREEN, so it should only be displayed if some mandatory parameters are missing, or wrong values trigering error message,

Also, EXPORTING LIST TO MEMORY shouldn't be required if the line items are displayed in an ALV grid, consider setting PARAMETER ID 'FIT_ALVC' for this?

ronaldo_aparecido
Contributor
0 Kudos
I discovered that it displays the initial screen only when it doesn't find data, is there any way to not display this error message stating that it didn't find data?
raymond_giuseppi
Active Contributor
0 Kudos
Not possible with a simple SUBMIT, it's allowed with CALL TRANSACTION but not SUBMIT. Consider running the report in an RFC call (without GUI) and handle errors. Or check yourself if records exist...
ronaldo_aparecido
Contributor
0 Kudos
As a solution, I did a select before doing the 'submit' and if I don't find it, I won't even do the 'submit'.
raymond_giuseppi
Active Contributor
0 Kudos

Should do the job, you could also replicate the behavior of the transaction using MF LDB_PROCESS on LDB SDF 'G/L Account Database' after building the table parameter SELECTIONS.