Skip to Content
0
Jul 02, 2007 at 05:21 AM

Bapi - BAPI_ALM_ORDER_MAINTAIN

2212 Views

Hi All,

I am using the BApi - BAPI_ALM_ORDER_MAINTAIN to change the workorder in the transaction - iw32. Actually my scenarion is to change the objects tab in the workorder. For the function location in the objects tab i need to put the Processing indicator to 'X' (checked).

This function module is executed, but it doesnot changed the value. any body have any idea reagarding this one? In methods paremater, what are all the parameters we should use?

Input - I should give - workorder number and function location structure ( counter, function location and processing indicator)

Initially functional location - processing indicator will be space.

ouput : so for that workorder it should change the processing indicator to 'X' for the functional location.

How to do this ?

-


check the following code

""Local Interface:

*" IMPORTING

*" VALUE(WORKORDER1) TYPE AUFNR OPTIONAL

*" EXPORTING

*" VALUE(WORKORDER) TYPE AUFNR

*" TABLES

*" FUNC_CHANGE STRUCTURE ZFUNC_CHANGE OPTIONAL

I used the following code..

DATA: HEAD LIKE BAPI_ALM_ORDER_HEADERS_I OCCURS 0 WITH HEADER LINE,

HEAD_X LIKE BAPI_ALM_ORDER_HEADERS_UP OCCURS 0 WITH HEADER LINE,

METHODS LIKE BAPI_ALM_ORDER_METHOD OCCURS 0 WITH HEADER LINE,

OPN LIKE BAPI_ALM_ORDER_OPERATION OCCURS 0 WITH HEADER LINE,

OPN_X LIKE BAPI_ALM_ORDER_OPERATION_UP OCCURS 0 WITH HEADER LINE,

RET LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,

OLIST LIKE BAPI_ALM_ORDER_OBJECTLIST OCCURS 0 WITH HEADER LINE,

OLIST_X LIKE BAPI_ALM_ORDER_OLIST_UP OCCURS 0 WITH HEADER LINE,

OLIST_RELATION LIKE BAPI_ALM_OLIST_RELATION OCCURS 0 WITH HEADER LINE.

DATA ET_NUMBERS LIKE BAPI_ALM_NUMBERS OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = WORKORDER1

IMPORTING

OUTPUT = WORKORDER1

.

METHODS-REFNUMBER = '000001' .

METHODS-OBJECTTYPE = 'HEADER'.

METHODS-METHOD = 'CHANGE'.

METHODS-OBJECTKEY = workorder1.

APPEND METHODS.

METHODS-REFNUMBER = '000001'.

METHODS-OBJECTTYPE = 'OBJECTLIST'.

METHODS-METHOD = 'CHANGE'.

METHODS-OBJECTKEY = workorder1. "'%00000000001'.

APPEND METHODS.

METHODS-REFNUMBER = '000001'.

METHODS-OBJECTTYPE = ' '.

METHODS-METHOD = 'SAVE'.

METHODS-OBJECTKEY = workorder1. "'%00000000001'.

APPEND METHODS.

CLEAR METHODS.

HEAD-ORDERID = WORKORDER1.

HEAD-ORDER_TYPE = 'PM01'.

APPEND HEAD.

CLEAR HEAD.

HEAD_X-ORDERID = WORKORDER1.

APPEND HEAD_X.

CLEAR HEAD_X.

LOOP AT FUNC_CHANGE.

OLIST-COUNTER = FUNC_CHANGE-counter.

OLIST-FUNCT_LOC = FUNC_CHANGE-FUNCT_LOC.

OLIST-PROCESSING_IND = 'X'.

APPEND OLIST.

CLEAR OLIST.

ENDLOOP.

  • OLIST_X-SORTFIELD = 'X'.

OLIST_X-PROCESSING_IND = 'X'.

APPEND OLIST_X.

CLEAR OLIST_X.

  • OLIST_RELATION-ACTIVITY = '0160'.

  • OLIST_RELATION-OBJECTLIST = '15'.

  • OLIST_RELATION-COUNTER = '16'.

  • APPEND OLIST_RELATION.

  • CLEAR OLIST_RELATION.

*

  • OLIST_RELATION-ACTIVITY = '0170'.

  • OLIST_RELATION-OBJECTLIST = '16'.

  • OLIST_RELATION-COUNTER = '17'.

*

  • APPEND OLIST_RELATION.

  • CLEAR OLIST_RELATION.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

IT_METHODS = METHODS

IT_HEADER = HEAD

IT_HEADER_UP = HEAD_X

IT_OBJECTLIST = OLIST

IT_OBJECTLIST_UP = OLIST_X

  • IT_OLIST_RELATION = OLIST_RELATION

RETURN = RET

ET_NUMBERS = ET_NUMBERS.

  • COMMIT WORK.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

READ TABLE ET_NUMBERS INDEX 1.

IF SY-SUBRC = 0 AND ET_NUMBERS-AUFNR_NEW NE '%00000000001'.

WORKORDER = ET_NUMBERS-AUFNR_NEW.

ELSE.

WORKORDER = 'Error'.

ENDIF.

Points will be awarded.

Regards,

vinoth