Skip to Content

Profitability analysis is in COPA. So the COPA related configurations need to be done by the FICO team.

To create goods issue on purchase order with profitability analysis we need two function modules to create the goods issue with the profitability analysis.

1. COPA_PROFITABILITY_SEGMENT

This function module creates the profitability segment for COPA document and returns the object number.

2. BAPI_GOODSMVT_CREATE

This function module creates the goods issue and to create the profitability analysis segment for goods issue we have to pass the profitability object number.

DATA : st_cobl TYPE cobl,

        st_cobl_e           TYPE cobl,

        st_goodsmvt_header  type BAPI2017_GM_HEAD_01,

        st_goodsmvt_code    type BAPI2017_GM_CODE,

        st_GOODSMVT_HEADRET type BAPI2017_GM_HEAD_RET,

        st_MATERIALDOCUMENT type BAPI2017_GM_HEAD_RET-MAT_DOC,

        st_MATDOCUMENTYEAR  type BAPI2017_GM_HEAD_RET-DOC_YEAR,

        st_copadata         TYPE copadata,

        it_copadata         TYPE STANDARD TABLE OF copadata,

        it_goodsmvt_item type STANDARD TABLE OF BAPI2017_GM_ITEM_CREATE,

        st_goodsmvt_item type BAPI2017_GM_ITEM_CREATE,

        it_return type standard table of BAPIRET2.

*Fill up all the COPA data
st_cobl-bukrs  = ‘FR01’.
st_cobl-KZBEW  = ‘X’.
st_cobl-XPSEG_DER  = ‘X’.
st_cobl-prctr  = ‘1060’.
st_cobl-pprctr = ‘1060’.
st_cobl-matnr = ‘000000000000000104’.

st_copadata-fnam = ‘PRODUCT’.
st_copadata-fval = ‘104’.
APPEND st_copadata  TO it_copadata.

CALL FUNCTION ‘COPA_PROFITABILITY_SEGMENT’

  EXPORTING

   ANZEIGE             = ‘ ‘

   DIALOG              = ”

*   SPARSE              = ”

*   IGNORE              = ‘ ‘

    i_cobl              = st_cobl

*   I_COBL_REF          =

*   I_KOMK              =

*   I_KOMP              =

*   I_VBAK              =

*   I_VBAP              =

*   I_VBKD              =

*   I_PRPS              =

*   I_VIAUFKST          =

   PRUEFEN             = ‘ ‘

    i_erkrs             = ‘FR01’

   I_MODE              = ‘T’

*   IS_GLOBAL_FIELDS    =

*   I_UPDATE            = ‘ ‘

*   NO_DUMP             = ‘ ‘

  IMPORTING

    e_cobl              = st_cobl_e

*   E_DELKEY            =

  TABLES

    t_copadata          = it_copadata

  EXCEPTIONS

    abnormal_leave      = 1

    btrans_not_relevant = 2

    error_copa          = 3

    OTHERS              = 4.

IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
  IF st_cobl_e-PAOBJNR IS NOT INITIAL.

*Fill up the data    st_goodsmvt_header-PSTNG_DATE = sy-datum.
    st_goodsmvt_header-DOC_DATE = sy-datum.
    st_goodsmvt_code-GM_CODE = ’03’.               ” for goods issue

st_goodsmvt_item-MATERIAL = ‘000000000000000104’.
st_goodsmvt_item-PLANT = ‘FRXE’.
st_goodsmvt_item-STGE_LOC = ‘Z300’.
st_goodsmvt_item-MOVE_TYPE = ‘951’.
st_goodsmvt_item-CUSTOMER = ‘0000000031’.
st_goodsmvt_item-ENTRY_QNT = ’10’.
st_goodsmvt_item-PROFIT_SEGM_NO = st_cobl_e-PAOBJNR.
st_goodsmvt_item-GL_ACCOUNT = ‘0000713510’.

append st_goodsmvt_item to it_goodsmvt_item.

    CALL FUNCTION ‘BAPI_GOODSMVT_CREATE’
      EXPORTING
        goodsmvt_header               = st_goodsmvt_header
        goodsmvt_code                 = st_goodsmvt_code
        TESTRUN                       = ‘ ‘
*   GOODSMVT_REF_EWM              =
     IMPORTING
        GOODSMVT_HEADRET              = st_GOODSMVT_HEADRET
        MATERIALDOCUMENT              = st_MATERIALDOCUMENT
        MATDOCUMENTYEAR               = st_MATDOCUMENTYEAR
      TABLES
        goodsmvt_item                 = it_goodsmvt_item
*   GOODSMVT_SERIALNUMBER         =
        return                        = it_return
*   GOODSMVT_SERV_PART_DATA       =
*   EXTENSIONIN                   =
              .
    IF sy-subrc EQ 0.
      CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
       EXPORTING
         WAIT          = ‘X’
*       IMPORTING
*         RETURN        =
                .
    ENDIF.
  ENDIF.
ENDIF.

So we can implement this logic to create the goods issue with the profitability analysis using any custom program.

After implementing this logic in a custom program and executing it we will see the below details in MIGO.

/wp-content/uploads/2013/05/1_215268.jpg

/wp-content/uploads/2013/05/2_215269.jpg

Click FI Documents

/wp-content/uploads/2013/05/3_215273.jpg

/wp-content/uploads/2013/05/4_215274.jpg

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply