Application Development and Automation 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: 
Read only

Submit with Free selection

mrahhaoui
Participant
0 Likes
3,874

HI Guru's,

I try to execute a submit with free selection but when the report is created, it doesn't take the values that I pass in the free selection.

Anybody could me help please?

Regards,

Mohamed.

** Debit Type
  IF NOT p_beltp IS INITIAL.
    wa_trange_line-tablename              = 'COVP'.
    wa_trange_frange_t_line-fieldname     = 'BEKNZ'.
    wa_trange_frange_t_selopt_t_li-sign   = 'I'.
    wa_trange_frange_t_selopt_t_li-option = 'EQ'.
    wa_trange_frange_t_selopt_t_li-low    = p_beltp.
    APPEND wa_trange_frange_t_selopt_t_li
    TO wa_trange_frange_t_line-selopt_t.

    APPEND wa_trange_frange_t_line TO wa_trange_line-frange_t.
    APPEND wa_trange_line TO i_trange.
  ENDIF.

  CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
    EXPORTING
      field_ranges = i_trange
    IMPORTING
      expressions  = i_texpr.

CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_WHERE'
  EXPORTING
    field_ranges        = i_trange
 IMPORTING
   WHERE_CLAUSES       =  i_tsel
          .
  IF NOT p_beltp IS INITIAL.
    li_tname-low    = 'COVP'.
    li_tname-high   = 'BEKNZ'.
    APPEND li_tname.
    MOVE p_beltp TO li_value-low.
    APPEND li_value.
  ENDIF.
    SUBMIT rkaep000
      WITH p_tcode = 'KSB1'
      WITH FREE SELECTIONS i_texpr
      WITH SELECTION-TABLE i_tab
      WITH kostl    IN li_kostl
      WITH g_tname  IN li_tname
      WITH r_budat  IN  li_budat
      WITH r_perio  IN  li_perio
      WITH gjahr    IN  li_gjahr
      WITH g_values IN li_value
         TO SAP-SPOOL
         SPOOL PARAMETERS wa_print_parameters
         ARCHIVE PARAMETERS wa_archi_parameters
         WITHOUT SPOOL DYNPRO
         VIA JOB w_name NUMBER w_number
       AND RETURN.

Edited by: rahhaoui mohamed on Sep 9, 2009 4:52 PM

9 REPLIES 9
Read only

Former Member
0 Likes
1,968

Hi

Try this:

TYPE-POOLS RSDS.

DATA: I_TEXPR   TYPE RSDS_TEXPR,
      W_EXPR  LIKE RSDSEXPR,
      W_TEXPR TYPE RSDS_EXPR.

IF NOT P_BELTP IS INITIAL.
  W_EXPR-FIELDNAME = 'BEKNZ'.
  W_EXPR-OPTION    = 'EQ'.
  W_EXPR-LOW       = P_BELTP.

  W_TEXPR-TABLENAME = 'COVP'.
  APPEND W_EXPR TO W_TEXPR-EXPR_TAB.
  APPEND W_TEXPR TO I_TEXPR.
ENDIF.

.
IF NOT P_BELTP IS INITIAL.
  LI_TNAME-LOW    = 'COVP'.
  LI_TNAME-HIGH   = 'BEKNZ'.
  APPEND LI_TNAME.
  MOVE P_BELTP TO LI_VALUE-LOW.
  APPEND LI_VALUE.
ENDIF.
SUBMIT RKAEP000
  WITH P_TCODE = 'KSB1'
  WITH FREE SELECTIONS I_TEXPR
  WITH SELECTION-TABLE I_TAB
  WITH KOSTL    IN LI_KOSTL
  WITH G_TNAME  IN LI_TNAME
  WITH R_BUDAT  IN  LI_BUDAT
  WITH R_PERIO  IN  LI_PERIO
  WITH GJAHR    IN  LI_GJAHR
  WITH G_VALUES IN LI_VALUE
     TO SAP-SPOOL
     SPOOL PARAMETERS WA_PRINT_PARAMETERS
     ARCHIVE PARAMETERS WA_ARCHI_PARAMETERS
     WITHOUT SPOOL DYNPRO
     VIA JOB W_NAME NUMBER W_NUMBER AND RETURN.

