Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Query for selecting the SLED/BBD in MSEG table

walkerist
Participant
0 Kudos

Hi everyone, I'm maintaining a program and I want to add functionality that gets the Shelf life expiration date or best before date of a material. If material has been determined, is this how to get the SLED/BBD of an item? I'm not quite sure how to query it. This is a simulation only as of the moment.

SELECT SINGLE VFDAT

FROM MSEG

INTO @lv_mseg

WHERE matnr = @lv_matnr.

1 ACCEPTED SOLUTION

venkateswaran_k
Active Contributor

Hi

If you want to take the Expiry date or Shelf life date of a material then the best way is to pick according to batch from this table MCH1.

SELECT CHARG, vfdat FROM MCH1 WHERE matnr = lv_matnr;
oR
SELECT MATNR, CHARG, vfdat FROM MCH1 WHERE matnr = lv_matnr and charg = lv_batch.

Regards,

Venkat

6 REPLIES 6

venkateswaran_k
Active Contributor

Hi

If you want to take the Expiry date or Shelf life date of a material then the best way is to pick according to batch from this table MCH1.

SELECT CHARG, vfdat FROM MCH1 WHERE matnr = lv_matnr;
oR
SELECT MATNR, CHARG, vfdat FROM MCH1 WHERE matnr = lv_matnr and charg = lv_batch.

Regards,

Venkat

0 Kudos

Thanks. Why is getting the SLED/BBD from MCH1 better than MSEG?

0 Kudos

Because the MSEG is the inventory movements line item table which is bigger compared to MCH1.

MCH1 is the Batch information table for a material - which will be the correct one. Here you will get unique combination of Material and Batch.

0 Kudos

venkateswaran.k Thanks sir! I'm just curious, if I don't have input option, how do I get the proper value of charg? Sorry I'm new into this. The dilemma is I only know the material number but not the charge number.

0 Kudos

Hi walkerist.. No Sir Please 🙂

No problem whether you know only Material and not batch number.

If you know only Material - then the query will return all the batches of that Material with its Shelf life date.

If you know material + batch == then it will return only one record specific to that.

0 Kudos

venkateswaran.k That is noted. I just have a problem that there were multiple entries of material 123 in table MCH1. Also, I need to display different materials and get their sled/bbd. Nevertheless, thank you for your help!