Retrieving Condition records using function modules

By Bhumika Mahawar, YASH Technologies

Many a times I have seen code with Selects on multiple tables to get the condition table for the given condition type. Here are a group of Function modules, which serves the same purpose with consistency.

The function modules are:

  • "SD_COND_T685_SELECT" - to fetch the access sequence for the given condition type.
  • "SD_T682I_SINGLE_READ" - to fetch the condition tables.

Below is a sample code for getting the condition tables for the given condition type.

Code

REPORT ZTEST_COND.
* Published at SAPTechnical.COM
DATA:
  gs_t685 type t685,
  gs_t682i type t682i,
  gt_t682i type standard table of t682i. " Condition tables
CONSTANTS:	
  gc_kappl TYPE kappl VALUE 'CS',        " Application
  gc_kvewe TYPE kvewe VALUE 'A'.         " Usage of the condition table 
** Get the access sequence for the given condition type
CALL FUNCTION 'SD_COND_T685_SELECT'
EXPORTING
  cts_kappl = gc_kappl
  cts_kschl = 'SAPZ'                     " Condition Type
  cts_kvewe = gc_kvewe
IMPORTING
  cts_t685 = gs_t685. 
**Get the access sequence for the given condition type
CALL FUNCTION 'SD_T682I_SINGLE_READ'
EXPORTING
  kvewe_i = gc_kvewe
  kappl_i = gc_kappl
  kozgf_i = gs_t685-kozgf                " Access sequence
TABLES
  t682i_tab_io = gt_t682i.
LOOP AT gt_t682i INTO gs_t682i.
   WRITE:/
        gs_t682i-kotabnr.                " Condition tables
ENDLOOP.
Note: The Condition table that we receive here is just a 3-digit number. To view the same table in SE11, concatenate this 3-digit number with the "Usage of the condition table". For example, in this case, if KOTABNR is 020 the corresponding table in SE11 is "A020".

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image