Application Development 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: 

Where Condition dynamically?

Former Member
0 Kudos

hi,

How to pass where condition values Dynamically

7 REPLIES 7

former_member225134
Participant
0 Kudos

Hi,

use this function module RH_DYNAMIC_WHERE_BUILD

former_member194739
Active Participant
0 Kudos

Dear Naresh,

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

Regards,

Abbas.

Former Member
0 Kudos

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  .

0 Kudos

Make vbeln mandatory.

0 Kudos

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

former_member228804
Participant
0 Kudos

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

0 Kudos

see my second post sir...