Skip to Content
-1

BW Transformations Start Routine -Reading Internal Table-Multiple condition

Aug 31, 2017 at 11:07 AM

442

avatar image

Hi Abap/BW Experts

I have following requirement and written code, but I am getting syntax while reading from Internal table with multiple conditions. Could any one correct me where I did mistake.

Requirement : I want to Flag if the Employee Trip date(0TV_DEPDATE) lies between or Equal to Employee Leave start date and Leave End date.

DSO1 that stores Employee Leave information (Table 1)

DSO2 that stores Employee expenses claimed with Trip start date

Syntax Error at below bold :

READ TABLE lt_empleave into ls_empleave WITH KEY

/BIC/ZEMPLOYEE = <SOURCE_FIELDS>-EMPLOYEE.

/BIC/Z_IBEGDA <= TV_DEPDATE.
/BIC/Z_IENDDA >= TV_DEPDATE


TYPES:BEGIN OF t_empleave,
  /BIC/ZEMPLOYEE TYPE /BIC/OIZEMPLOYEE,
  /BIC/Z_IBEGDA TYPE /BIC/OIZ_IBEGDA
  /BIC/Z_IENDDA TYPE /BIC/OIZ_IENDDA,
END OF t_empleave.

DATA : lt_empleave TYPE STANDARD TABLE OF t_empleave.
DATA : ls_empleave type t_empleave.

*** To read only 3Years data
call function 'RP_CALC_DATE_IN_INTERVAL'
  exporting
    date      = sy-datum
    days      = 0
    months    = 0
    signum    = '-'
    years     = 3
  importing
    calc_date = l_date.

*** Selecting data from DSO1 ( Employee Leave Dates)

SELECT /BIC/ZEMPLOYEE /BIC/Z_IBEGDA /BIC/Z_IENDDA FROM
/BIC/ADS01
       INTO TABLE lt_empleave
       FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
        /BIC/ZEMPLOYEE EQ SOURCE_PACKAGE-EMPLOYEE
  AND /BIC/Z_IBEGDA >= l_date.

 SORT lt_empleave by /BIC/ZEMPLOYEE ASCENDING /BIC/Z_IBEGDA  DESCENDING.
  DELETE ADJACENT DUPLICATES FROM lt_empleave COMPARING /BIC/ZEMPLOYEE
  /BIC/Z_IBEGDA.

LOOP at SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
CLEAR ls_empleave.

 READ TABLE lt_empleave into ls_empleave WITH KEY
      /BIC/ZEMPLOYEE = <SOURCE_FIELDS>-EMPLOYEE.
      /BIC/Z_IBEGDA <= TV_DEPDATE.
      /BIC/Z_IENDDA >= TV_DEPDATE

          IF SY-SUBRC = 0.
   
      <SOURCE_FIELDS>-/BIC/Z_IFLAG = 'X'.

      ENDIF.
      ENDLOOP.



Best Regards
Sree
capture.png (210.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Frank Albaum
Sep 01, 2017 at 01:18 PM
1

Hi Shreekanth,

the READ TABLE statement is wrong. You can not use comparison conditions with READ TABLE. Only the EQUAL condition is possible. As alternative you can use a LOOP statement and use an EXIT statement if you have found the correct data set.

Regards

Frank Albaum

Share
10 |10000 characters needed characters left characters exceeded
Ashu Yadav Sep 01, 2017 at 12:20 PM
0

Hi Shreekanth

Please try this

DATA: lt_empleave TYPE STANDARD TABLE OF t_empleave.
DATA: ls_empleave LIKE LINE OF lt_empleave.
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Ashu Yadav,

Thanks for your reply, It is not working. I am getting below error.

Regards

Sree

capture-1.png (67.1 kB)
0

Starting from Line 297 to 302

IF ls_empleave-/BIC/Z_IBEGDA <= TV_DEPDATE AND

ls_empleave-/BIC/Z_IENDDA >= TV_DEPDATE.

<SOURCE_FIELDS>-/BIC/Z_IFLAG = 'X'.

ENDIF.

0