2007 Aug 02 12:06 PM
Hi,
Please respond on this ASAP.
SELECT SINGLE PRODH FROM MVKE INTO MVKE-PRODH WHERE
MATNR = VBDPR-MATNR.
IF SY-SUBRC EQ 0.
IF MVKE-PRODH NE SPACE.
IF MVKE-PRODH(5) EQ '00003'.
V_WINDSHIELDS = V_WINDSHIELDS + V_INV_QTY.
V_WINDSHIELDS_TOTAL = V_WINDSHIELDS_TOTAL + V_INV_QTY.
ELSEIF MVKE-PRODH(5) EQ '00004'.
V_TEMPERED = V_TEMPERED + V_INV_QTY.
V_TEMPERED_TOTAL = V_TEMPERED_TOTAL + V_INV_QTY.
ELSEIF MVKE-PRODH(5) EQ '00005'.
V_MOLDINGS = V_MOLDINGS + V_INV_QTY.
V_MOLDINGS_TOTAL = V_MOLDINGS_TOTAL + V_INV_QTY.
ENDIF.
ENDIF.
ENDIF.
this is the logic
i want to know if we are using sel single and
if there are more entries in MVKE
then too it will pick 1st always
then what is the alternate,
2007 Aug 02 12:12 PM
Hi,
use the following code.
DATA: BEGIN OF itab_mvke OCCURS 0,
matnr TYPE mara-matnr,
prodh TYPE mvke-prodh,
END OF itab_mvke.
SELECT prodh FROM mvke INTO CORRESPONDING FIELDS OF itab_mvke WHERE
matnr = vbdpr-matnr.
IF sy-subrc EQ 0.
LOOP AT ITAB_MVKE.
IF ITAB_MVKE-prodh NE space.
IF ITAB_MVKE-prodh(5) EQ '00003'.
v_windshields = v_windshields + v_inv_qty.
v_windshields_total = v_windshields_total + v_inv_qty.
ELSEIF ITAB_MVKE-prodh(5) EQ '00004'.
v_tempered = v_tempered + v_inv_qty.
v_tempered_total = v_tempered_total + v_inv_qty.
ELSEIF ITAB_MVKE-prodh(5) EQ '00005'.
v_moldings = v_moldings + v_inv_qty.
v_moldings_total = v_moldings_total + v_inv_qty.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.<i><b>regards
Debjani
Reward points for all helpful answer</b></i>
Hi,
Please respond on this ASAP.
SELECT SINGLE PRODH FROM MVKE INTO MVKE-PRODH WHERE
MATNR = VBDPR-MATNR.
IF SY-SUBRC EQ 0.
IF MVKE-PRODH NE SPACE.
IF MVKE-PRODH(5) EQ '00003'.
V_WINDSHIELDS = V_WINDSHIELDS + V_INV_QTY.
V_WINDSHIELDS_TOTAL = V_WINDSHIELDS_TOTAL + V_INV_QTY.
ELSEIF MVKE-PRODH(5) EQ '00004'.
V_TEMPERED = V_TEMPERED + V_INV_QTY.
V_TEMPERED_TOTAL = V_TEMPERED_TOTAL + V_INV_QTY.
ELSEIF MVKE-PRODH(5) EQ '00005'.
V_MOLDINGS = V_MOLDINGS + V_INV_QTY.
V_MOLDINGS_TOTAL = V_MOLDINGS_TOTAL + V_INV_QTY.
ENDIF.
ENDIF.
ENDIF.
this is the logic
i want to know if we are using sel single and
if there are more entries in MVKE
then too it will pick 1st always
then what is the alternate,
2007 Aug 02 12:12 PM
Hi,
use the following code.
DATA: BEGIN OF itab_mvke OCCURS 0,
matnr TYPE mara-matnr,
prodh TYPE mvke-prodh,
END OF itab_mvke.
SELECT prodh FROM mvke INTO CORRESPONDING FIELDS OF itab_mvke WHERE
matnr = vbdpr-matnr.
IF sy-subrc EQ 0.
LOOP AT ITAB_MVKE.
IF ITAB_MVKE-prodh NE space.
IF ITAB_MVKE-prodh(5) EQ '00003'.
v_windshields = v_windshields + v_inv_qty.
v_windshields_total = v_windshields_total + v_inv_qty.
ELSEIF ITAB_MVKE-prodh(5) EQ '00004'.
v_tempered = v_tempered + v_inv_qty.
v_tempered_total = v_tempered_total + v_inv_qty.
ELSEIF ITAB_MVKE-prodh(5) EQ '00005'.
v_moldings = v_moldings + v_inv_qty.
v_moldings_total = v_moldings_total + v_inv_qty.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.<i><b>regards
Debjani
Reward points for all helpful answer</b></i>
2007 Aug 02 12:13 PM
Hi
When you use select single ,it's always will bring only one result (first that corresponds to selection criteria (in this case MATNR number).
you can make it for example (make performance modifiation later):
data:itab type mvke.
SELECT SINGLE *
FROM MVKE
INTO table ITAB
where MATNR = VBDPR-MATNR.
IF SY-SUBRC EQ 0
loop at itab. (instead of MVKE put ITAB)
IF MVKE-PRODH NE SPACE.
IF MVKE-PRODH(5) EQ '00003'.
V_WINDSHIELDS = V_WINDSHIELDS + V_INV_QTY.
V_WINDSHIELDS_TOTAL = V_WINDSHIELDS_TOTAL + V_INV_QTY.
ELSEIF MVKE-PRODH(5) EQ '00004'.
V_TEMPERED = V_TEMPERED + V_INV_QTY.
V_TEMPERED_TOTAL = V_TEMPERED_TOTAL + V_INV_QTY.
ELSEIF MVKE-PRODH(5) EQ '00005'.
V_MOLDINGS = V_MOLDINGS + V_INV_QTY.
V_MOLDINGS_TOTAL = V_MOLDINGS_TOTAL + V_INV_QTY.
ENDIF.
ENDIF.
endloop.
so you will get all occurrences which corresponds for the matnr number
Regards
Yossi
2007 Aug 02 12:15 PM
if you want to process all the records with matching criteria then select all records in internal table and then process each one of them using LOOP statement.
2007 Aug 02 12:17 PM
hi
this select single is mainly used for valiation
it will get all the records
but under loop it will work
reward if usefull
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |