Skip to Content
0
Jul 02, 2009 at 11:55 AM

Ranges problem

107 Views

Hi friends im pasting my code below.

The problem is the select Query is not returning any records when in pass the material input as 'F*' in my function module

Here pi_material holds the material No as F*

*Local internal tables Declaration
data: lr_matnr  TYPE RANGE OF mara-matnr,
      lr_batch  TYPE RANGE OF mch1-charg.

*Local WorkAreas
  DATA: wa_matnr like LINE OF lr_matnr,
        wa_batch like line of lr_batch.


  wa_matnr-sign = wa_batch-sign = zdic_pd_cl_common=>gc_sign_i.

  IF pi_material IS NOT INITIAL.
    MOVE pi_material TO wa_matnr-low.
    IF wa_matnr-low CA '*'.
      wa_matnr-option = zdic_pd_cl_common=>gc_option_cp.
      REPLACE ALL OCCURRENCES OF '*' IN wa_matnr-low WITH '%'.
    ELSE.
      wa_matnr-option = zdic_pd_cl_common=>gc_option_eq.
    ENDIF.
    APPEND wa_matnr TO lr_matnr.
  ENDIF.

  IF pi_batch IS NOT INITIAL.
    MOVE pi_batch TO wa_batch-low.
    IF wa_batch-low CA '*'.
      wa_batch-option = zdic_pd_cl_common=>gc_option_cp.
      REPLACE ALL OCCURRENCES OF '*' IN wa_batch-low WITH '%'.
    ELSE.
      wa_batch-option = zdic_pd_cl_common=>gc_option_eq.
    ENDIF.
    APPEND wa_batch TO lr_batch.
  ENDIF.


*Fetch Batch Data
  SELECT charg INTO TABLE et_batch FROM mch1 WHERE matnr in lr_matnr
                                             AND charg in lr_batch
                                             AND lvorm = space.