Tcode: Z100 When creating an order, manually write 0 coorder, take the maximum value of Sid, and Add 1.
The related code is as follows:
Select single max (SID) from/bi0/scoorder into l_scoorder-sid
Where coorder <> ''.
L_scoorder-sid = l_scoorder-sid + 1.
L_scoorder-coorder = p_order.
Insert/bi0/scoorder from l_scoorder.
After filling in z00112010022, we can see that the current encoding in the number pool is still 750128, and in the s table, the SID value 750129 is occupied.
Tcode: rsa1 We simulate the ETL of SAP, mainly to test how the s table handles the issue of SID occupation when DTP extracts data from PSA to 0coorder.
Table:/bi0/scoorder
First, we create three new data items in PSA of the z_coorder data source.
Upload DTP later, and an error is prompted:
Then, we checked the records in the s table and found:
At 111111111117, we found that the SID was occupied and skipped the data and reported an error. 111111111118 and 111111111119 are successfully added.
PS: we followed the current 0coorder P table and found that there are no newly loaded data. However, two records have been filled in the s table.
The current status of the number range object is 750131.
Load DTP again. Upload successful.
The problem is solved as follows:
When loading DTP again, the system searches for the p table and finds that the data does not exist. Then, it applies for three Sid IDs. At this time, the number pool number is 750134, this loading only adds a record in the s table, 111111111117, and its Sid is 750132. In this case, a hop occurs. That is to say, as long as the SID is occupied, the system will continue to apply for the SID. If the requested data volume is large enough and exceeds the SID entered manually, no error will be reported during the upload.
This is why a DTP upload error occurs and the upload succeeds again.
PS: the data in Table P exists.
Solution:
Using the system standard function, you can directly retrieve the data in the number pool to avoid Sid conflicts.
The related code is as follows:
Call function 'Number _ get_next'
Exporting
Nr_range_nr = '01'
Object = 'bimparts 394'
Importing
Number = l_scoorder-sid.
PS: if the data is manually entered at the same time as the data uploaded by the system, you may obtain the same number. You can also use the 'number _ range_enqueue 'and 'number _ range_dequeue' of the system to solve the problem.
The related code is as follows:
Call function 'Number _ range_enqueue'
Exporting
Object = 'bimparts 394'
Exceptions
Foreign_lock = 1
Object_not_found = 2
System_failure = 3
Others = 4.
Case sy-subrc.
When 1.
Message e024 (NR ).
When 2.
Message 'object _ not_found 'Type 'E '.
When 3.
Message 'System _ failure 'Type 'E '.
When 4.
Message 'others' type 'E '.
Endcase.
If sy-subrc EQ 0.
Call function 'Number _ get_next'
Exporting
Nr_range_nr = '01'
Object = 'bimparts 394'
Ignore_buffer = 'X'
Importing
Number = o_int.
Call function 'Number _ range_dequeue'
Exporting
Object = 'bimparts 394'
Exceptions
Object_not_found = 1
Others = 2.
Endif.
In this way, when a program uses this number pool, an error is reported: