[LineLoop / Macro] Auto-select batch numbers by expiry date

The following example explains how to auto-select the batch numbers ins a delivery, based on the Expiry date.

 mceclip0.png

 mceclip1.png

 

Function button

First, we create the function button in the window.

 mceclip2.png

 

Line Loop

We need to create a universal function type LineLoop that will be executed when the button is clicked.

 mceclip3.png

The line loop will include a validation to verify if the item is batch controlled.

 

IF($[$38.1.0] <> '') and ((SELECT T0.[ManBtchNum] FROM OITM T0 WHERE T0.ItemCode=$[$38.1.0]) = 'Y')

BEGIN

SELECT 'EJEMPLO' FOR BROWSE

END

 

If this condition is met, then another universal function is executed.

 

Macro

 

The following macro opens the Batch Number selection window, order by the column Expiry date and select the batch that corresponds.

 mceclip4.png

 

Activate();   //Activate the window

Focus($[$38.11.0]);   //Focus on quantity

Activate(5896);   //Open Batch selection window

Activate();   //Activate new window

DoubleClick($[$4.15.DATE]); //Double clic on Expire date column

Click($[$16.0.0]);      //Click Auto

AutoPressNextPopup($[$1.0.0]);  //Yes in continue message

Click($[$1.0.0]);  //Click update

Close();  //Close Window

Activate();   //Activate old window

 

 

Was this article helpful?

0 out of 0 found this helpful

Comments

2 comments

  • Comment author
    Rafi Gaon

    Thx for the example

    I'd like to know what should be added if there isn't enough quantity in the specific expiry date, and I have to deliver from the same e.d.?

     

    Thx again

    0
  • Comment author
    Yaremi Miranda Lopez

    Hello Rafi,

    In this example, we use SAP's standard functionality called Autoselect. You can change the functionality and use your own logic. =)

    0

Please sign in to leave a comment.