Skip to Content

The purpose of this document is for adding,updating a custom field to the workmanager application and download to the mobile device.

Step I: ERP Changes

1. Goto WorkOrder master table  AUFK and click on the existing .include Structure CI_AUFK to add Custom field.

/wp-content/uploads/2014/05/p1_445744.png

2. Adjust the modified standard table in SE14. Click on Active and Adjust Database.

P2.png3. Go to SE37. Enter the related BAPI name “/SYCLO/PM_DOWORKORDER2_GET” display and check the table parameter  ET_WORKORDER_HEADER.

P3.png

4. Check  whether the table parameter ET_WORKORDER_HEADER type /SYCLO/PM_CAUFV_STR reflects the new field

P4.png

5. Now the custom field should be updated in a standard way,for this the BADI ‘IBAPI_ALM_ORD_MODIFY‘ can  be implemented


  • Execute the transaction code se11.Select the radio button ‘Data type’.Enter the structure name ‘IBAPI_CAUFVD_UPDATE’.Click on ‘Display’

P5.png

  • Click on ‘Append Structure’ .Click on ‘Create’ icon .Provide  the append structure name and press enter.Add the required field to be included in the              structure with data type ‘BAPIUPDATE’ and activate the structure and tableP6.png
  • Execute the transaction code ‘SE18’ .Select the radio button ‘BADI Name’ .Enter the BADI ‘IBAPI_ALM_ORD_MODIFY’.

P7.png

  • Click on ‘Enhancement Implementation’.Select ‘Create’

/wp-content/uploads/2014/05/p8_445754.png

  • Provide the implementation name.Press enter

P9.png


  • Implement the required logic for updating the field and activate the implementation

P10.png

  • Execute the transaction code’SE38’ and create a program with the following code

SELECTION-SCREEN BEGIN OF block blk with FRAME title text001.

PARAMETERS:p_aufnr type aufnr.

SELECTION-SCREEN end of BLOCK blk.

DATA: WA_METHODS TYPE BAPI_ALM_ORDER_METHOD,

       ITAB_METHODS LIKE TABLE OF WA_METHODS.

DATA: ITAB_RETURN TYPE TABLE OF BAPIRET2 WITH HEADER LINE,

           ITAB_NUMBERS TYPE TABLE OF BAPI_ALM_NUMBERS WITH HEADER LINE,

          OBJECT_TAB TYPE TABLE OF  BAPI_ALM_ORDER_HEADERS_I WITH HEADER LINE,

          WA_OBJECT_TAB  LIKE BAPI_ALM_ORDER_HEADERS_I ,

           OBJECT_TAB_UP  TYPE TABLE OF BAPI_ALM_ORDER_HEADERS_UP WITH HEADER LINE. .

DATA: Z_EXTENSION_IN TYPE TABLE OF BAPIPAREX WITH HEADER LINE.

DATA:ORDER_ID        TYPE AUFNR,

          WA_BAPI_TE_AUFK TYPE BAPI_TE_AUFK.

ORDER_ID = p_aufnr.                   ““‘000000819754’.          ” Example

Z_EXTENSION_INSTRUCTURE = ‘BAPI_TE_AUFK’.

WA_BAPI_TE_AUFKORDERID = ORDER_ID. ” Order ID

WA_BAPI_TE_AUFKDUMMY_CI_AUFK  = ‘X’.      ” Custom field

WA_BAPI_TE_AUFKZZXY  = ‘X’.      ” Custom field

Z_EXTENSION_INVALUEPART1(12)   = WA_BAPI_TE_AUFKORDERID.

Z_EXTENSION_INVALUEPART1+12(1= WA_BAPI_TE_AUFKDUMMY_CI_AUFK.

Z_EXTENSION_INVALUEPART1+13(1= WA_BAPI_TE_AUFKZZXY.

APPEND Z_EXTENSION_IN.

CLEAR Z_EXTENSION_IN.

OBJECT_TABORDERID p_aufnr.                 “‘000000819754’.

OBJECT_TABPRIORITY = ‘1’.

***object_tab-MN_WK_CTR = ‘ ‘.

APPEND OBJECT_TAB.

***

CLEAR WA_METHODS.

WA_METHODSREFNUMBER = ‘000001’.

WA_METHODSOBJECTTYPE = ‘HEADER’.

WA_METHODSMETHOD = ‘CHANGE’.

WA_METHODSOBJECTKEY p_aufnr.                   “‘000000819754’.

APPEND WA_METHODS TO ITAB_METHODS.

CLEAR  WA_METHODS.

*WA_METHODS-REFNUMBER = 1.

WA_METHODSOBJECTTYPE = SPACE.

WA_METHODSMETHOD = ‘SAVE’.

WA_METHODSOBJECTKEY = SPACE.

APPEND WA_METHODS TO ITAB_METHODS.

CALL FUNCTION ‘BAPI_ALM_ORDER_MAINTAIN’

   TABLES

     IT_METHODS   = ITAB_METHODS

     IT_HEADER    = OBJECT_TAB

     IT_HEADER_UP = OBJECT_TAB_UP

     EXTENSION_IN = Z_EXTENSION_IN

     RETURN       = ITAB_RETURN

     ET_NUMBERS   = ITAB_NUMBERS.

IF SYSUBRC = 0.

   DATA : RETURN TYPE BAPIRET2.

   CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’

     EXPORTING

       WAIT = ‘X’.

*        IMPORTING

*          RETURN        = return  .

   IF SYSUBRC = 0.

*    read table it_wmdvex into wa_wmdvex index 1.

     WRITE: ‘Successful’.

   ELSE.

     WRITE: / ‘No data changed’.

   ENDIF.

ENDIF.

  • Execute the program by giving a valid work order number

P11.png

  • Execute the transaction code ‘SE11’.Enter table name .Click on ‘Display’.Click on ‘Contents’.Enter the ‘Order ID’ number that is updated through program.Click on ‘Execute’.Check that the field is updated with value ‘X’


P12.png

All the above steps will add the custom field to the standard table and update it through the badi implementation

Step II:Config Panel Changes


1. Run the T-code ‘/n/syclo/configpanel’ to open the agentry SAP Framework Configuration

P13.png

2. Go to Mobile Data Object Configuration under Mobile Integration Settings. Expand the Standard Data  Object

P14.png

3. Select the appropriate data object “ SWM53_WORKORDER_GENERIC” and select ResultSet Field Selection tab

P15.png

4. Expand the Field Catalog to select the corresponding table and drill down that table and check the “Field active” check box for the custom field

P16.png

Step III: Agentry Changes


1.Go to agentry front end application. Add new property in “WorkOrder” Object

P17.png

2. Add the new property to the “WorkOrder” List Screen to display the field

P18.png

Step IV: Java Code Changes


1. Go to WorkOrder.java and do the necessary changes as follows


P19.png

P20.png

Step V: Publish the application,restart the server,reset the agentry test environment in order to see the changes and mobile device

P21.png

P22.png

To report this post you need to login first.