‎2022 Aug 15 3:07 AM
‎2022 Aug 15 3:32 AM
Hello walkerist. I found a question similar to yours on SAP Question. Check out the link below.
Selecting single value using for all entries. | SAP Community
‎2022 Aug 15 8:25 AM
SINGLE must not be used with FOR ALL ENTRIES. Just store the result into an internal table. I guess storing into an internal table will have much less performance impact than using FOR ALL ENTRIES.
‎2022 Aug 15 8:31 AM
‎2022 Aug 15 10:28 AM
Thanks sandra.rossi and venkateswaran.k however, I'm experiencing another error which is "LT_MCH1" is a table without a header line and therefore does not have a component called "VFDAT".
this is my code:
DATA: lt_mch1 TYPE STANDARD TABLE OF mch1.
IF tvbdpr IS NOT INITIAL.
SELECT *
FROM mch1
FOR ALL ENTRIES IN @tvbdpr
WHERE matnr = @tvbdpr-matnr
AND charg = @tvbdpr-charg
INTO CORRESPONDING FIELDS OF TABLE @lt_mch1.
IF sy-subrc = 0.
l_mat_exp = lt_mch1-vfdat.
ENDIF.
ENDIF.
‎2022 Aug 15 11:26 AM
Tried adding temporary line "with header line" for the mean time
DATA: t_mch1 TYPE STANDARD TABLE OF mch1 with header line.Also, the selection is successfull and the t_mch1 is being populated. However the t_mch1-vfdat fetches 0000000 instead of the correct date. Why is that?
SELECT vfdat
FROM mch1
FOR ALL ENTRIES IN @tvbdpr
WHERE matnr = @tvbdpr-matnr
AND charg = @tvbdpr-charg
INTO CORRESPONDING FIELDS OF TABLE @t_mch1.
IF sy-subrc = 0.
l_mat_exp = t_mch1-vfdat.
ENDIF.
‎2022 Aug 15 5:22 PM
Header lines are prone to errors, and so were made obsolete, two reason to not used them.
T_MCH1 is an internal table, you must read the line which you're interested in (READ TABLE as you seem to use old ways of programming / better use Table Expressions instead).