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: 

Creation of Batch number

Former Member
0 Kudos
2,249

Hi Experts,

I have a probelm with the Transaction MIGO to restrict the ignore the batchnumber entered by the user.

If the user is not enter the batch number, then i can generated the new number by using the following 2 UE's

EXIT_SAPLV01Z_001 (ZXVBZU01) & EXIT_SAPLV01Z_002 (ZXVBZU02) and it is working fine.

If the user enters , then System first check that whether it is already exist in the Database . If it won't find then automatically it is considering the same number.Which needs to be stopped.

Any body has an idea about this requirement, to ignore the user entered value.

Actually, there are 2 more exists, EXIT_SAPLV01Z_011& EXIT_SAPLV01Z_012 there i can't change the value of the batch number.

Any suggestion or Any alternative way or Any idea Please......?

Warm Regards,

Vijay

1 ACCEPTED SOLUTION

Former Member
0 Kudos
565

Hi,

I think you can restrict by using FM EXIT_SAPLV01Z_001, this i copied the FM documentation for your reference. Just read the FM documentation you will get an idea

You can restirict by using automatic generation using number ranges

<<Function module Documentation>>

Functionality

You can use this customer function call (CFC) to replace the standard number range (object, subobject, number range, and year) with one of your own. This is used subsequently to determine a new batch number.

Number assignment is carried out using the central number assignment.

The communication structure X_BNCOM contains the application data known up to this time. You can extend this structure in the DDIC using structure BNCOMZ.

Using the parameter CUST_NO_INTERNAL, you can suppress the number assignment function. Then you can either generate a batch number in function module EXIT_SAPLV01Z_002 using your own criteria or suppress the entire number assignment function.

Using the parameter MESSAGE_WHEN_AUTO, you can decide if a dialog box is to appear before a new number is assigned. This only happens during online processing.

Example

You can define internal batch number assignment according to your requirements via the enhancement SAPLV01Z with the exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002

SAP delivers a total of 6 examples for batch number assignment:

1. Copying the production order number to the batch number

2. Copying the sales order number to the batch number

3. Material-type-dependent batch number assignment

4. Material-number-dependent batch number assignment

5. Including the date in the batch number

6. Including the plant number in the batch number

For examples 1 and 2 you have to use the exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002.

For examples 3 and 4 you have to use the exit EXIT_SAPLV01Z_001.

For examples 5 and 6 you have to use the exitEXIT_SAPLV01Z_002.

For a detailed description of the examples, see below.

Prerequisites

1. Internal batch number assignment via the customer exit is activated:

To do this, in Customizing, choose Logistics general -> Batch management -> Batch number assignment -> Activate internal batch number assignment.

2. Maintaining the number range object

Two number range objects are provided for batch number assignment:

Standard number range for batch number assignment BATCH_CLT

Number range for material-type-dependent or material-number-dependent batch number assignment BATCH_MAT

Activities

1. Use the SAP enhancement SAPLV01Z:

a) In transaction CMOD, create either a new project or use an existing project.

b) Add the SAP enhancement SAPLV01Z to the project.

2. Copying the example code:

a) Choose Component.

b) Choose Change.

c) Choose:

EXIT_SAPLV01Z_001 for examples 1-4

EXIT_SAPLV01Z_002 for examples 1-2 and 5-6

d) Choose Edit -> Copy SAP source text.

The example code is copied to the relevant table in the function module exit.

e) To copy the example, remove the comment symbol before the include it pertains to.

3. Activate the project.

When you activate the project, the enhancement with the function module exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002 comes into effect.

Examples

Example 1

Copying the production order number to the batch number

When a batch is produced, the process order number or production order number is copied as the batch number. This type of assignment is only possible in connection with process orders or production orders.

Outwith an order, a number range is determined for batch number assignment. In this example, it is the standard number range BATCH_CLT.

If the order has not yet been saved (for example, when a number is assigned when the order is created), a temporary number is created. A message appears prompting you to save the order. The system then assigns an order number which is accepted as the batch number.

The system checks whether a batch already exists with this number. If this is the case, the system aborts internal batch number assignment with a corresponding error message.

Note:

