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: 

Automatically SLED field population when production date is changed in COR2 transaction

Former Member
0 Kudos

Hi Friends,

I have one requirement.

IN COR2 transaction I have written code to update production date of PON batch with production date of material master data if material type is 'BULK' through BAPI.

In MSC2N transaction changes have been made by someone to calculate and populate expiry date field automatically.

I want this same functionality in COR2 transaction, when I am making the changes to update production date as i said in first line.

I tried to find FM which calculates expiry date i.e SLED. But got nothing.

Kindly help me how it can be implemented via BDC or any FM.

Any help will be appreciated

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Friends,

to be more clear,

i am updating production date in the attached screenshot through bapi BAPI_BATCH_CHANGE.

and i want SLED to be calculated and populated automatically when i update production date through BAPI.

2 REPLIES 2

Former Member
0 Kudos

Hi Friends,

to be more clear,

i am updating production date in the attached screenshot through bapi BAPI_BATCH_CHANGE.

and i want SLED to be calculated and populated automatically when i update production date through BAPI.

0 Kudos

Hi Friends,

I used FM inside the same customer exit after fetching production date to calculate expiry date by passing rounding rule, shelf life, production date, and s structure with some required values.

Below is the code:

           CALL FUNCTION 'VB_MAINTAIN_MHD'

               EXPORTING

                 i_iprkz_hbd              = lwa_expiry-iprkz

                 i_rdmhd                   = lwa_expiry-rdmhd

                 i_geshb                   = lwa_expiry-geshb

                 i_hsdat                    = lwa_jcds-udate

                 i_bncom                  = bncom

                 check                     = lc_space

                 calc                        = lc_x

               IMPORTING

                 o_mhdat                 = lw_expiry

               EXCEPTIONS

                 sled_le_production_date  = 1

                 ref_date_lower_prod_date = 2

                 OTHERS                   = 3.

             IF sy-subrc <> 0.

               MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

             ENDIF.

And requirement is completed.