Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Problem in my Select query

$
0
0

Hi Experts,

 

I need a clarification in my Select query.

 

Have created a custom search help and my requirement is I have Request ID, Last and First Name as my search parameters. I need to fetch the values from my Ztable on search with the above said search parameters, where its workflow status = 30.

 

   * Get Request ID
  lv_pattern = <ls_query_params>-request_id.
  IF lv_pattern CA '*'.
    REPLACE ALL OCCURRENCES OF '*' IN lv_pattern WITH '%'.
  ENDIF. " IF lv_pattern CA '*'
  IF lv_pattern IS INITIAL.
    lv_pattern = '%'.
  ENDIF. " IF lv_pattern IS INITIAL

** Get NACHN - Lastname
    lv_last_name = <ls_query_params>-nachn.
    IF lv_last_name CA '*'.
      REPLACE ALL OCCURRENCES OF '*' IN lv_last_name WITH '%'.
    ENDIF. " IF lv_pattern CA '*'
    IF lv_last_name IS INITIAL.
      lv_last_name = '%'.
    ENDIF. " IF lv_pattern IS INITIAL

** Get VORNA - First Name
    lv_first_name = <ls_query_params>-vorna.
    IF lv_first_name CA '*'.
      REPLACE ALL OCCURRENCES OF '*' IN lv_first_name WITH '%'.
    ENDIF. " IF lv_pattern CA '*'
    IF lv_first_name IS INITIAL.
      lv_first_name = '%'.
    ENDIF. " IF lv_pattern IS INITIAL

*Selecting the RequestID/Last and First Name values with workflow status as 30.
SELECT zzreq_id " Internal number for appropriation request
            nachn
           vorna
  INTO TABLE lt_select_list
  FROM ZTABLE

  WHERE ( zzreq_id LIKE lv_pattern ) and
                 ( nachn like lv_last_name ) or

                  ( vorna LIKE lv_first_name ) )
       AND zzstatus = lv_workflow_status.

 

My problem is, ofcourse this query is selecting all the records where status = 30 and even it works correctly, If I searches with Request ID(* or *3*).

 

But am not able to select the records, if I searches with Last or First Name. Guess I did some thing wrong in select query.

 

Please advice me.

 

With Regards,

Ram.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>