Technology Blog Posts by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
singhsmi
Product and Topic Expert
Product and Topic Expert
782
 

Due to a particular requirement if a Basis layer decides to switch to a new table(Example: swu_wlscan2) instead of an old table(Example: swu_wlscan ) and thereby changing the value range of some of its Parameters(Example: Job Suffix), the application layer functionalities that use this table needs to adapt. The challenge here is that in application layer you are not sure that in a particular environment which basis release and support package is applicable and which of the 2 tables is active. In this case, if you have a program(Example/SAPSRM/OFFLINEAPPROVALSEND) in which there is Parameters declared for selection-screen and this Parameters type is that of the changed parameter in the Basis release, then there is problem statement of how to dynamically have this parameter type determined depending on the availability of the old or new table in Basis release. So that the application layer does not have to create a new program altogether to cater to the table changes.

You can solve the issue by

  1.     First replacing the static type declaration of Parameters to dynamic

Example:

     PARAMETERS: p_jobsuf LIKE SWU_WLSCAN-CURR_NUMB.

      Replace above with below statement

      PARAMETERS: p_jobsuf LIKE (lv_type). 

2.     Find the type of Dynamic type (Example:lv_type) in Initialization event block by checking the existence of the table.

INITIALIZATION.

CALL FUNCTION 'DD_EXIST_TABLE'
EXPORTING
  tabname      = 'SWU_WLSCAN2'
  status       = 'A'
IMPORTING
  subrc        = lv_subrc
EXCEPTIONS
  wrong_status = 1
  OTHERS       = 2.
IF lv_subrc <> 0.
  lv_type = 'SWU_WLSCAN-CURR_NUMB'.
ELSE.
  lv_type = 'SWU_WLSCAN2-CURR_NUMB'.
ENDIF.