<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: BAPI_EQUI_CREATE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722144#M315104</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sumant,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a way this works for me but&lt;/P&gt;&lt;P&gt;i also need to pass the material number.&lt;/P&gt;&lt;P&gt;Currently i am doing like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lt_specific-material   = p_matnr.&lt;/P&gt;&lt;P&gt;lt_specific-equicatgry = p_eqtyp. "equi catergory of the material&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear g_equipment_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'BAPI_EQUI_CREATE'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      data_general  = lt_datageneral&lt;/P&gt;&lt;P&gt;      data_specific = lt_specific&lt;/P&gt;&lt;P&gt;      valid_date    = sy-datum&lt;/P&gt;&lt;P&gt;    importing&lt;/P&gt;&lt;P&gt;      equipment     = g_equipment_no&lt;/P&gt;&lt;P&gt;      return        = wa_return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Nov 2006 17:50:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-02T17:50:08Z</dc:date>
    <item>
      <title>BAPI_EQUI_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722142#M315102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create equipment master data using another&lt;/P&gt;&lt;P&gt;equipment as reference.&lt;/P&gt;&lt;P&gt;Currently i am using the BAPI_EQUI_CREATE in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From IE01 , the reference field is RM63E-REFEQ.&lt;/P&gt;&lt;P&gt;In the BAPI i tried several fields like READ_CUREF and&lt;/P&gt;&lt;P&gt;READ_SUPEQ but no luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anybody worked on it.&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 15:57:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722142#M315102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T15:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_EQUI_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722143#M315103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the following BAPI, to create equipments with reference to another equipment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BAPI_EQUI_CREATE_BY_REFERENCE'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            reference_number  = p_w_equi-equipment_ref&lt;/P&gt;&lt;P&gt;            valid_date        = p_w_equi-valid_date&lt;/P&gt;&lt;P&gt;            copy_flags        = w_flags&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            equipment         = p_w_equi-equipment&lt;/P&gt;&lt;P&gt;            data_general_exp  = p_w_general&lt;/P&gt;&lt;P&gt;            data_specific_exp = p_w_specific&lt;/P&gt;&lt;P&gt;            return            = p_w_return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Sumant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 16:02:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722143#M315103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T16:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_EQUI_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722144#M315104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sumant,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a way this works for me but&lt;/P&gt;&lt;P&gt;i also need to pass the material number.&lt;/P&gt;&lt;P&gt;Currently i am doing like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lt_specific-material   = p_matnr.&lt;/P&gt;&lt;P&gt;lt_specific-equicatgry = p_eqtyp. "equi catergory of the material&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear g_equipment_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'BAPI_EQUI_CREATE'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      data_general  = lt_datageneral&lt;/P&gt;&lt;P&gt;      data_specific = lt_specific&lt;/P&gt;&lt;P&gt;      valid_date    = sy-datum&lt;/P&gt;&lt;P&gt;    importing&lt;/P&gt;&lt;P&gt;      equipment     = g_equipment_no&lt;/P&gt;&lt;P&gt;      return        = wa_return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 17:50:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722144#M315104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T17:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_EQUI_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722145#M315105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my scenario, I first create a equipment with refernece and then I go and change it with equipment specific data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the actual code from my program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*     Create Equipments with reference via a BAPI call
      PERFORM create_equipment_ref USING    testrun
                                   CHANGING w_equi
                                            w_general
                                            w_specific
                                            w_return.
      IF w_return-type = c_err_type.
* Based on the BAPI return type, set the record status
* Successfuly processed (w_equi-status = c_status_c)
* Failed to process (w_equi-status = c_status_e)
        w_equi-status = c_status_e.
        MODIFY equi_data FROM w_equi.
        MOVE-CORRESPONDING w_return TO w_msgs.
        w_msgs-row_id = w_equi-row_id.
        APPEND w_msgs TO messages.
      ELSE.
        w_equi-status = c_status_c.
        MODIFY equi_data FROM w_equi.
      ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code for the subroutine create_equipment_ref:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM create_equipment_ref USING p_w_testrun  TYPE testrun
               CHANGING p_w_equi LIKE /sie/e_cs_equi_data
                        p_w_general  LIKE bapi_itob
                     p_w_specific LIKE bapi_itob_eq_only
                     p_w_return   LIKE bapiret2.

* Note: When creating Equipment with reference to 
*       another Equipment, you
*       do not have option to change some parts of the 
*       data and also you
*       cann't install the Equipment at a particular 
*       Functional Location
*       So, I had synchronize 3 different BAPIs to 
*       achieve this complete functionality.

  DATA: w_tc_return TYPE bapiret2.

  FIELD-SYMBOLS: &amp;lt;fg&amp;gt;.

  CLEAR: w_flags, w_instal, w_gen2, w_genx, w_spec2, w_specx.
  CLEAR: w_f1,    w_f2.