In this example, note that the include LXVBZB21 in EXIT_SAPLV01Z_002 has to be activated at the same time, as actual batch numbers are not assigned until this is activated.

Example 2

Copying the sales order number to the batch number

If a batch number is assigned in connection with a sales order, the sales order number is accepted as the batch number.

If there are no sales orders, a number range object is defined with a number range from which the batch number is taken. If a batch already exists with this sales order number, the batch number is assigned externally.

Note:

In this example, note that the include LXVBZB22 in EXIT_SAPLV01Z_002 has to be activated at the same time before actual number assignment can take place.

Example 3

Material-type-dependent batch number assignment

In the number range object BATCH_MAT a separate sub-object is created for each material type. Note that the number range object is maintained accordingly or batch number assignment cannot take place.

For example, if the material "flour" belongs to raw materials, it is maintained in the sub-object ROH, and the batch number is taken from the same number range as the material "eggs" which also belongs to the raw materials group.

Example 4

Material-number-dependent batch number assignment

In material-number-dependent batch number assignment, materials that are handled in batches must be maintained in the table BNMAT, which specifies the assignment of the material to the number range.

If there is no assignment in the table, the system aborts batch number assignment. An error message appears informing you that batch number assignment is not possible and specifying the table that has to be maintained.

Each material number is assigned a number range object, a sub-object, and a number range in the table BNMAT. This is how each material receives its own batch number range.

The number range object BATCH_MAT is an example of this. The material numbers are divided into groups via their material type that match the sub-object. Each material number is then assigned its own number range by table BATCH_MAT. The number ranges used must be maintained in the number range object.

Examples 5 and 6

Including the date or plant number in the batch number

The number ranges for the batch numbers must be defined in a way that ensures that no characters are overwritten by the templates.

Parameters

X_BNCOM

CUST_NO_INTERNAL

NR_RANGE_NR

OBJECT

SUBOBJECT

TOYEAR

MESSAGE_WHEN_AUTO

MESSAGE_DONE

Exceptions

CANCELLED

Regardas

Krishna

6 REPLIES 6

Former Member
0 Kudos
566

Hi,

I think you can restrict by using FM EXIT_SAPLV01Z_001, this i copied the FM documentation for your reference. Just read the FM documentation you will get an idea

You can restirict by using automatic generation using number ranges

<<Function module Documentation>>

Functionality

You can use this customer function call (CFC) to replace the standard number range (object, subobject, number range, and year) with one of your own. This is used subsequently to determine a new batch number.

Number assignment is carried out using the central number assignment.

The communication structure X_BNCOM contains the application data known up to this time. You can extend this structure in the DDIC using structure BNCOMZ.

Using the parameter CUST_NO_INTERNAL, you can suppress the number assignment function. Then you can either generate a batch number in function module EXIT_SAPLV01Z_002 using your own criteria or suppress the entire number assignment function.

Using the parameter MESSAGE_WHEN_AUTO, you can decide if a dialog box is to appear before a new number is assigned. This only happens during online processing.

Example

You can define internal batch number assignment according to your requirements via the enhancement SAPLV01Z with the exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002

SAP delivers a total of 6 examples for batch number assignment:

1. Copying the production order number to the batch number

2. Copying the sales order number to the batch number

3. Material-type-dependent batch number assignment

4. Material-number-dependent batch number assignment

5. Including the date in the batch number

6. Including the plant number in the batch number

For examples 1 and 2 you have to use the exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002.

For examples 3 and 4 you have to use the exit EXIT_SAPLV01Z_001.

For examples 5 and 6 you have to use the exitEXIT_SAPLV01Z_002.

For a detailed description of the examples, see below.

Prerequisites

1. Internal batch number assignment via the customer exit is activated:

To do this, in Customizing, choose Logistics general -> Batch management -> Batch number assignment -> Activate internal batch number assignment.

2. Maintaining the number range object

Two number range objects are provided for batch number assignment:

Standard number range for batch number assignment BATCH_CLT

Number range for material-type-dependent or material-number-dependent batch number assignment BATCH_MAT

Activities

1. Use the SAP enhancement SAPLV01Z:

a) In transaction CMOD, create either a new project or use an existing project.

