cancel
Showing results for 
Search instead for 
Did you mean: 

Number Range Skipping BP Mass Upload

0 Kudos

I am uploading BP using BOL programming. I get error message only after core is modified. So in any case I have to modify the core which generates BP_NUMBER. But if there exists some error I have rolled backed the transaction but number range is skipping.

Is there exist any way to avoid the number range skipping since during mass upload the number range may be skipped by 10-100 numbers.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182985
Contributor
0 Kudos

Dear Rohan,

For the number gaps issue, please refer to the following KBA.

You could choose the proper resolution as per your business requirement.

1843002 - Gaps and Jumps in Numbering

  

Thanks,

Best regards,

Julin Xin

0 Kudos

Dear Julin,

Thanks for the reply but I have already checked this SAP Note.

But I am not getting how to resolve the issue. Since I am uploading Business Partners in mass but suppose if some user is manually uploading the BP on WebUI then it is not possible to avoid the gaps.

I am not using BAPI technology, I am using BOL programming to upload BP and I am only getting error messages after modifications are made to core object. Also I need to modify the core to get business partner so that I can create Employee Responsible relationship. but when I modify the core Business Partner no. is generated but in case of error I have to roll back the same. In that case number range is skipping.

If no other user is doing the concurrent transaction the number range should not be skipped. Is there exist any function module to refresh the number range buffer to avoid this skipping.

Thanks & Regards,

Rohan

Former Member
0 Kudos

Hi Rohan,

Can you please post your code which is actually creating/rolling back the partner?

0 Kudos

Dear Sagar,

Please find the code below:

lr_core = cl_crm_bol_core=>get_instance( ).
lr_core->start_up( 'BP_APPL' ).
lr_factory = lr_core->get_entity_factory( 'BuilHeader' ).

ls_params-name = 'BP_CATEGORY'.
ls_params-value = '2'.
APPEND ls_params TO lt_params.

ls_params-name = 'BP_GROUP'.
ls_params-value = '0001'.
APPEND ls_params TO lt_params.

lr_entity = lr_factory->create( lt_params ).

The above statement creates BP_NUMBER & BP_GUID.
I have created related entities and set their properties then at last committed as follows:

lr_core->modify( ).
lr_msg_cont = lr_entity->get_message_container( ).
lr_transaction = lr_core->get_transaction( ).
IF lr_transaction->save( ) EQ abap_true AND ls_messages IS INITIAL. "ls_messages contains error messages
lr_transaction->commit( ).
ELSE.
lr_transaction->rollback( ).
ENDIF.

lr_transaction->rollback or lr_transaction->revert I tried everything possible but not able to revert the number if not used.

I used this code in loop and if every record contains error the numbers are getting skipped.

Thanks & Regards,

Rohan

Former Member
0 Kudos

Hi Rohan,

Thanks for sharing the code. Now I understand why is the number being skipped. Try following:

data lv_create_entitytype boolean default abap_true.

loop at lt_data into ls_data.

if lv_create_entity eq abap_true.

lr_entity = lr_factory->create( lt_params ).

***** fill data into lr_entity and create related entities *****

else.

***** fill data into lr_entity and its related entities, do not create lr_entity or its related entities, instead use previously created entities *****

endif.

lr_core->modify( ).

lr_transaction = lr_core->get_transaction( ).

if lr_transaction->CHECK_SAVE_POSSIBLE( ) eq abap_true.

lr_transaction->save( ).

lr_transaction->commit( ).

lv_create_entity = abap_true.

else.

lr_transaction->rollback( ).

lv_create_entity = abap_false.

endif.

endloop.

0 Kudos


Hi Sagar,

Thanks for the reply.

I thought about the same but I have to write same code 2 times if part and else part unnecessarily.

And anyhow if each record contains error 1 number will be skipped.

I will try and check if numbers are skipped using BAPIs.

Regards,

Rohan

Former Member
0 Kudos

Hi Rohan,

It is not a big effort.

You only have to put following logic in your existing program

* if the BP of previous record is saved create entity using your code below

lr_entity = lr_factory->create( lt_params ).


* if the BP of previous record is not saved, do not create new entity, instead set the data to existing entity



Effort for using BAPI will be more and you will end up loosing the BP number even in case of BAPI