* These flags will tell the BAPI what parts of the reference equipment
* data must be copied to the new equipment
  w_flags = 'XXXXX XX'.

* If the Equi.Valid date is initial, then set it to current date.
* This is required for maintenance scheduling
  IF p_w_equi-valid_date IS INITIAL.
    p_w_equi-valid_date = sy-datum.
  ENDIF.

* 1. Create Equipment with refernece to another Equipment
  CALL FUNCTION 'BAPI_EQUI_CREATE_BY_REFERENCE'
       EXPORTING
            reference_number  = p_w_equi-equipment_ref
            valid_date        = p_w_equi-valid_date
            copy_flags        = w_flags
       IMPORTING
            equipment         = p_w_equi-equipment
            data_general_exp  = p_w_general
            data_specific_exp = p_w_specific
            return            = p_w_return.

  IF p_w_testrun IS INITIAL.

    IF p_w_return-type = c_err_type.

*     Rollback BAPI_EQUI_CREATE_BY_REFERENCE Work
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

    ELSE.

*     Commit Equi Create with reference BAPI work
*     If Commit fails, then again Rollback
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                wait   = 'X'
           IMPORTING
                return = w_tc_return.

      IF NOT w_tc_return IS INITIAL.
        p_w_return = w_tc_return.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ENDIF.

*     2. Install the newly created Equipment at the required Location
      MOVE-CORRESPONDING p_w_equi TO w_instal.

      CALL FUNCTION 'BAPI_EQUI_INSTALL'
           EXPORTING
                equipment         = p_w_equi-equipment
                data_install      = w_instal
           IMPORTING
                data_general_exp  = p_w_general
                data_specific_exp = p_w_specific
                return            = p_w_return.

      IF p_w_return-type = c_err_type.

*       Rollback BAPI_EQUI_INSTALL work
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

      ELSE.

*       Commit BAPI_EQUI_INSTALL Work
*       If Commit fails, then again Rollback
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
             EXPORTING
                  wait   = 'X'
             IMPORTING
                  return = w_tc_return.

        IF NOT w_tc_return IS INITIAL.
          p_w_return = w_tc_return.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        ENDIF.

      ENDIF.

*     3. Change any specific data for the Equipment, if provided
*     This logic will dynamically check which fields in the receiving
*     interface structure are filled with data and will transfer the
*     contents onto corresponding fields of the BAPI structure
      MOVE-CORRESPONDING p_w_equi TO w_gen2.
      IF NOT w_gen2 IS INITIAL.

        CLEAR:   i_fields.
        REFRESH: i_fields.

        SELECT * FROM dd03l INTO TABLE i_fields
                            WHERE tabname = 'BAPI_ITOB'.
        LOOP AT i_fields.

          CLEAR: w_f1.
          CONCATENATE 'W_GEN2-'  i_fields-fieldname INTO w_f1.
          ASSIGN (w_f1) TO &amp;lt;fg&amp;gt;.

          IF NOT &amp;lt;fg&amp;gt; IS INITIAL .
            w_f2 = sy-tabix - 1.
            w_genx+w_f2(1) = 'X'.
          ENDIF.

          UNASSIGN &amp;lt;fg&amp;gt;.

        ENDLOOP.

        CALL FUNCTION 'BAPI_EQUI_CHANGE'
             EXPORTING
                  equipment         = p_w_equi-equipment
                  data_general      = w_gen2
                  data_generalx     = w_genx
                  data_specific     = w_spec2
                  data_specificx    = w_specx
             IMPORTING
                  data_general_exp  = p_w_general
                  data_specific_exp = p_w_specific
                  return            = p_w_return.

        IF p_w_return-type = c_err_type.

*         Rollback BAPI_EQUI_CHANGE Work
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

        ELSE.

*         Commit BAPI_EQUI_CHANGE Work
*         If Commit fails, then again Rollback
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               EXPORTING
                    wait   = 'X'
               IMPORTING
                    return = w_tc_return.

          IF NOT w_tc_return IS INITIAL.
            p_w_return = w_tc_return.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ENDIF.

        ENDIF.

      ENDIF.

    ENDIF.

  ELSE.

*   Rollback Equipment Create with Reference BAPI work
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

  ENDIF.

ENDFORM.                    " create_equipment_ref
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sumant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 19:25:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-equi-create/m-p/1722145#M315105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T19:25:40Z</dc:date>
    </item>
  </channel>
</rss>