b) Add the SAP enhancement SAPLV01Z to the project.

2. Copying the example code:

a) Choose Component.

b) Choose Change.

c) Choose:

EXIT_SAPLV01Z_001 for examples 1-4

EXIT_SAPLV01Z_002 for examples 1-2 and 5-6

d) Choose Edit -> Copy SAP source text.

The example code is copied to the relevant table in the function module exit.

e) To copy the example, remove the comment symbol before the include it pertains to.

3. Activate the project.

When you activate the project, the enhancement with the function module exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002 comes into effect.

Examples

Example 1

Copying the production order number to the batch number

When a batch is produced, the process order number or production order number is copied as the batch number. This type of assignment is only possible in connection with process orders or production orders.

Outwith an order, a number range is determined for batch number assignment. In this example, it is the standard number range BATCH_CLT.

If the order has not yet been saved (for example, when a number is assigned when the order is created), a temporary number is created. A message appears prompting you to save the order. The system then assigns an order number which is accepted as the batch number.

The system checks whether a batch already exists with this number. If this is the case, the system aborts internal batch number assignment with a corresponding error message.

Note:

In this example, note that the include LXVBZB21 in EXIT_SAPLV01Z_002 has to be activated at the same time, as actual batch numbers are not assigned until this is activated.

Example 2

Copying the sales order number to the batch number

If a batch number is assigned in connection with a sales order, the sales order number is accepted as the batch number.

If there are no sales orders, a number range object is defined with a number range from which the batch number is taken. If a batch already exists with this sales order number, the batch number is assigned externally.

Note:

In this example, note that the include LXVBZB22 in EXIT_SAPLV01Z_002 has to be activated at the same time before actual number assignment can take place.

Example 3

Material-type-dependent batch number assignment

In the number range object BATCH_MAT a separate sub-object is created for each material type. Note that the number range object is maintained accordingly or batch number assignment cannot take place.

For example, if the material "flour" belongs to raw materials, it is maintained in the sub-object ROH, and the batch number is taken from the same number range as the material "eggs" which also belongs to the raw materials group.

Example 4

Material-number-dependent batch number assignment

In material-number-dependent batch number assignment, materials that are handled in batches must be maintained in the table BNMAT, which specifies the assignment of the material to the number range.

If there is no assignment in the table, the system aborts batch number assignment. An error message appears informing you that batch number assignment is not possible and specifying the table that has to be maintained.

Each material number is assigned a number range object, a sub-object, and a number range in the table BNMAT. This is how each material receives its own batch number range.

The number range object BATCH_MAT is an example of this. The material numbers are divided into groups via their material type that match the sub-object. Each material number is then assigned its own number range by table BATCH_MAT. The number ranges used must be maintained in the number range object.

Examples 5 and 6

Including the date or plant number in the batch number

The number ranges for the batch numbers must be defined in a way that ensures that no characters are overwritten by the templates.

Parameters

X_BNCOM

CUST_NO_INTERNAL

NR_RANGE_NR

OBJECT

SUBOBJECT

TOYEAR

MESSAGE_WHEN_AUTO

MESSAGE_DONE

Exceptions

CANCELLED

Regardas

Krishna

0 Kudos
565

Hi Krishna,

Thanks for Quick response. But If the User enters the Batch number manuvally then, The above 2 UE's which you mentions won't be inpicutre. I mean, Control won't come to these 2 UE's. That is the major problem.

If control comes to these UE's , then we can solve the problem easily.

Please let me know any other solution or suggestion.

Warm Regards,

Vijay

former_member262988
Active Contributor
0 Kudos
565

Hi,

Please use MB_MIGO_BADI method LINE_MODIF there you can modify the charg field .....

Thanks,

Shailaja Ainala.

0 Kudos
565

Hi Sailaja,

Lools like your solution is suitable for my problem. But i didn't find the BADI MB_MIGO_BADI in my system, Do we need to activate or install theBADI. If so, Please let me know, How can i do that.

Thanks in Advance,

Warm Regards,

Vijay

0 Kudos
565

Hi,

then once try MB_CF001

Thanks,

Shailaja Ainala.

0 Kudos
565

This message was moderated.