Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Where Condition dynamically?

Former Member
0 Likes
1,001

hi,

How to pass where condition values Dynamically

7 REPLIES 7
Read only

former_member225134
Participant
0 Likes
929

Hi,

use this function module RH_DYNAMIC_WHERE_BUILD

Read only

former_member194739
Active Participant
0 Likes
929

Dear Naresh,

see the link: http://scn.sap.com/thread/1895732

Regards,

Abbas.

Read only

Former Member
0 Likes
929

i write like this:

IF NOT vbeln IS INITIAL.

     APPEND 'a~vbeln = vbeln' TO l_where.

   ENDIF.

   IF NOT erdat IS INITIAL.

     IF NOT l_where[] IS INITIAL.

       APPEND ' AND ' TO l_where.

     ENDIF.

     APPEND 'a~erdat GE ERDAT' TO l_where.

   ENDIF.

   IF NOT auart IS INITIAL.

     IF NOT l_where[] IS INITIAL.

       APPEND ' AND ' TO l_where.

     ENDIF.

     APPEND 'a~AUART = AUART' TO l_where.

   ENDIF.

  IF NOT kunnr IS INITIAL.

     IF NOT l_where[] IS INITIAL.

       APPEND ' AND ' TO l_where.

     ENDIF.

     APPEND 'A~KUNNR = KUNNR' TO l_where.

   ENDIF.

   IF NOT werks IS INITIAL.

     IF NOT l_where[] IS INITIAL.

       APPEND ' AND ' TO l_where.

     ENDIF.

     APPEND 'B~WERKS = WERKS' TO l_where.

   ENDIF.

   IF NOT matnr IS INITIAL.

     IF NOT l_where[] IS INITIAL.

       APPEND ' AND ' TO l_where.

     ENDIF.

     APPEND 'B~MATNR = MATNR' TO l_where.

   ENDIF.

   IF NOT l_where[] IS INITIAL.

     APPEND ' AND ' TO l_where.

   ENDIF.

   APPEND 'C~GBSTA NE ''C''' TO l_where.

*  IF NOT werks  IS INITIAL.

   SELECT  a~kunnr

           a~audat

           a~auart

           b~vbeln

           b~posnr

           b~matnr

           b~kwmeng

           b~werks

           c~gbsta

           FROM vbak AS a INNER JOIN vbap AS b

           ON a~vbeln = b~vbeln

           INNER JOIN vbup AS c

           ON b~vbeln = c~vbeln

           AND b~posnr = c~posnr

            INTO TABLE t_vbak1

      WHERE (l_where).


but we are facing Performance issue.

please give explain detains to reduce performance.


thanks in advance  .

Read only

0 Likes
929

Make vbeln mandatory.

Read only

0 Likes
929

some times VBELN is initial that time we are not getting any data

Read only

former_member228804
Participant
0 Likes
929

What exactly is your requirement sir? Just one sentence doesn't suffice to make people understand the requirement.

Read only

0 Likes
929

see my second post sir...