BAPI_WARRANTYCLAIM_ADD_VERSION

i wolud like to know how to use this bapi to change decision code.
example: old decision code = 10
               new decision code = 92
for this how to use this bapi and also which are other mandatory fields that i need to pass
sample code which clears my above doubt

hi,
Check this code...
FUNCTION z_wy_sv_bapi_crt_chg_claim .
""Local Interface:
*"  IMPORTING
*"     VALUE(I_CLAIM_HEADER) TYPE  ZWY_SV_CLAIMHEADER
*"     VALUE(I_WTY_INTERNAL_ORDER) TYPE  BAPI2075_7
*"  EXPORTING
*"     VALUE(E_CLAIM) TYPE  ZWY_SV_CLAIMHEADER-CLAIM
*"     VALUE(E_CLAIM_TMP_IDENT) TYPE
*"        ZWY_SV_CLAIMHEADER-CLAIM_TMP_IDENT
*"  TABLES
*"      T_CLAIM_VERSION STRUCTURE  BAPI2222VERSION OPTIONAL
*"      T_CLAIM_ITEM STRUCTURE  BAPI2222ITEM OPTIONAL
*"      T_CLAIM_ITEM_LABOUR STRUCTURE  ZWY_SV_CLAIMLABITEM OPTIONAL
*"      T_CLAIM_TEXT STRUCTURE  BAPI2222LONGTEXT OPTIONAL
*"      T_CLAIM_MEASURE STRUCTURE  BAPI2222MEASURE OPTIONAL
*"      T_CLAIM_PRICING STRUCTURE  BAPI2222PRICING OPTIONAL
*"      T_VERSION_REL STRUCTURE  BAPI2222VERSIONRELATION OPTIONAL
*"      T_ITEM_REL STRUCTURE  BAPI2222ITEMRELATION OPTIONAL
*"      T_RETURN2 STRUCTURE  BAPIRET2
*"      T_EXTENSIONIN STRUCTURE  BAPIPAREX OPTIONAL
*"      T_CLAIM_PARTNER STRUCTURE  BAPI2222PARTNER OPTIONAL
*"      T_WTY_RCLOBJ STRUCTURE  WTY_RCLOBJ OPTIONAL
*"      T_SRULES STRUCTURE  BAPI2075_6 OPTIONAL
Internal tables
  DATA    : it_pnguid TYPE wty_pnguid_tab,
            it_rclobj TYPE STANDARD TABLE OF wty_rclobj.
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
Internal table declaration
  DATA:
    lt_claim_version     TYPE STANDARD TABLE OF bapi2222version,
    lt_claim_item        TYPE STANDARD TABLE OF bapi2222item,
    lt_claim_version_chg TYPE STANDARD TABLE OF bapi2222versionchange,
    lt_claim_item_chg    TYPE STANDARD TABLE OF bapi2222itemchange.
Structure declaration
  DATA
    ls_claim_header  TYPE bapi2222headerchange.
Variable declaration
  DATA
    l_msgno  TYPE bapiret2-number.
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
Refreshing internal tables
  REFRESH : it_pnguid,
            it_rclobj.
Pefrom to clear all variables
  PERFORM clear_variables.
Perform for Maintaing Claim Header Z* fields
  PERFORM maintain_claimheader   TABLES t_extensionin
                                  USING i_claim_header
                               CHANGING wa_extension.
Begin of delete By MC41070, SM: 1009317, Date: 03/14/2008
MODIFY claim_header SAP Fields
wa_claim_header1-handle       = c_0000000001.
wa_claim_header1-claim_type   = i_claim_header-claim_type.
wa_claim_header1-ext_no       = i_claim_header-ext_no.
wa_claim_header1-servdate     = i_claim_header-servdate.
wa_claim_header1-descriptn    = i_claim_header-descriptn.
wa_claim_header1-recall_date  = i_claim_header-recall_date.
wa_claim_header1-pro_state    = i_claim_header-pro_state.
Moving labour item data to claim item data.
LOOP AT t_claim_item_labour INTO wa_claim_item_lab.
   MOVE wa_claim_item_lab TO wa_claim_item.
   APPEND wa_claim_item TO t_claim_item.
