‎2009 Jul 02 12:55 PM
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.
‎2009 Jul 02 1:03 PM
may it be you forgot "corresponding fields of", between into and table?
‎2009 Jul 02 1:03 PM
may it be you forgot "corresponding fields of", between into and table?
‎2009 Jul 02 1:08 PM
HI,
You have not update the ranges completly.
For a range you must have the following fields to update
SIGN and OPTION
LR_MATNR-SIGN = 'I'.
LR_MATNR-OPTION = 'EQ'.
APPEND LR_MATNR.
LR_BATCH-SIGN = 'I'.
LR_BATCH-OPTION = 'EQ'.
APPEND LR_BATCH.
With the ranges data capturing, you must have to append these values.
After that you can use in your queries.
Regds,
Anil
‎2009 Jul 02 1:17 PM
Hey anil he gave thos values, just have a closer look at his code. it is all there.
‎2009 Jul 02 1:12 PM
THE % USED IN LIKE STATMENT NOT IN IN STATEMENT
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 '%'. "COMMENT THIS LINE
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 '%'. "COMMENT THIS LINE
ELSE.
wa_batch-option = zdic_pd_cl_common=>gc_option_eq.
ENDIF.
APPEND wa_batch TO lr_batch.
ENDIF.
‎2009 Jul 02 1:19 PM
‎2009 Jul 02 1:34 PM
Hi since im passing CP in the ranges i should give '%'.
But Even i tried without it but still no use
‎2009 Jul 02 1:48 PM
Hi,
Check this.
wa_matnr-sign = wa_batch-sign = 'I'.
IF pi_material IS NOT INITIAL.
MOVE pi_material TO wa_matnr-low.
IF wa_matnr-low CA '*'.
wa_matnr-option = 'CP'.
ELSE.
wa_matnr-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 = 'CP'.
ELSE.
wa_batch-option = 'EQ'.
ENDIF.
APPEND wa_batch TO lr_batch.
ENDIF.
Other way is simply comment above code.
Declare ur parameters as select-options with no intervals and No extention and use IN operator in the select query.
Thanks,
Vinod.
‎2009 Jul 02 2:28 PM
Hi GTREN the solution was correct but it was due my stupidity ...
there was a wrong view of data comparison with table and data from Query..
Any ways Thanks Guys...