cancel
Showing results for 
Search instead for 
Did you mean: 

Maximum "Total weight" LIKP-BTGEW in delivery

former_member182378
Active Contributor
0 Kudos

The business requirement is as follows u2013 If the Total weight LIKP-BTGEW u2013 in the delivery, at header level - is greater than X kg. Then the user cannot save the delivery (i.e. create a delivery). The user shall get a popup saying u201CDelivery can not be created / saved because the Total weight is greater than X kgu201D

Which program and userexit can I use?

Many thanks, in advance!

Accepted Solutions (0)

Answers (4)

Answers (4)

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

See SAP Note 415716 - User exits in delivery processing to decide what userexit fits better with your requirement (USEREXIT_MOVE_FIELD_TO_LIKP (include MV50AFZ1) when you create the delivery, USEREXIT_SAVE_DOC_BEFORE_PREP (include MV50AFZ1), when you save it after some modifications by the end user, etc...)

Also, check if your own requirement copy VOFM in copying rules (tcode VTLA) could fit with your requirements.

I hope this helps you

Regards

Eduardo

former_member182378
Active Contributor
0 Kudos

Hi Eduardo,

How can I make use of USEREXIT_MOVE_FIELD_TO_LIKP (include MV50AFZ1)? The userexit is to move some fields to the header table of delivery but my field Total weight is already a header field. Please explain.

I am thinking of using USEREXIT_SAVE_DOCUMENT_PREPARE. This userexit is used for change or check before saving the delivery. What do you think about this option?

Many thanks, in advance!

former_member182378
Active Contributor
0 Kudos

Also, check if your own requirement copy VOFM in copying rules (tcode VTLA) could fit with your requirements.

This copy control route is very interesting. Please help by comments with alignment to the business process -

Sales order created of 500EA (1EA = 1KG). Delivery are created, maximum Total weight canNOT be greater than 20KG. Normally administrative staff go to VL01N and then give sales order #. in VL01N they change the delivery quantity from 500EA (or.....) to 20EA and then save.

In this above process description, can I use copy control, requirement?

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Related with USEREXIT_MOVE_FIELD_TO_LIKP. It's true that this subroutine was designed to provide our own additional fields. If we modify standard field (not advisable), note says:


If standard fields of the structure LIKP are changed, you may have
to carry out determinations and checks that have already been
performed again to avoid data inconsistencies. Therefore, analyze
the dependencies before you change standard fields in the table
LIKP in this exit.

It goes on:


Data from preceding documents should be prioritized and transferred
using the copy control.

so, the solution to solve it in copy rules in my opinion is the proper solution. I'm not sure if LIKP-BTGEW is populated in this moment

So, create your own subroutine (999 for instance) with a coding as this:


FORM bedingung_pruefen_999  USING bp_subrc LIKE sy-subrc.

* Perform all checks as in routine 001
  perform bedingung_pruefen_001 using bp_subrc.
  check bp_subrc = 0.

  IF likp-btgew > your_weight.
    perform message_handling in program (programmname)
                                       using posnr_low
                                         '001'
                                         'E'
                                         'ZVL'
                                         'excess of weight'
                                         space
                                         space
                                         space.
    bp_subrc = 1.
    EXIT.
  ENDIF.

ENDFORM.

where you must create your own message ZVL in SE91 or other.

Other suggestion is set a warning message in copy rules, and set the error message when you save it (think that it could be modify in a future). So use the USEREXIT_SAVE_DOC_BEFORE_PREP


Purpose
This routine can be used for the final change of all delivery data. At the
time of the call, the delivery is complete and consistent; only the
document number has not yet been determined in the creation case and the
final processing of the requirements has not yet taken place. Therefore,
changes to the delivery at this time must be made with particular care
because no subsequent checks can prevent possible data inconsistencies.
Since requirements processing has not yet occurred, this user exit is, in
particular, suitable for changes relevant for requirements when the
delivery is saved.

Remeber to avoid messages during PGI. As it says:


Display of messages
With the output of messages or user dialogs, you must make sure that this
exit can be run both in the dialog and in the background. In particular,
during goods issue posting, messages or user dialogs must never be output
because this may result in incorrect material documents.

Regards

Eduardo

Edited by: E_Hinojosa on Nov 14, 2011 12:14 PM

Former Member
0 Kudos

Hi,

As mentioned in the replies above one way is to do it through enhancement. I think there is another turnaround solution.:-

1) Create a "statistical" condition type say "ZWGT"

2) Change the feild calculation type "KRECH" to "D" or "E".

3) Whne u maintain the condition records:- VK11>GOTO>DETAILS>maintain the upper limit, so that it gives u the error.

Please try it out and let me know

Warm Regards

Aadesh Kamat

Edited by: aadesh123 on Nov 14, 2011 9:57 AM

former_member182378
Active Contributor
0 Kudos

Hi Aadesh,

Very interesting suggestion!

Would you please tell me this condition type ZWGT is a copy of which standard cond type?

I shall update you once I have done the tests.

Many thanks!

Former Member
0 Kudos

Hi,

I am not aware of any such condition, changing the calculation type feilds to "D" or "E" would consider your weight. copy it from PR00, and change it

Warm regards

Aadesh Kamat

Edited by: aadesh123 on Nov 14, 2011 11:35 AM

Lakshmipathi
Active Contributor
0 Kudos

You can try with Enhancement V50S0001

G. Lakshmipathi

former_member182378
Active Contributor
0 Kudos

Hi G. Lakshmipathi

Would you please explain in more detail how I can try with Enhancement V50S0001?

e.g. which t-code do I have to use? or what I have to communicate to the ABAPer?

Former Member
0 Kudos

Yes. ABAPER

Former Member
0 Kudos

Do it here: MV50AFZ1