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: 

When Two person print at on time,error happened.

Former Member
0 Kudos

Hello:

The code: (S_NUMBER is sequence number)

SELECT

*

FROM <table>

INTO TABLE ITAB

SORT ITAB BY ZNUMBER.

LOOP AT ITAB.

S_NUMBER = ITAB-ZNUMBER.

ENDLOOP.

WA-ZNUMBER = S_NUMBER + 1.

WA-ZNAME = NAME.

WA-ZUSER_ID = ID.

CONCATENATE SY-DATUM SY-UZEIT INTO PTIME.

WA-ZTIME = PTIME.

INSERT INTO <table> VALUES WA.

When two person print different documents at one time.the printer work automatic,but S_NUMBER is same,and can not insert the wa into the table.

Hope someone can give me some helps.

Regards&Thanks

zagory

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi zagory,

In your program you may need to lock your table when you update the record and unlock it back so that the database entries remain consistent.

See http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4c8a79e11d1950f0000e82de14a/content.htm for SAP Locking example.

Regards,

Wenceslaus.

2 REPLIES 2

Former Member
0 Kudos

Hi zagory,

In your program you may need to lock your table when you update the record and unlock it back so that the database entries remain consistent.

See http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4c8a79e11d1950f0000e82de14a/content.htm for SAP Locking example.

Regards,

Wenceslaus.

0 Kudos

I believe that table locking would be "overkill." One of the many benefits of SAP is the ability to leverage it's client/server architecture INCLUDING it's table lock management.

I would suggest creating a number range in config.

Or if the actual number is not needed... just a unique value is needed... then I would suggest creating a GUID on the fly for uniqueness.