cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_REQUISITION_CHANGE

Former Member
0 Kudos

Hi all, I have to change a purchasing group of a purchase requisition number, I tried with the above bapi but I am getting a run time error as type conflict.

REPORT ZPRCHANGE .

DATA : I_ITEM LIKE BAPIEBAN OCCURS 0 WITH HEADER LINE,

I_OLD LIKE BAPIEBANV OCCURS 0 WITH HEADER LINE,

I_NEW LIKE BAPIEBANV OCCURS 0 WITH HEADER LINE,

I_return LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE.

DATA : W_MSG TYPE STRING.

CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'

EXPORTING

NUMBER = '0010003246'

  • ACCOUNT_ASSIGNMENT = ' '

  • ITEM_TEXTS = ' '

  • SERVICES = ' '

  • SERVICE_TEXTS = ' '

TABLES

REQUISITION_ITEMS = I_ITEM.

  • REQUISITION_ACCOUNT_ASSIGNMENT =

  • REQUISITION_TEXT =

  • REQUISITION_LIMITS =

  • REQUISITION_CONTRACT_LIMITS =

  • REQUISITION_SERVICES =

  • REQUISITION_SERVICES_TEXTS =

  • REQUISITION_SRV_ACCASS_VALUES =

  • RETURN =

.

move-corresponding I_ITEM TO I_OLD.

MOVE-CORRESPONDING I_ITEM TO I_NEW.

APPEND I_OLD.

APPEND I_NEW.

LOOP AT I_NEW.

I_NEW-PUR_GROUP = '002'.

MODIFY I_NEW.

ENDLOOP.

CALL FUNCTION 'BAPI_REQUISITION_CHANGE'

EXPORTING

NUMBER = '0010000003'

TABLES

REQUISITION_ITEMS_OLD = I_OLD

REQUISITION_ITEMS_NEW = I_NEW

  • REQUISITION_ACCOUNT_OLD =

  • REQUISITION_ACCOUNT_NEW =

  • REQUISITION_TEXT_OLD =

  • REQUISITION_TEXT_NEW =

  • RETURN =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

IMPORTING

RETURN = i_return.

LOOP AT i_return.

WRITE 😕 I_RETURN-MESSAGE.

  • CALL FUNCTION 'FORMAT_MESSAGE'

  • EXPORTING

    • ID = return-id

    • LANG = '-D'

    • NO = RETURN-NUMBER

  • V1 = i_return-message_v1

  • V2 = i_return-message_v2

  • V3 = i_return-message_v3

  • V4 = i_return-message_v4

*

  • IMPORTING

  • MSG = W_MSG

    • EXCEPTIONS

    • NOT_FOUND = 1

    • OTHERS = 2

  • .

  • IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*WRITE : / W_MSG.

thanks

regards

johny

Accepted Solutions (0)

Answers (1)

Answers (1)

messier31
Active Contributor
0 Kudos

Hi,

Make I_RETURN as of type <b>BAPIRET2</b> instead of BAPIRETURN.

Enjoy SAP.

Pankaj Singh.

Former Member
0 Kudos

Hi pankaj , thanks for your help, I made the change as you suggested but still the purchasing group has not changed in the database...

thanks

regards

john

messier31
Active Contributor
0 Kudos

Hi,

what messages you get in I_return table ?

Enjoy SAP.

Pankaj Singh.

Former Member
0 Kudos

Hi, I am not getting any messages as the output, infact I still remain in the editor itself....

messier31
Active Contributor
0 Kudos

Hi,

1. Put a break point at Loop at i_return and see what messages you get after transaction commit bapi call.

and if that is ok.. then

2. Make use of RETURN parameter of BAPI_REQUISITION_CHANGE bapi call to see if it was executed correctly. Idealy this shud be check for every bapi call. it tells how successfully the bapi call was.

EnjoySAP.

Pankaj Singh.