Skip to Content
author's profile photo Former Member
Former Member

How to read an interal table with dynamic conditions

Dear all,

I have an internal table IN_TAB and I want to read a record of the table with dynamic condition as below.

a) IN_TAB structure : | ColA | Col B | Col C | Col D |

b) Requirement: there are four condtions, and reading data from IN_TAB (not use loop) based on these conditions. If one condition is empty, it'll be ommited.

Ex: | ColA | Col B | Col C | ColD |

-


x1

b

c

d

x1

x2

x3

x1

x2

x3

x4

y1

y2

y3

y4

-


The conditons consist of ColA = ' x1' , ColB = 'x2' , ColC = '', ColD = ''

The result will be:

x1

x2

x3

x1

x2

x3

x4

Could you please help to solve this problem.

Thanks and regards,

Nguyen Huy.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2011 at 09:07 AM

    How to read an interal table with dynamic conditions

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Nabheet Madan

      Hi Nabheet,

      Thanks for your solution, It solved my problem. I also suggest the another way to obtain this.

      - The internal table have to declare with header line, note that the internal table mustn't has x type in the structure.

      - Assign all conditions into header line wether condtion is empty or not.

      - Use statement READ TABLE IN_TAB.

      Ex:

      DATA: BEGIN OF RT OCCURS 0,

      MATNR(18) TYPE C,

      ERNAM(12) TYPE C,

      BISMT(18) TYPE C,

      LAEDA TYPE MARA-LAEDA,

      END OF RT .

      SELECT

      MATNR

      ERNAM

      BISMT

      LAEDA

      UP TO 10 ROWS

      INTO CORRESPONDING FIELDS OF TABLE RT

      FROM MARA.

      RT-MATNR = '7F01113'.

      RT-LAEDA = '20111005'.

      READ TABLE RT.

      @ponvignesh : thanks for your reply, I thinks that the Nabheet's solution is the good way.

      Kindly regards,

      Nguyen Huy

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.