Showing posts with label Select-options. Show all posts
Showing posts with label Select-options. Show all posts

Friday, December 7, 2012

Use Secondary Index in program to fetch data


Issue : To make the program to pick the data from the database using the secondary index
Sol :
%_HINTS ORACLE 'INDEX("table" "table name~index name")'.

Thursday, July 5, 2012

Dynamic change of selection screens using push button in single program


Dynamic selection screen can be created using push buttons declared in single program
1. Declare parameters with modif id and declare push buttons.
2.In initialization get the user command stored in the memory location using import function and update the selection screen accordingly(disabling some parameters)
3. Selection screen gets displayed, whenever other button is clicked then event AT SELECTION-SCREEN gets triggered, if the sy-ucomm is ‘FC01 or FC02’ export it to the memory location else do screen validations.
4. In the event AT SELECTION-SCREEN OUTPUT change the screen by using LOOP AT SCREEN and MODIF ID



For test program find the attachment attachment

Tuesday, July 3, 2012

Dynamic selection screen using PF status between two programs


Dynamic selection screen using PF status between two programs
1. Changing initial screen options can be done as follows
2. PF status (MENU from SE41 Menu painter) need to be created.
3. In the event AT SELECTION-SCREEN OUTPUT following need to used

AT SELECTION-SCREEN OUTPUT.
*Use a custom PF-STATUS instead of the standard one
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'.
EXPORTING
p_status = 'EDIT_TEXT'
TABLES
p_exclude = exclitab.

DATA: exclitab TYPE TABLE OF sy-ucomm.


4. While creating the push button following need to be taken care, ie Function type need to be ‘E’—Exit command

5. Later in the event AT SELECTION-SCREEN ON EXIT-COMMAND, depending on the command declared in the menu painter get the selection screen inputs if required and submit it to the program.

AT SELECTION-SCREEN ON EXIT-COMMAND.
IF sy-ucomm = <command declared in menu painter> 
PERFORM submit_program.
ENDIF.

FORM submit_program .
DATA: sel_table TYPE TABLE OF rsparams.
CLEAR sel_table.
CLEAR p_detlay.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = sel_table.

SUBMIT < to_which_program this need to be submitted
VIA SELECTION-SCREEN WITH SELECTION-TABLE sel_table
AND RETURN.
ENDFORM. " submit_program

Read SELECT-OPTIONS using DYNP_VALUES_READ


In general we use DYNP_VALUES_READ to read data in the screen. It will be very simple to get data from the screen when the required field is declared from parameter.
1. Declaration: Declare data for input and for output DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE,
return_tab TYPE TABLE OF ddshretval WITH HEADER LINE.
2.Pass the required value to dynfields dynfields-fieldname = 'P_BUKRS'.
APPEND dynfields.

3.Get the data from selection screen CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
TABLES
dynpfields = dynfields

4.Get the data from to the fields from selection to the fields READ TABLE dynfields WITH KEY fieldname = 'P_BUKRS'.
lv_bukrs = dynfields-fieldvalue.

5.Get the data from the required table to display SELECT bukrs branch name
FROM j_1bbranch
INTO CORRESPONDING FIELDS OF TABLE it_j_1bbranch
WHERE bukrs = lv_bukrs.

6.Display the using FM F4IF_INT_TABLE_VALUE_REQUEST CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BRANCH'
dynprofield = 'S_BRANCH-LOW'
value_org = 'S'
TABLES
value_tab = it_j_1bbranch
return_tab = return_tab.

7.Pass the data to output field READ TABLE return_tab WITH KEY fieldname = 'BRANCH'.
IF lv_shelp_low = 'X'.
s_branch-low = return_tab-fieldval.
ENDIF.


But when to get the data from SELECT-OPTIONS will be challenge, in order to overcome this we need to follow the below procedure in the attached document. Attachement for select options

Saturday, February 26, 2011

To restrict the select-options popup message


TYPE-POOLS sscr.

DATA: restrict     TYPE sscr_restrict,
      opt_list     TYPE sscr_opt_list,
      associate    TYPE sscr_ass.

CLEAR :opt_list,associate,restrict.

* Set the complex
  MOVE 'EQ'  TO opt_list-name.
  opt_list-options-eq = 'X'.
  APPEND opt_list TO restrict-opt_list_tab.
  associate-kind    = 'S'.
  associate-name    = '<select-option name>'.
  associate-sg_main = 'I'.
  associate-sg_addy = ' '.
  associate-op_main = 'EQ'.
  associate-op_addy = 'EQ'.
  APPEND associate TO restrict-ass_tab.

  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      program                      = sy-repid
      restriction                  = restrict
*   DB                           = ' '
   EXCEPTIONS
     too_late                     = 1
     repeated                     = 2
     selopt_without_options       = 3
     selopt_without_signs         = 4
     invalid_sign                 = 5
     empty_option_list            = 6
     invalid_kind                 = 7
     repeated_kind_a              = 8
     OTHERS                       = 9


Note: It should be declared in the PBO in Module pool program.

Wednesday, February 9, 2011

To get selection parameter

use FM: RS_REFRESH_FROM_SELECTOPTIONS

ex:
 CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
   EXPORTING
     curr_report     = 'ZTEST_CS15'
   TABLES
     selection_table = it_seltab
   EXCEPTIONS
     not_found       = 1
     no_report       = 2
     OTHERS          = 3.