Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Add Relations in Operation using 'BAPI_ALM_ORDER_MAINTAIN'

shilpi-a
Explorer
0 Kudos

Hi Experts,

My scenario is to add Relationship in operation available in IW32 using bapi - BAPI_ALM_ORDER_MAINTAIN

             ls_methods-refnumber = 000000
             ls_methods-method 'SAVE'.
             ls_methods-objectkey = 000004000001.
             APPEND ls_methods TO lt_methods.

             ls_methods-refnumber = 000001.
             ls_methods-objecttype 'RELATION'.
             ls_methods-method 'CREATE'.
            ls_methods-objectkey = 00000400000100200000040000010030.
             APPEND ls_methods TO lt_methods.

             ls_operations-activity = 0030.
             APPEND ls_operations TO lt_operations.

             ls_operations_up-activity 'X'.
             APPEND ls_operations_up TO lt_operations_up.

             ls_relation-order_predecessor = 000004000001.
             ls_relation-operation_predecessor = 0020.
             ls_relation-order_successor = 000004000001.
             ls_relation-operation_successor = 0030.
             ls_relation-relation_type 'FS'.
             ls_relation-duration_relation_unit 'H'.
             APPEND ls_relation TO lt_relation.

             ls_relation_up-order_predecessor 'X'.
             ls_relation_up-operation_predecessor 'X'.
             ls_relation_up-order_successor 'X'.
             ls_relation_up-operation_successor 'X'.
             ls_relation_up-relation_type 'X'.
             ls_relation_up-duration_relation_unit 'X'.
             APPEND ls_relation_up TO lt_relation_up.

             CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
               TABLES
                 it_methods      lt_methods
                 it_operation    lt_operations
                 it_operation_up lt_operations_up
                 it_relation     lt_relation
                 it_relation_up  lt_relation_up
                 return          lt_return.

if i pass  ls_relation-relation_type 'FS'. then i get error - Relationship type FS could not be converted to the internal format.
I checked some blogs where thy said to add conversion routine and change it to 'NF'. did that and it gave errors: CN 801 Activity "0020" does not exist in network "000004000001".

Why its treating maintenance order as Network. It works when i directly execute this bapi, but when i add this in my report then i get above errors. Want Relations to get added like :

shilpia_1-1710252585826.png

Need your expertise in resolving this.

Thanks

0 REPLIES 0