Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
mohit_dev
Contributor

Introduction


Recently, while working in one of the requirements to upload an Electronic Bank Statement through a custom program, I had to provision the selection of a variant(actually maintained in the Standard EBS upload Transaction "FF_5", Report "RFEBKA00") on the selection screen of the custom program, as below:


Press F4


 

Note:

  1. In order to achieve the requirement, you should know the Report/Program Name, whose variants you want to know, like in this case the program name is RFEBKA00.


Approach - 1

  1. We can use the standard search help SKK_BSTM_VARID to get the variant list.

  2. After that, we have to use standard function modules DD_SHLP_GET_DIALOG_INFO  and F4IF_START_VALUE_REQUEST, to prepare the result set.


Note: In this example we are using single row selecting option, but in case you require to have multiple select option like below, you can use Approach - 1, by filling the parameter MULTISEL  = 'X' of FM - F4IF_START_VALUE_REQUEST.


Approach - 2 - (Minimal Coding) - Suggested by georgislavov

  1. Use Function Module - RS_VARIANT_CATALOG.


Let's see how we can achieve this requirement.

Code


Selection Screen


*&---------------------------------------------------------------------*
*& "Selection Screen
*&---------------------------------------------------------------------*
PARAMETERS: p_var TYPE variant.

Local Class Declaration


*&---------------------------------------------------------------------*
*&"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.

Execution Events


*&---------------------------------------------------------------------*
*& "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.

Conclusion


In this way, we can provision the selection of a variant maintained in some other application on the selection screen of the custom program.

Note


Please excuse for the naming convention used; you can use as per the standards maintained in your project.

For any issues, improvements, additions or any other concerns, please feel free to contact me.

I look forward for your feedback and suggestions.

Keep learning!! Keep improving!!

 

 

15 Comments