Max

Read only

0 Likes
1,968

Hi Max,

Thanks for your response. I did what you told me but it is the same thing. It put me now on the pdf document the Debit/CR indicator int the header with the value that I pass it via the parameter. But in the results it takes all, I mean it shows me all values. it should display only the debit.

Would you have a solution?

Regards,

Mohamed.

Read only

0 Likes
1,968

Hi

I think the problem can be the report RKAEP000 don't use a db logic, I believe your (and mine) solution works from free selection managed in a logical database.

So u should try to set the value for free-selection by the fm.

Max

Read only

0 Likes
1,968

This is what I do also by the FM 'FREE_SELECTIONS_RANGE_2_EX'.

Read only

0 Likes
1,968

Hi

That's ok, but u shouldn't move them in the selection-screen.

In the beginning of event AT SELECTION-SCREEN. of report RKAEP000 u should see what the report done to set the free selection:

CASE sscrfields-ucomm.
    WHEN 'UCFS'.
* free selection
      PERFORM free_selection USING    gd-prim_dbtab
                                      gd-sek_dbtab
                                      gs_sel_view
                             CHANGING gd-fields_count
                                      gt_fields
                                      gt_free_selection
                                      gt_free_sel_ranges
                                      gt_expressions.
      PERFORM free_selection_mem USING  gs_display_variant
                                        'E'
                                 CHANGING gt_fields
                                          gt_free_selection
                                          gt_free_sel_ranges
                                          gt_expressions.

Probably u need to do the same

Max

Read only

0 Likes
1,968

YEs, I already checked the code but in a moment it uses a FM 'K_LINE_ITEMS_SELECT_AND_LIST' but not a submit.

Regarding free_selection and free_selection_mem, do i need to exactly the same?

Regards,

Mohamed.

Read only

0 Likes
1,968

Hi

I think so, u can try it

Max

Read only

0 Likes
1,968

But one question Max, I checked the code and after he has used the 2 performs he passes the tables to a FM and not a submit.

What should I have to do?

Regards,

Mohamed.

Read only

0 Likes
1,968

Hi

I check the selection-screen of the report, and there's an hide section to free selection:

* including free selections on selection screen
 SELECTION-SCREEN BEGIN OF BLOCK free_sel.
* g_tname-low: tablename --- g_tname-high: fieldname
 SELECT-OPTIONS g_tname FOR rsdstabs-prim_tab NO-DISPLAY.
* g_values[x]: select conditions for g_tname[x]
 SELECT-OPTIONS g_values FOR rsdsselopt-low NO-DISPLAY.
* gr_wrttp: select conditions for wrttp
 SELECT-OPTIONS gr_wrttp FOR coep-wrttp NO-DISPLAY.
 PARAMETERS: p_usegrd LIKE kaep_sett-usegrd DEFAULT 'X' NO-DISPLAY.
 SELECTION-SCREEN END OF BLOCK free_sel.

These parameter are managed at the beginning of START-OF-SELECTION:

* if there are free selections in batch mode fill free selection tables
  IF NOT g_tname[] IS INITIAL.
    PERFORM sel_screen_to_free_sel CHANGING gt_free_sel_ranges
                                            gt_expressions
                                            gt_free_selection.
  ENDIF.

Probably u need to transfer the free-selection here.

RANGES: G_TNAME  FOR RSDSTABS-PRIM_TAB,
        G_VALUES FOR RSDSSELOPT-LOW.

IF NOT P_BELTP IS INITIAL.
  G_TNAME(3)  = 'IBT'.
  G_TNAME-LOW = G_TNAME-HIGH = 'COVP'.
  APPEND G_TNAME.

  G_VALUES(3) = 'IEQ'.
  G_VALUES-LOW = P_BELTP.
  APPEND G_VALUES.
ENDIF.

SUBMIT RKAEP000
        WITH G_TNAME IN G_TNAME
        WITH G_VALUES IN G_VALUES
        WITH P_TCODE = 'KSB1' AND RETURN.

Max