Skip to Content
0
Jun 03, 2013 at 12:27 PM

Open pr deletion related problem

48 Views

Hi all,

i have written a program through BAPI, to delete all the open PR,but i am not getting what i need.

Can any body help me,here is the code i have written...

REPORT ZPR_DELETION.

DATA : return like bapiret2 occurs 0 with header line,

pritem like bapimereqitemimp occurs 0 with header line,

pritemx like bapimereqitemx occurs 0 with header line.

PARAMETERS :p_requi like bapimereqheader-preq_no,

p_item like bapimereqitemimp-preq_item,

p_qty like bapimereqitemimp-quantity,

p_plant like bapimereqitemimp-plant,

p_text like bapimereqitemimp-short_text.

START-OF-SELECTION.

pritem-preq_item = p_item.

pritem-delete_ind = 'X'.

append pritem.

pritemx-preq_item = p_item.

pritemx-delete_ind = 'X'.

append pritemx.

CALL FUNCTION 'BAPI_PR_CHANGE'

EXPORTING

NUMBER = p_requi

* PRHEADER =

* PRHEADERX =

* TESTRUN =

* IMPORTING

* PRHEADEREXP =

TABLES

RETURN = return

PRITEM = pritem

PRITEMX = pritemx

* PRITEMEXP =

* PRITEMSOURCE =

* PRACCOUNT =

* PRACCOUNTPROITSEGMENT =

* PRACCOUNTX =

* PRADDRDELIVERY =

* PRITEMTEXT =

* PRHEADERTEXT =

* EXTENSIONIN =

* EXTENSIONOUT =

* PRVERSION =

* PRVERSIONX =

* ALLVERSIONS =

.

CALL FUNCTION 'BAPI_REQUISITION_DELETE'

EXPORTING

NUMBER =

TABLES

REQUISITION_ITEMS_TO_DELETE = 'X'.

RETURN =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

* IMPORTING

* RETURN =

.

END-OF-SELECTION.

LOOP AT RETURN.

WRITE:/ return-message.

ENDLOOP.