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 report via function module

0 Likes
3,062

Dear Experts,
In one of Z* programs on double click event on some particular field of ALV grid the transaction LX02 is being launched via function module call:

CALL FUNCTION 'Z_MZ_CALL_LX02' STARTING NEW TASK 'LX02'
          EXPORTING
            iv_lgnum = lv_lgnum
            iv_matnr = <fs_outbound>-matnr
            iv_vlpla = <fs_outbound>-vlpla.

The source code for function module looks like this:

TYPE-POOLS : rsds.

  DATA :  it_seltab TYPE TABLE OF rsparams,
          ls_seltab  LIKE LINE OF it_seltab,
          wa_selopt TYPE rsdsselopt.
  DATA :  it_frange TYPE rsds_frange_t,
          wa_frange TYPE rsds_frange.
  DATA :  it_trange TYPE rsds_trange,
          wa_trange TYPE rsds_range.
  DATA :  it_texpr TYPE rsds_texpr,
          wa_texpr TYPE rsds_expr.


  wa_trange-tablename = 'LQUA'.
  wa_frange-fieldname = 'MATNR'.
  wa_selopt-sign      = 'I'.
  wa_selopt-option    = 'EQ'.
  wa_selopt-low       = iv_matnr.
  wa_selopt-high      = iv_matnr.


  APPEND wa_selopt TO wa_frange-selopt_t.
  APPEND wa_frange TO wa_trange-frange_t.
  CLEAR wa_selopt.
  CLEAR wa_frange.


  wa_frange-fieldname = 'LGNUM'.
  wa_selopt-sign    = 'I'.
  wa_selopt-option  = 'EQ'.
  wa_selopt-low     = iv_lgnum.
  wa_selopt-high    = iv_lgnum.
  APPEND wa_selopt TO wa_frange-selopt_t.
  APPEND wa_frange TO wa_trange-frange_t.
  CLEAR wa_selopt.
  CLEAR wa_frange.


  ls_seltab-selname = 'S1_LGNUM'.          " Name of parameter on submitted program
  ls_seltab-kind    = 'S'.
  ls_seltab-sign    = 'I'.
  ls_seltab-option  = 'EQ'.
  ls_seltab-low     = iv_lgnum.
  ls_seltab-high    = iv_lgnum.
  APPEND ls_seltab TO it_seltab.
  CLEAR ls_seltab.




  IF iv_vlpla IS NOT INITIAL.


    wa_frange-fieldname = 'LGPLA'.
    wa_selopt-sign = 'I'.
    wa_selopt-option    = 'EQ'.
    wa_selopt-low       = iv_vlpla.
    wa_selopt-high      = iv_vlpla.
    APPEND wa_selopt TO wa_frange-selopt_t.
    APPEND wa_frange TO wa_trange-frange_t.
    CLEAR wa_selopt.
    CLEAR wa_frange.








    ls_seltab-selname = 'S1_LGPLA'.
    ls_seltab-kind = 'S'.
    ls_seltab-sign = 'I'.
    ls_seltab-option = 'EQ'.
    ls_seltab-low = iv_vlpla.
    ls_seltab-high = iv_vlpla.
    APPEND ls_seltab TO it_seltab.
    CLEAR ls_seltab.
  ENDIF.


  APPEND wa_trange TO it_trange.


  CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
    EXPORTING
      field_ranges = it_trange
    IMPORTING
      expressions  = it_texpr.


  SUBMIT rls10020
    WITH SELECTION-TABLE it_seltab
    WITH FREE SELECTIONS it_texpr
    AND RETURN .


ENDFUNCTION.


The problem is that everything works fine when LX02 is being called first time. However, if I return back to ALV-grid and double click the field of the same column but different row, the field of LX02 kinda 'remember' the previous input. Is there a way to submit a report and clear everything in the buffer memory, so that each double click would call 'refreshed' LX02.


1 ACCEPTED SOLUTION
Read only

TMSingh_SAP
Participant
0 Likes
1,815

Hi

you are almost there...just need to put extra effort to debug more and find the variable holding these values which has to be cleared. check if below helps u...

unassign the field symbol which is used to populate it_seltab for calling LX02

            iv_lgnum = lv_lgnum
            iv_matnr =<fs_outbound>-matnr
            iv_vlpla =<fs_outbound>-vlpla.
3 REPLIES 3
Read only

TMSingh_SAP
Participant
0 Likes
1,816

Hi

you are almost there...just need to put extra effort to debug more and find the variable holding these values which has to be cleared. check if below helps u...

unassign the field symbol which is used to populate it_seltab for calling LX02

            iv_lgnum = lv_lgnum
            iv_matnr =<fs_outbound>-matnr
            iv_vlpla =<fs_outbound>-vlpla.
Read only

0 Likes
1,815

Thank you for valuable guidance.

Read only

srikanthnalluri
Active Participant
0 Likes
1,815

You should look in the caller program, not in the FM. Check the double click event.