Skip to Content
avatar image
Former Member

Sample code to map GOA conditions into BE conditions

Hello all: we have to implement GOAs and we know we have to implement BadIs to map conditions. We would like to know:

1.- Which BAdI is exactly needed to map conditions (BBP_CTR_BE_CREATE in SRM or BBP_CTR in BE)

2.- Can anybody send us a sample code where we can see how it can be done? (according to some message posted, SRM 5.0 has sample code but we can not find it)

Thanks in advance.

Best regards

Valentí

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jul 10, 2006 at 01:42 PM

    Hi Valentín,

    1- it depends on what you need to do and where is the logic/data

    2- Here is SRM 5.0 sample code

    method IF_EX_BBP_CTR_BE_CREATE~CONTRACT_INTERFACE_FILL .

    • Sample coding for METHOD contract_interface_fill

    • This is an example on how the mapping of condition types for

    • service items can be programmed. The order in which the loops occur is

    • very important.

    DATA: ls_be_items TYPE bbps_ctr_item,

    ls_be_cnd_ct TYPE bbpbapicondct,

    ls_cnd_hd TYPE bbpbapicondhd,

    ls_cnd_it TYPE bbpbapicondit,

    ls_cnd_qs TYPE bbpbapicondqs,

    ls_cnd_vs TYPE bbpbapicondvs,

    varkey LIKE ls_be_cnd_ct-varkey.

    DATA: BEGIN OF ls_mapping ,

    cond_type_old TYPE kscha,

    cond_type_new TYPE kscha,

    END OF ls_mapping.

    DATA: lt_mapping LIKE TABLE OF ls_mapping.

    • data declarations to remember which entry in a table needs to be

    • modified

    DATA: lv_tabix_ct TYPE sy-tabix,

    lv_tabix_hd TYPE sy-tabix,

    lv_tabix_it TYPE sy-tabix.

    • specify the mapping of condidition types. SRM condition types

    • (cond_type_old) is mapped to the backend condtion types

    • (cond_type_new)

    ls_mapping-cond_type_old = '01CT'.

    ls_mapping-cond_type_new = 'PRS'.

    APPEND ls_mapping TO lt_mapping.

    ls_mapping-cond_type_old = '01RP'.

    ls_mapping-cond_type_new = 'ZA00'.

    APPEND ls_mapping TO lt_mapping.

    • go through all service items (product_type 01 = normal material,

    • product_type 02 = service)

    LOOP AT ct_be_items INTO ls_be_items

    WHERE product_type = 02.

    MOVE ls_be_items-object_id TO varkey.

    MOVE ls_be_items-number_int5 TO varkey10.

    • start with the main condition table

    LOOP AT ct_be_cnd_ct INTO ls_be_cnd_ct

    WHERE varkey = varkey.

    lv_tabix_ct = sy-tabix.

    READ TABLE lt_mapping INTO ls_mapping

    WITH KEY cond_type_old = ls_be_cnd_ct-cond_type.

    IF sy-subrc = 0.

    • condition is found where changes to the condition_type mapping

    • should occur

    LOOP AT ct_be_cnd_hd INTO ls_cnd_hd

    WHERE ( cond_no EQ ls_be_cnd_ct-cond_no ) AND

    ( cond_type EQ ls_be_cnd_ct-cond_type AND

    varkey EQ ls_be_cnd_ct-varkey ).

    lv_tabix_hd = sy-tabix.

    LOOP AT ct_be_cnd_it INTO ls_cnd_it

    WHERE ( itm_number EQ ls_cnd_hd-itm_number ) AND

    ( cond_no EQ ls_cnd_hd-cond_no ).

    lv_tabix_it = sy-tabix.

    LOOP AT ct_be_cnd_qs INTO ls_cnd_qs

    WHERE ( itm_number EQ ls_cnd_it-itm_number ) AND

    ( cond_no EQ ls_cnd_it-cond_no ).

    • changes to quantity scales can be done here

    ENDLOOP.

    LOOP AT ct_be_cnd_vs INTO ls_cnd_vs

    WHERE ( itm_number EQ ls_cnd_it-itm_number ) AND

    ( cond_no EQ ls_cnd_it-cond_no ).

    • changes to value scales can be done here

    ENDLOOP.

    ls_cnd_it-cond_type = ls_mapping-cond_type_new.

    MODIFY ct_be_cnd_it FROM ls_cnd_it INDEX lv_tabix_it.

    ENDLOOP.

    ls_cnd_hd-cond_type = ls_mapping-cond_type_new.

    • all modifies to ct_be_cnd_hd should be done here

    MODIFY ct_be_cnd_hd FROM ls_cnd_hd INDEX lv_tabix_hd.

    ENDLOOP.

    ENDIF.

    ls_be_cnd_ct-cond_type = ls_mapping-cond_type_new.

    MODIFY ct_be_cnd_ct FROM ls_be_cnd_ct INDEX lv_tabix_ct.

    ENDLOOP.

    ENDLOOP.

    endmethod.

    Rgds

    Christophe

    PS: please reward points for helpful answers

    Add comment
    10|10000 characters needed characters exceeded