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: 

SUBMIT standard program with SELECTION-TABLE and FREE SELECTIONS .

titanium
Participant
0 Kudos

Hi folks ,

I'm developing a program to automate CML Invoice posting .

the standard program having normal selection screen and dynamic selections and I need to fill both to run the program correctly .

the issue is the SELECTION-TABLE valus is passed correctly but when I check for texpr table its empty in the called program .

below is my sample code :



ls_fields-arity = 0.
ls_fields-fieldname = 'SKOART'.
ls_fields-option = 'EQ'.
ls_fields-low = '1105'.

APPEND ls_fields to ls_texpr-expr_tab.
ls_texpr-tablename = 'VDBEPP'.
APPEND ls_texpr to texpr.


CLEAR ls_seltab.
ls_seltab-selname = 'SO_BUKRS'.
ls_seltab-kind = 'S'.
ls_seltab-sign = 'I'.
ls_seltab-option = 'EQ'.
ls_seltab-low = 'ABCD'.
* ls_seltab-high = so_date-high.
APPEND ls_seltab TO lt_seltab.
*
*
CLEAR ls_seltab.
ls_seltab-selname = 'SO_RANL'.
ls_seltab-kind = 'S'.
ls_seltab-sign = 'I'.
ls_seltab-option = 'EQ'.
ls_seltab-low = '123456'.
* ls_seltab-high = so_date-high.
APPEND ls_seltab TO lt_seltab.

CLEAR ls_seltab.
ls_seltab-selname = 'P_DDISPO'.
ls_seltab-kind = 'P'.
ls_seltab-low = '20201211'.

APPEND ls_seltab TO lt_seltab.
*
CLEAR ls_seltab.
ls_seltab-selname = 'P_KDATE'.
ls_seltab-kind = 'P'.
* ls_seltab-sign = 'I'.
* ls_seltab-option = 'EQ'.
ls_seltab-low = sy-datum.
* ls_seltab-high = so_date-high.
APPEND ls_seltab TO lt_seltab.







SUBMIT rfvsold2
WITH SELECTION-TABLE lt_seltab
WITH FREE SELECTIONS texpr
EXPORTING LIST TO MEMORY AND RETURN.



*
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_obj
EXCEPTIONS
not_found = 1
OTHERS = 2.
*
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = list_asc
listobject = list_obj
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

WITH FREE SELECTIONS (link to ABAP doc - Variant 5) has an effect only if the executable program has a logical database (defined in the attributes of the program).

It has no effect because RFVSOLD2 is NOT built over a logical database.

Consequently, the only chance you have is that the developer has designed his program so that to allow the transmission of free selections. And you're lucky. You can do it this way:

DATA(p_rdfi) = VALUE rsdsfields_t( ( tablename = 'VDBEPP' fieldname = 'SKOART' ) ).
DATA(p_rsdt) = VALUE rsdstabs_t( ( prim_tab = 'VDARL' ) ( prim_tab = 'VDBEPP' ) ).

SUBMIT rfvsold2
  WITH SELECTION-TABLE lt_seltab
*  WITH FREE SELECTIONS texpr
  WITH p_expr = texpr  " Free selections (the ones you have already defined)
  WITH p_ctfd = 1      " Count Fields
  WITH p_rdfi = p_rdfi " Fields with selections
  WITH p_rsdt = p_rsdt " Tables for selections
  EXPORTING LIST TO MEMORY
  AND RETURN.

NB: I just tested it.

5 REPLIES 5

Sandra_Rossi
Active Contributor
0 Kudos

Please use the button CODE to post code (below complete code formatted + DATA so that the program compiles)

DATA: ls_fields TYPE rsdsexpr,
      ls_texpr  TYPE rsds_expr,
      texpr     TYPE rsds_texpr,
      ls_seltab TYPE rsparams,
      lt_seltab TYPE TABLE OF rsparams.

ls_fields-arity = 0.
ls_fields-fieldname = 'SKOART'.
ls_fields-option = 'EQ'.
ls_fields-low = '1105'.
APPEND ls_fields to ls_texpr-expr_tab.
ls_texpr-tablename = 'VDBEPP'.
APPEND ls_texpr to texpr.

CLEAR ls_seltab.
ls_seltab-selname = 'SO_BUKRS'.
ls_seltab-kind = 'S'.
ls_seltab-sign = 'I'.
ls_seltab-option = 'EQ'.
ls_seltab-low = 'ABCD'.
APPEND ls_seltab TO lt_seltab.

CLEAR ls_seltab.
ls_seltab-selname = 'SO_RANL'.
ls_seltab-kind = 'S'.
ls_seltab-sign = 'I'.
ls_seltab-option = 'EQ'.
ls_seltab-low = '123456'.
APPEND ls_seltab TO lt_seltab.

CLEAR ls_seltab.
ls_seltab-selname = 'P_DDISPO'.
ls_seltab-kind = 'P'.
ls_seltab-low = '20201211'.
APPEND ls_seltab TO lt_seltab.

CLEAR ls_seltab.
ls_seltab-selname = 'P_KDATE'.
ls_seltab-kind = 'P'.
ls_seltab-low = sy-datum.
APPEND ls_seltab TO lt_seltab.


SUBMIT rfvsold2
  WITH SELECTION-TABLE lt_seltab
  WITH FREE SELECTIONS texpr
  EXPORTING LIST TO MEMORY 
  AND RETURN.


CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
  listobject = list_obj
  EXCEPTIONS
  not_found = 1
  OTHERS = 2.

CALL FUNCTION 'LIST_TO_ASCI'
  TABLES
  listasci = list_asc
  listobject = list_obj
  EXCEPTIONS
  empty_list = 1
  list_index_invalid = 2
  OTHERS = 3.

Sandra_Rossi
Active Contributor

WITH FREE SELECTIONS (link to ABAP doc - Variant 5) has an effect only if the executable program has a logical database (defined in the attributes of the program).

It has no effect because RFVSOLD2 is NOT built over a logical database.

Consequently, the only chance you have is that the developer has designed his program so that to allow the transmission of free selections. And you're lucky. You can do it this way:

DATA(p_rdfi) = VALUE rsdsfields_t( ( tablename = 'VDBEPP' fieldname = 'SKOART' ) ).
DATA(p_rsdt) = VALUE rsdstabs_t( ( prim_tab = 'VDARL' ) ( prim_tab = 'VDBEPP' ) ).

SUBMIT rfvsold2
  WITH SELECTION-TABLE lt_seltab
*  WITH FREE SELECTIONS texpr
  WITH p_expr = texpr  " Free selections (the ones you have already defined)
  WITH p_ctfd = 1      " Count Fields
  WITH p_rdfi = p_rdfi " Fields with selections
  WITH p_rsdt = p_rsdt " Tables for selections
  EXPORTING LIST TO MEMORY
  AND RETURN.

NB: I just tested it.

Abinathsiva
Active Contributor

Hi,

please try below code instead of list to Asci

  DATA: gr_table TYPE REF TO   data,
        gt_line  TYPE REF TO   data.

*define wa/it_final as required type table. 

  FIELD-SYMBOLS: <gt_table> TYPE STANDARD TABLE,
                 <gt_tline> TYPE any.

  cl_salv_bs_runtime_info=>set(
      EXPORTING display  = abap_false
                metadata = abap_false
                data     = abap_true ).

submit <program name> EXPORTING LIST TO MEMORY AND RETURNS. 

TRY.
      cl_salv_bs_runtime_info=>get_data_ref(
        IMPORTING r_data      = gr_table ).
      ASSIGN gr_table->* TO <gt_table>.
    CATCH cx_salv_bs_sc_runtime_info.
      MESSAGE: text-m01 TYPE 'S' DISPLAY LIKE 'E'.
      LEAVE LIST-PROCESSING.
  ENDTRY.

  cl_salv_bs_runtime_info=>clear_all( ).
  IF <gt_table>[] IS ASSIGNED.

  ENDIF.
CREATE DATA gt_line LIKE LINE OF <gt_table>.
  ASSIGN gt_line->* TO <gt_tline>.

LOOP AT <gt_table> INTO <gt_tline>.
MOVE-CORRESPONDING <gt_tline> TO wa_final.
APPEND wa_final TO it_final.
ENDLOOP.





0 Kudos

I'm not sure if the output is an ALV in all cases, but combining LIST_FROM_MEMORY and CL_SALV_BS_RUNTIME_INFO should return all possible kind of information.

former_member357303
Active Participant
0 Kudos

Hi,

does that refer to FNM1 / report RFVSOLD2 ?

That option has been added to standard with note 2393134.

Kind regards,

Michael