cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a BAPI to update the z fields in the "Proj" table?

yalcin_mete
Participant
0 Kudos

Hi,
I want to update the Z fields(ZZUSR00,ZZUSR01,ZZUSR02ZZUSR03,ZZUSR04) in the "PROJ" table. Is there BAPI I can use for this?

SAP module : PS.

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

raymond_giuseppi
Active Contributor

If your fields were created in CI_PROJ, there are now available in structure BAPI_TE_PROJECT_DEFINITION.

  • Read BAPI_BUS2001_CHANGE documentation
  • Use this structure in EXTENSIONIN parameter of BAPI_BUS2001_CHANGE
  • Wrap this call between BAPI_PS_INITIALIZATION and BAPI_PS_PRECOMMIT
  • Call BAPI_TRANSACTION_COMMIT if no error message returned from the bapi and the precommit call.
yalcin_mete
Participant
0 Kudos

Thank you raymond.giuseppi .

I tried to do what you said based on your help, but I could not perform the update.

can you help me?


FUNCTION z_ps_eba_proj.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_PSPID) TYPE TEXT40
*" REFERENCE(IV_ZZUSR00) TYPE TEXT40
*" REFERENCE(IV_ZZUSR01) TYPE TEXT40
*" REFERENCE(IV_ZZUSR02) TYPE TEXT40
*"----------------------------------------------------------------------

IF iv_pspid IS NOT INITIAL.

DATA: ls_extensionin TYPE bapiparex,
lt_extensionin TYPE TABLE OF bapiparex,
it_return TYPE TABLE OF bapiret2,
ls_project_def TYPE bapi_bus2001_chg,
ls_project_def_upd LIKE bapi_bus2001_upd,
lt_return TYPE TABLE OF bapiret2 WITH HEADER LINE.

DATA: ls_def TYPE bapi_te_project_definition.
REFRESH: lt_EXTENSIONIN,it_return.


CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

ls_project_def-project_definition = iv_pspid.
ls_project_def-partner_profile = 'PS'.
ls_project_def_upd-partner_profile = 'X'.


APPEND VALUE #( structure = 'BAPI_TE_PROJECT_DEFINITION'
valuepart1 = iv_zzusr00
valuepart2 = iv_zzusr01
valuepart3 = iv_zzusr02 ) TO lt_EXTENSIONIN.


APPEND INITIAL LINE TO lt_extensionin ASSIGNING FIELD-SYMBOL(<lfs_extensionin>).
CLEAR: ls_def.
ls_def-zzusr00 = iv_zzusr00.
CALL FUNCTION 'BAPI_BUS2001_CHANGE'
EXPORTING
i_project_definition = ls_project_def
i_project_definition_upd = ls_project_def_upd
TABLES
et_return = it_return
extensionin = lt_EXTENSIONIN.

LOOP AT it_return INTO DATA(ls_return) WHERE type CA 'AEX'.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_PS_PRECOMMIT'
TABLES
et_return = lt_return.
LOOP AT lt_return TRANSPORTING NO FIELDS WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.
ENDIF.





raymond_giuseppi
Active Contributor
0 Kudos

The VALUEPARTn are not indidual fields to pass parameters. read again the BAPI documentation, pass the structure BAPI_TE_PROJECT_DEFINITION in this area

Look at my old answer at this old thread (with a sample code attachment)