ENDLOOP.
MODIFY claim_version
wa_claim_version-handle   = c_0000000001.
wa_claim_version-category = 'IC'.
APPEND wa_claim_version TO t_claim_version.
Moving version item data to claim item data.
CLEAR wa_claim_item.
LOOP AT t_claim_item INTO wa_claim_item.
   wa_claim_item-handle         = c_0000000001.
   wa_claim_item-handle_version = c_0000000001.
   MODIFY t_claim_item FROM wa_claim_item INDEX sy-tabix.
ENDLOOP.
End of delete By MC41070, SM: 1009317, Date: 03/14/2008
  REFRESH t_return2.
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
  CLEAR e_claim.
Select qery to check existence of claim number to create or
change claim data
  SELECT SINGLE clmno
           FROM pnwtyh
           INTO e_claim
          WHERE refno        EQ i_claim_header-ext_no
            AND zz_prefix_no EQ i_claim_header-zzprefix_no.
  IF sy-subrc NE 0.
    CLEAR wa_claim_header1.
  Modify claim_header SAP Fields
    wa_claim_header1-handle       = c_0000000001.
    wa_claim_header1-claim_type   = i_claim_header-claim_type.
    wa_claim_header1-ext_no       = i_claim_header-ext_no.
    wa_claim_header1-servdate     = i_claim_header-servdate.
    wa_claim_header1-descriptn    = i_claim_header-descriptn.
    wa_claim_header1-recall_date  = i_claim_header-recall_date.
    wa_claim_header1-pro_state    = i_claim_header-pro_state.
  Append claim_version
    wa_claim_version-handle   = c_0000000002.
    wa_claim_version-category = 'IC'.
    wa_claim_version-version  = '001'.
    wa_claim_version-active   = 'X'.
    APPEND wa_claim_version TO t_claim_version.
    CLEAR wa_claim_version.
    gv_handle   = '0000000003'.
  Moving Part item data to claim item data.
    CLEAR wa_claim_item.
    LOOP AT t_claim_item INTO wa_claim_item.
      wa_claim_item-handle         = gv_handle.
      wa_claim_item-handle_version = c_0000000002.
      MODIFY t_claim_item FROM wa_claim_item INDEX sy-tabix.
      gv_handle = gv_handle + 1.
    ENDLOOP.                           " LOOP AT t_claim_item INTO...
  Moving labour item data to claim item data.
    LOOP AT t_claim_item_labour INTO wa_claim_item_lab.
      MOVE wa_claim_item_lab TO wa_claim_item.
      wa_claim_item-handle         = gv_handle.
      wa_claim_item-handle_version = c_0000000002.
      APPEND wa_claim_item TO t_claim_item.
      gv_handle = gv_handle + 1.
    ENDLOOP.                           " LOOP AT t_claim_item_labour...
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
  Calling function module for warrantyclaim create
    CALL FUNCTION 'BAPI_WARRANTYCLAIM_CREATE'
      EXPORTING
        claim_header         = wa_claim_header1
      simulate             = ' '
      IMPORTING
        claim                = e_claim
        claim_tmp_ident      = e_claim_tmp_ident
      TABLES
        claim_version        = t_claim_version
        claim_item           = t_claim_item
        claim_text           = t_claim_text
        claim_measure        = t_claim_measure
        claim_pricing        = t_claim_pricing
        version_rel          = t_version_rel
        item_rel             = t_item_rel
        return2              = t_return2
        extensionin          = t_extensionin
        claim_partner        = t_claim_partner.
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
    l_msgno  = '806'.
    sy-msgno = '806'.
    sy-msgv2 = e_claim.
  ELSE.
    CLEAR e_claim.
  Select qery to check existence of claim number to create or
  change claim data
    SELECT SINGLE clmno
             FROM pnwtyh
             INTO e_claim
            WHERE refno        EQ i_claim_header-ext_no
              AND ( astate     NE 'ZPST'
              AND   astate     NE 'ZPTE' )
              AND zz_prefix_no EQ i_claim_header-zzprefix_no.
    IF sy-subrc EQ 0.
    Function module to read claim data
      CALL FUNCTION 'WTY12_CLAIM_READ'
        EXPORTING
          claim         = e_claim
        TABLES
          claim_version = lt_claim_version
          claim_item    = lt_claim_item.
    Modify claim_header SAP Fields
      ls_claim_header-handle       = c_0000000001.
      ls_claim_header-ext_no       = i_claim_header-ext_no.
      ls_claim_header-servdate     = i_claim_header-servdate.
      ls_claim_header-descriptn    = i_claim_header-descriptn.
      ls_claim_header-recall_date  = i_claim_header-recall_date.
      ls_claim_header-pro_state    = i_claim_header-pro_state.
      CLEAR wa_claim_version.
    Reading ciam version data
      READ TABLE lt_claim_version INTO wa_claim_version INDEX 1.
      IF sy-subrc EQ 0.
      Perform to fill with version data to modify
        PERFORM fill_version_change TABLES lt_claim_version_chg.
      ENDIF.                             " IF sy-subrc EQ 0
      CLEAR wa_claim_item.
    Loop for existing claim item data to delete
      LOOP AT lt_claim_item INTO wa_claim_item.
        wa_claim_item-handle_version = c_0000000002.
      Perform to fill with item data to delete
        PERFORM fill_item_change TABLES lt_claim_item_chg
                                  USING 'X'.
      ENDLOOP.                           " LOOP AT lt_claim_item INTO wa_.....
      gv_handle   = '0000000003'.
    Moving Part item data to claim item data for creating.
      CLEAR wa_claim_item.
      LOOP AT t_claim_item INTO wa_claim_item.
        wa_claim_item-handle         = gv_handle.
        wa_claim_item-handle_version = c_0000000002.
      Perform to fill with item data to create
        PERFORM fill_item_change TABLES lt_claim_item_chg
                                  USING space.
        gv_handle = gv_handle + 1.
      ENDLOOP.                           " LOOP AT t_claim_item INTO wa_.....
    Moving labour item data to claim item data for creating.
      LOOP AT t_claim_item_labour INTO wa_claim_item_lab.
        MOVE wa_claim_item_lab TO wa_claim_item.
        wa_claim_item-handle         = gv_handle.
        wa_claim_item-handle_version = c_0000000002.
      Perform to fill with item data to create
        PERFORM fill_item_change TABLES lt_claim_item_chg
                                  USING space.
        gv_handle = gv_handle + 1.
      ENDLOOP.                           " LOOP AT t_claim_item_labour....
    Calling function module for warrantyclaim change
      CALL FUNCTION 'BAPI_WARRANTYCLAIM_CHANGE2'
        EXPORTING
          claim         = e_claim
          claim_header  = ls_claim_header
          badi_change   = 'X'
        TABLES
          claim_version = lt_claim_version_chg
          claim_item    = lt_claim_item_chg
          claim_text    = t_claim_text
          claim_measure = t_claim_measure
          claim_pricing = t_claim_pricing
          version_rel   = t_version_rel
          item_rel      = t_item_rel
          return        = t_return2
          extensionin   = t_extensionin.
      l_msgno  = '102'.
      sy-msgno = '102'.
      sy-msgv1 = e_claim.
    ENDIF.                             " IF sy-subrc EQ 0
  ENDIF.                               " IF sy-subrc NE 0
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
Delete Warnning messages form t_return2.
  DELETE t_return2 WHERE type = 'W'.   " AND Changed By MC41070, SM: 1009317
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
                          id = 'WTY' AND
                      number = '0001'.
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
  CHECK NOT e_claim IS INITIAL.
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
Calling function module for transaction commit
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait   = 'X'
    IMPORTING
      return = wa_ret1.
  IF wa_ret1-type NE 'E'.
  Get the GUID of created claim from the BAPI from the table PNWTYH
    SELECT SINGLE pnguid FROM pnwtyh INTO g_pnguid WHERE clmno = e_claim.
    APPEND g_pnguid TO it_pnguid.
    it_rclobj[] = t_wty_rclobj[].
    LOOP AT it_rclobj INTO wa_rclobj.
      g_id = g_id + 1.
      wa_rclobj-pnguid_rcl = g_pnguid.
      wa_rclobj-id         = g_id.
      MODIFY it_rclobj FROM wa_rclobj INDEX sy-tabix.
    ENDLOOP.
  Call the FM PVSDBWTY_RCLOBJ_SAVE to save the recall objects to the claim
    CALL FUNCTION 'PVSDBWTY_RCLOBJ_SAVE'
      EXPORTING
        it_pnguid     = it_pnguid
        it_wty_rclobj = it_rclobj.
    IF i_claim_header-pro_state NE 'ZPNE' OR i_claim_header-pro_state NE 'ZPRP'.
      IF it_zwysvbrmast[] IS INITIAL.
      Fetching data from Branch Master table
        SELECT *
          FROM zwy_svbrmast
          INTO TABLE it_zwysvbrmast
          WHERE branch NE '00'.
      ENDIF.                             " IF sy-subrc EQ 0
      LOOP AT it_zwysvbrmast INTO wa_zwysvbrmast.
      Filling PIP branch data
        MOVE:
          e_claim                TO wa_zwysvpipbranch-clmno,
          wa_zwysvbrmast-branch  TO wa_zwysvpipbranch-branch,
          sy-datum               TO wa_zwysvpipbranch-reldate.
        APPEND wa_zwysvpipbranch TO it_zwysvpipbranch.
      ENDLOOP.                           " LOOP AT it_zwysvbrmast_sel INTO wa_zwysvbrmast
    Check for claim number and branch pip data not initial
      IF  NOT it_zwysvpipbranch[] IS INITIAL AND NOT wa_zwysvpipbranch-clmno IS INITIAL.
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
        DELETE FROM zwy_svpipbranch WHERE clmno EQ e_claim.
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
        MODIFY zwy_svpipbranch FROM TABLE it_zwysvpipbranch.
      ENDIF.
    Handling IDOC Messages .
      REFRESH t_return2.
      CLEAR wa_return.
Begin of delete By MC41070, SM: 1009317, Date: 03/14/2008
     sy-msgv2 = e_claim.
End of delete By MC41070, SM: 1009317, Date: 03/14/2008
  Perform to set return structure
      PERFORM bapireturn_fill_1 USING    sy-msgid
                                         sy-msgno
                                         sy-msgv1
                                         sy-msgv2
                                         sy-msgv3
                                         sy-msgv4
                                CHANGING wa_return.
      t_return2-type       = 'S'.
      t_return2-id         = 'WTY'.
      t_return2-number     = l_msgno.          " '806'. Changed By MC41070, SM: 1009317
      t_return2-message    = wa_return-message.
      t_return2-message_v1 = sy-msgv1. " wa_return-message_v1. Changed By MC41070, SM: 1009317
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
      t_return2-message_v2 = sy-msgv2.
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
      APPEND t_return2.
    ENDIF.                                        "IF sy-subrc NE 0.
  ENDIF.
ENDFUNCTION.
FORM maintain_claimheader   TABLES p_t_extensionin STRUCTURE  bapiparex
                             USING p_i_claim_header TYPE zwy_sv_claimheader
                          CHANGING p_wa_extension TYPE bapiparex.
Maintain claim_header Z* fields.
SM 1005027/1005028 -  Begin PU00164
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZPIP_EXP_DT'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_exp_dt_na.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
p_wa_extension-structure   =   c_wty_pnwtyh_cust.
p_wa_extension-valuepart1  =   'ZZPIP_EXP_DT_RII'.
p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_exp_dt_rii.
p_wa_extension-valuepart3  =   c_0000000001.
APPEND p_wa_extension TO p_t_extensionin.
p_wa_extension-structure   =   c_wty_pnwtyh_cust.
p_wa_extension-valuepart1  =   'ZZPIP_EXP_DT_RI'.
p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_exp_dt_ri.
p_wa_extension-valuepart3  =   c_0000000001.
APPEND p_wa_extension TO p_t_extensionin.
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZPIP_TER_DT'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_ter_dt_na.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
p_wa_extension-structure   =   c_wty_pnwtyh_cust.
p_wa_extension-valuepart1  =   'ZZPIP_TER_DT_RII'.
p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_ter_dt_rii.
p_wa_extension-valuepart3  =   c_0000000001.
APPEND p_wa_extension TO p_t_extensionin.
p_wa_extension-structure   =   c_wty_pnwtyh_cust.
p_wa_extension-valuepart1  =   'ZZPIP_TER_DT_RI'.
p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_ter_dt_ri.
p_wa_extension-valuepart3  =   c_0000000001.
APPEND p_wa_extension TO p_t_extensionin.
SM 1005027/1005028 -  End PU00164
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZPIP_TKD_IND'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_tkd_ind.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZPIP_PRTCPNT'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_prtcpnt.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZPIP_INC_MT_IND'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_inc_mt_ind.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZPIP_TRVL_IND'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_trvl_ind.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZPIP_TYPE'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzpip_type.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
Begin of insert By MC41070, SM: 1009317, Date: 03/14/2008
  p_wa_extension-structure   =   c_wty_pnwtyh_cust.
  p_wa_extension-valuepart1  =   'ZZ_PREFIX_NO'.
  p_wa_extension-valuepart2  =   p_i_claim_header-zzprefix_no.
  p_wa_extension-valuepart3  =   c_0000000001.
  APPEND p_wa_extension TO p_t_extensionin.
