SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Как передать параметры в динамический селекционный экран?



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
alex_nil
Участник
Участник



Joined: 26 Sep 2007
Posts: 25

PostPosted: Sun Oct 28, 2007 5:48 pm    Post subject: Как передать параметры в динамический селекционный экран? Reply with quote

Здравствуйте!
Мне необходимо запустить из программы транзакцию FBL5N с пропуском селекционного экрана. Проблема в том, что транзакция имеет динамический селекционный экран и я не знаю, как его заполнить.
Back to top
View user's profile Send private message
Lord
Профессионал
Профессионал



Joined: 10 Sep 2007
Posts: 168

PostPosted: Sun Oct 28, 2007 6:17 pm    Post subject: Reply with quote

Используйте следующую конструкцию:

From Submit help wrote:

... WITH SELECTION-TABLE seltab

Effect
seltab is an internal table with the structure RSPARAMS.
This variant allows you to set the names and contents of the parameters and selection options dynamically at runtime.
You can use the function module RS_REFRESH_FROM_SELECTOPTIONS to read the contents of the parameters and selection options of the current program into an internal table seltab with the structure RSPARAMS. By using SUBMIT ... WITH SELECTION-TABLE seltab, you can then pass these values on directly.


Несколько примеров заполнения таблицы:

Code:


*Program accessed
REPORT report1.

DATA text(10) TYPE c.

SELECTION-SCREEN BEGIN OF SCREEN 1100.
SELECT-OPTIONS: selcrit1 FOR text,
selcrit2 FOR text.
SELECTION-SCREEN END OF SCREEN 1100.
...

*Calling program
REPORT report2.

DATA: text(10) TYPE c,
rspar_tab TYPE TABLE OF rsparams,
rspar_line LIKE LINE OF rspar_tab,
range_tab LIKE RANGE OF text,
range_line LIKE LINE OF range_tab.

...

rspar_line-selname = 'SELCRIT1'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = 'ABAP'.
APPEND rspar_line TO rspar_tab.

range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'H'.
APPEND range_line TO range_tab.

range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'K'.
APPEND range_line TO range_tab.

SUBMIT report1 USING SELECTION-SCREEN '1100'
WITH SELECTION-TABLE rspar_tab
WITH selcrit2 BETWEEN 'H' AND 'K'
WITH selcrit2 IN range_tab
AND RETURN.

Пример 2
Code:
REPORT  zztest_1.
 
DATA :   stable   LIKE   rsparams OCCURS 0 WITH HEADER LINE,
         it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
 
START-OF-SELECTION.
 
  SELECT * FROM mara INTO TABLE it_mara UP TO 10 ROWS.
  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
      curr_report     = 'ZZTEST_2'
    TABLES
      selection_table = stable
    EXCEPTIONS
      not_found       = 1
      no_report       = 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.
 
  BREAK-POINT.
 
*Read the selection table.
 
  READ TABLE stable WITH KEY selname = 'MATNR'.
  IF sy-subrc = 0.
 
*Then loop the output table and appen the values.
    LOOP AT it_mara.  "Specify some condition if possible to restrict the values.
 
      stable-sign   = 'I'.
      stable-option = 'EQ'.
      stable-low    =  it_mara-matnr.
      <b>APPEND stable.</b>
    ENDLOOP.
  ENDIF.
 
  BREAK-POINT.
 
*Then submit the Program
 
  SUBMIT zztest_2
  WITH SELECTION-TABLE stable
  AND RETURN .
 

Пример 3
Code:
REPORT report2.

TYPE-POOLS rsds.

DATA: trange TYPE rsds_trange,
trange_line
LIKE LINE OF trange,
trange_frange_t_line
LIKE LINE OF trange_line-frange_t,
trange_frange_t_selopt_t_line
LIKE LINE OF trange_frange_t_line-selopt_t,
texpr TYPE rsds_texpr.

trange_line-tablename = 'SPFLI'.
trange_frange_t_line-fieldname = 'CONNID'.
trange_frange_t_selopt_t_line-sign = 'I'.
trange_frange_t_selopt_t_line-option = 'BT'.
trange_frange_t_selopt_t_line-low = '0200'.
trange_frange_t_selopt_t_line-high = '0800'.
APPEND trange_frange_t_selopt_t_line
TO trange_frange_t_line-selopt_t.
trange_frange_t_selopt_t_line-sign = 'I'.
trange_frange_t_selopt_t_line-option = 'NE'.
trange_frange_t_selopt_t_line-low = '0400'.
APPEND trange_frange_t_selopt_t_line
TO trange_frange_t_line-selopt_t.
APPEND trange_frange_t_line TO trange_line-frange_t.
APPEND trange_line TO trange.

CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
EXPORTING
field_ranges = trange
IMPORTING
expressions = texpr.

SUBMIT report1 VIA SELECTION-SCREEN
WITH FREE SELECTIONS texpr.

Другие примеры работы с экранными функциями
http://www.sapnet.ru/viewtopic.php?t=207

2) Второй способ, через создание Варианта селекционного экрана.
Для динамического создания варианта см. группу функций SVAR.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.