Application Development and Automation 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: 
Read only

Module Pool Programming adding line items.

Former Member
0 Likes
1,757

Hi,

I am Doing Module Pool Programming in which I Should add line items and if the user gives the save button the data wil be saved in tables and SAP should generate one unique number.

Please give me inputs how to generate unique number and add n number of line items

correct inputs are rewarded

Thanks

Rasheed.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,518

line item you mean(there is any header for the item) for line items you manually increment the previous existing line item. if there is no header then you can use number range for increasing the item number.

10 REPLIES 10
Read only

Former Member
0 Likes
1,518

Hi,

You may use Number Generator for generating unique ids in the system.

The keyword DEFAULT SERIAL gets a number generator for positive integers and can only be specified for columns that have the data type INTEGER, SMALLINT, and FIXED without decimal places (SERIAL).

The first value generated by the generator can be defined by specifying an unsigned integer (must be greater than 0). If this definition is missing, 1 is defined as the first value.

If an INSERT statement inserts the value in this column, you get the current number generator value and not the value 0.

Each table may not contain more than one column with the DEFAULT specification DEFAULT SERIAL.

Regards,

Renjith

Edited by: Renjith Michael on Oct 23, 2008 11:34 AM

Read only

Former Member
0 Likes
1,519

line item you mean(there is any header for the item) for line items you manually increment the previous existing line item. if there is no header then you can use number range for increasing the item number.

Read only

0 Likes
1,518

Hi Vijay,

I have Header Items also i should get these values from standard table and i should enter my line items and once i save i shd generate a unique number like standard transaction codes .

Any correct inputs are rewarded.

Thanks

Rasheed

Read only

0 Likes
1,518

>

> Hi Vijay,

> I have Header Items also i should get these values from standard table and i should enter my line items and once i save i shd generate a unique number like standard transaction codes .

>

> Any correct inputs are rewarded.

>

> Thanks

> Rasheed

Standard transactions create a line number for each new line that is unique within the document. Which you should be able to do yourself quite easily by incrementing the max line number for the document by 1 for each new line.

Read only

0 Likes
1,518

Hi Chris,

Thank you for your inputs,

For example if we create a sales order after giving all the line items and header items SAP will generate one unique sales order number for each and every sales order we create.

So i also need to generate a unique number after saving all my data in module pool programming

Correct inputs are suggested

Thanks

Rasheed.

Read only

0 Likes
1,518
Read only

0 Likes
1,518

in your case you don't need the Number range. Little code you require to generate the item numbers for a header document.

For each header you will have items from 1 to n.

how sap handles normal transaction the way you can proceed.

Read only

0 Likes
1,518

Hi,

I need to have external Number range for my Z t Code which i am developing in module pool.

I need to have one unique number when ever i create new record.

For example like new sales order,new purchase order

Correct inputs are rewarded

Regards

Rasheed

Read only

Former Member
0 Likes
1,518

Hi

Thank you very much I got the solution.

Read only

0 Likes
1,518


How did you solve this problem. I am having the same issue.

Thanks. can I see your code.