End of insert By MC41070, SM: 1009317, Date: 03/14/2008
ENDFORM.                    " maintain_claimheader

Similar Messages

  • How to use BAPI to add a new version for a claim number in WTY transaction.

    How to use BAPI to add a new version for a claim number in WTY transaction.
    I am using  function module " BAPI_WARRANTYCLAIM_ADD_VERSION ".
    It needs to copy all contents of previous version to a new version.
    While doing so i am unable to copy fields like valic valoc etc. Any ways by which  i can copy this values.
    WTY will update PNWTYH , PNWTYV and PVWTY tables.
    Thanking you,
    Lokesh.

    Hi Vishnu,
    You can do that through EEWB. Please go through SAP Note 484597. You would get the details of using Easy Enhancement Work bench.
    Rewards point if you think this info is useful
    Regards,
    Dipender Singh

Maybe you are looking for

  • About My Mac is telling me that I'm using more space than I think I am

    Hi there, I've only had problems with storage once before, so I bought DaisyDisk and used it - it cleared out a lot of space and I loved it - this was months ago by the way. Then, I checked my storage today and suddenly my 'Apps' tab was taking up ab

  • Problem with "tile" effect in FCPX

    hello ! my problem is that FCPX renders unwanted "borders" (on both sides of the center column) while i use tiling (images below) please help. i have no idea where they came from or how to get rid of them. these lines are messing with my whole projec

  • Project server new resource Customization and Programming

    hi how to add categories(like My Tasks, My Resources) for a new resource programmatically in project server 2010?

  • Is encore included in premiere cc 2014?

    Is encore included in premiere cc 2014? If not, is there a new way to download premiere cs6 that came with encore through the creative cloud download manager?

  • Swf to flv?

    Does anyone know how to convert a swf to a flv? or even fla to flv?