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: 

Reg : - Opening Projects in CJ20N using BAPI

dinamols
Participant
0 Kudos

Dear All,

According to my requirement Closed Projects have to be Opened using Program .So i tried the BAPI - BAPI_BUS2001_SET_STATUS . But i am getting Error as "'Processing not possible because there is no initialization".

Please Help me How to use this BAPI.

Please check my codings below.

********************************************************************************************************

DATA : e_result LIKE TABLE OF bapi_status_result WITH HEADER LINE.

DATA : return LIKE TABLE OF bapireturn1 WITH HEADER LINE,

l_wait LIKE bapita-wait.

DATA : s_pspid LIKE proj-pspid.

LOOP AT it_bdc.

CLEAR : s_pspid.

CALL FUNCTION 'CONVERSION_EXIT_PROJN_INPUT'

EXPORTING

input = it_bdc-pspid

IMPORTING

output = s_pspid.

REFRESH: return,e_result.CLEAR : return,e_result.

CALL FUNCTION 'BAPI_BUS2001_SET_STATUS'

EXPORTING

project_definition = s_pspid

undo_system_status = 'MDLK' " I am unlocking locked project definition

  • undo_user_status = ''

  • set_system_status = ''

  • set_user_status = ''

IMPORTING

return = return

TABLES

e_result = e_result.

READ TABLE return WITH KEY type = 'S'.

IF sy-subrc = 0.

CLEAR l_wait.

l_wait = 2.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = l_wait

  • IMPORTING

  • RETURN =

.

ENDIF.

ENDLOOP.

1 ACCEPTED SOLUTION
4 REPLIES 4

Former Member
0 Kudos

Hi,

The first step in a processing unit is initialization, which is done by calling the BAPI BAPI_PS_INITIALIZATION.

Afterwards, the individual BAPIs listed below can be used several times, if required.

The processing unit ends when the final precommit (call BAPI BAPI_PS_PRECOMMIT) is executed with a subsequent COMMIT WORK (for example, the statement COMMIT WORK, the BAPI "BAPI_TRANSACTION_COMMIT" or the BapiService.TransactionCommit method).

After the final COMMIT WORK, the next initialization opens a new processing unit via the BAPI "BAPI_PS_INITIALIZATION".

Please check the FM/BAPI documentation for BAPI_PS_PRECOMMIT and BAPI_PS_INITIALIZATION for more details

Hope this helps

Regards

Shiva

0 Kudos

Hi,

Even i read this but how will i Initialize BAPI.

0 Kudos

Dear all,

I have done this program working fine.Thanks for your help