*&---------------------------------------------------------------------*
*& "Selection Screen
*&---------------------------------------------------------------------*
PARAMETERS: p_var TYPE variant.
*&---------------------------------------------------------------------*
*&"Local Class Declaration
*&---------------------------------------------------------------------*
"--> DEFINITION
CLASS lcl_variant DEFINITION FINAL.
PUBLIC SECTION.
METHODS: variant_list.
ENDCLASS.
"--IMPLEMENTATION
CLASS lcl_variant IMPLEMENTATION.
METHOD variant_list.
"Data Declarations
DATA: ls_search_help TYPE shlp_descr_t,
lt_interface TYPE STANDARD TABLE OF ddshiface,
lt_return TYPE STANDARD TABLE OF ddshretval,
lv_subrc TYPE sysubrc.
"Provide the standard search help details
ls_search_help = VALUE #( shlpname = 'SKK_BSTM_VARID' shlptype = 'SH' ).
CALL FUNCTION 'DD_SHLP_GET_DIALOG_INFO'
CHANGING
shlp = ls_search_help.
"Pass the relevent parameters of the search help 'SKK_BSTM_VARID'
lt_interface = VALUE #(
"Row - 1: Program Information
( shlpfield = 'REPORT' value = 'RFEBKA00' )
"Row-2: Field(VARIANT), you want to read from table VARID
( shlpfield = 'VARIANT' f4field = 'X' valtabname = 'VARID'
valfield = 'VARIANT' dispfield = ' ' )
).
ls_search_help-interface = lt_interface.
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
shlp = ls_search_help
IMPORTING
rc = lv_subrc
TABLES
return_values = lt_return.
"Pass the selected value to the Selection Screen parameter.
IF line_exists( lt_return[ 1 ] ) AND lv_subrc IS INITIAL.
p_var = lt_return[ 1 ]-fieldval.
ENDIF.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& "Event - INITIALIZATION.
*&---------------------------------------------------------------------*
INITIALIZATION.
DATA(go_variant) = NEW lcl_variant( ).
*&---------------------------------------------------------------------*
*& "Event - AT SELECTION-SCREEN ON VALUE-REQUEST
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
*&------Approach - 1 --------------------------------------------------*
*&------Gives you the whole list in one shot---------------------------*
IF go_variant IS BOUND.
go_variant->variant_list( ).
ENDIF.
*&------Approach - 2 --------------------------------------------------*
*&------Gives you the whole list in two step, if pop_up = 'X' ---------*
CALL FUNCTION 'RS_VARIANT_CATALOG'
EXPORTING
report = 'RFEBKA00'
new_title = 'Variant List'
pop_up = abap_true
IMPORTING
sel_variant = p_var
EXCEPTIONS
OTHERS = 0.
"Relevent Exception Handling below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 |