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: 

Activate RECN Contract (Flexible Real Estate)

former_member317781
Active Participant
0 Kudos

Hi Good Day,

I am trying to Activate the Contract from my ZPROGRAM.

is their any FM or BAPI'S to activate the contract.

I tried using BAPI_RE_CN_CHANGE but no success.

thank you,

J.

1 ACCEPTED SOLUTION

former_member317781
Active Participant
0 Kudos

DATA : it_status LIKE  JSTAT OCCURS 0.

DATA : wa_status LIKE JSTAT.



DATA : OBJNR  LIKE  JSTO-OBJNR.





    wa_status-stat = 'I0119'. " Status (ISTAT) found in table TJ02T.

    append wa_status to it_status.

    clear wa_status.



    wa_status-stat = 'I0002'.

    append wa_status to it_status.

    clear wa_status.



     wa_status-stat = 'I0064'.

     wa_status-INACT = 'X'.

   

    append wa_status to it_status.

    clear wa_status.



  OBJNR =   'ISTR030000001016923'.





CALL FUNCTION 'STATUS_CHANGE_INTERN'

  EXPORTING

*   CHECK_ONLY                = ' '

   CLIENT                    = SY-MANDT

    OBJNR                    = OBJNR

*   ZEILE                     = ' '

*   SET_CHGKZ                 =

* IMPORTING

*   ERROR_OCCURRED            =

*   OBJECT_NOT_FOUND          =

*   STATUS_INCONSISTENT       =

*   STATUS_NOT_ALLOWED        =

  TABLES

    STATUS                    = it_status

EXCEPTIONS

   OBJECT_NOT_FOUND          = 1

   STATUS_INCONSISTENT       = 2

   STATUS_NOT_ALLOWED        = 3

   OTHERS                    = 4.



IF SY-SUBRC EQ 0.

  CALL FUNCTION 'STATUS_UPDATE_DIALOG'.

  COMMIT WORK.

ENDIF.

4 REPLIES 4

former_member317781
Active Participant
0 Kudos

DATA : it_status LIKE  JSTAT OCCURS 0.

DATA : wa_status LIKE JSTAT.



DATA : OBJNR  LIKE  JSTO-OBJNR.





    wa_status-stat = 'I0119'. " Status (ISTAT) found in table TJ02T.

    append wa_status to it_status.

    clear wa_status.



    wa_status-stat = 'I0002'.

    append wa_status to it_status.

    clear wa_status.



     wa_status-stat = 'I0064'.

     wa_status-INACT = 'X'.

   

    append wa_status to it_status.

    clear wa_status.



  OBJNR =   'ISTR030000001016923'.





CALL FUNCTION 'STATUS_CHANGE_INTERN'

  EXPORTING

*   CHECK_ONLY                = ' '

   CLIENT                    = SY-MANDT

    OBJNR                    = OBJNR

*   ZEILE                     = ' '

*   SET_CHGKZ                 =

* IMPORTING

*   ERROR_OCCURRED            =

*   OBJECT_NOT_FOUND          =

*   STATUS_INCONSISTENT       =

*   STATUS_NOT_ALLOWED        =

  TABLES

    STATUS                    = it_status

EXCEPTIONS

   OBJECT_NOT_FOUND          = 1

   STATUS_INCONSISTENT       = 2

   STATUS_NOT_ALLOWED        = 3

   OTHERS                    = 4.



IF SY-SUBRC EQ 0.

  CALL FUNCTION 'STATUS_UPDATE_DIALOG'.

  COMMIT WORK.

ENDIF.

0 Kudos

The above solution would work for the Activating the contract.

jonblack1
Discoverer
0 Kudos

Not sure if you've solved this but for reference for anyone else looking you can use the import parameter TRANS to set the system status of the Contract. Look at the FM documentation for example values to supply. i.e. 'MCAK' will activate the contract.

marcog_
Discoverer

If you'll try to use the BAPI in this way:

CALL FUNCTION 'BAPI_RE_CN_CHANGE'

EXPORTING
COMPCODE = ‘0010’
CONTRACTNUMBER = 'AAA001'
TRANS = 'MCAK'
TABLES
return = lt_return.

READ TABLE lt_return TRANSPORTING NO FIELDS
WITH KEY type = 'E'.
IF sy-subrc IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
Endif.