cancel
Showing results for 
Search instead for 
Did you mean: 

Company code

Former Member
0 Kudos

Hi all,

I am doing FL Validations for this i have implemented the BADI DOC_CHECK_BADI in this implementation i am calling the RFC FM BAPI_ACC_GL_POSTING_CHECK when we execute this FM we will get error message based on GL Account and its account assignment(costcenter or order or WBS) i am populating this error message to ET_MESSAGES so that i can get an error message when GL based on costcenter is not valid when i create a SC or PO...

here in FM in one the inputs it takes companycode(bapiacgl08-comp_code)...for PO implementation of BADI DOC_CHECK_BADI i have used FM BBP_PD_PO_GETDETAIL here i will get E_HEADER as import parameter it has company code field e_header-co_code ao i can populate this company code to FM BAPI_ACC_GL_POSTING_CHECK and i am getting the error message working fine...

I am problem is for SC i am using FM BBP_PD_SC_GETDETAIL here in E_HEADER i don't have company code field ..so how to populate to BAPI_ACC_GL_POSTING_CHECK...how can i get company code value to pulpate ...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Backend company code is in item in field BE_CO_CODE.

FM BBP_PD_SC_GETDETAIL table E_ITEM-BE_CO_CODE

Regards,

Marcin

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

You can try this also. Depending on your SRM system version.

<b>Use either of the standard SAP recommended function modules to read all the attributes of the EBP (ITS) User maintained in the Organizational Plan.</b>

<b>The attribute - BUK holds the company code value.</b>

     CALL FUNCTION 'BBP_READ_ATTRIBUTES'
      EXPORTING
        iv_object                     = iresult
        IV_USER                       = 'USERID'        --> Give the SAP User ID here
        iv_scenario                   = 'BBP'
        it_attr_list                  = i_att_name
      IMPORTING
        et_attr_dft                   = ilocattribs
      EXCEPTIONS
        object_id_not_found           = 1
        no_attributes_requested       = 2
        attributes_read_error         = 3
        OTHERS                        = 4.

----


----
----

<u>OR Try this ....</u>

  CALL FUNCTION 'BBP_USER_GET_ATTRIBUTES'
    EXPORTING
      username            = 'USERID'        --> Give the SAP User ID here
    TABLES
      it_attr_p           = lt_attr_p
    EXCEPTIONS
      user_not_found      = 1
      orgunit_not_found   = 2
      object_id_not_found = 3
      OTHERS              = 4.

----


----
----

<b>Sample code -></b>

    CALL FUNCTION 'BBP_READ_ATTRIBUTES'
      EXPORTING
        iv_orgunit     = wa_companies-objid
        iv_scenario    = 'BBP'
        iv_attr_single = lv_attr_single
      IMPORTING
        et_attr        = lt_attr
      EXCEPTIONS
        OTHERS         = 1.
    IF sy-subrc = 0.
      READ TABLE lt_attr INTO wa_attr WITH KEY attr_id = 'COCODE'.
      READ TABLE wa_attr-vlist INTO wa_attr_vlist
           WITH KEY value_logsys = logical_system.
      IF sy-subrc = 0.
        lm_companycode_list-comp_code = wa_attr_vlist-value.
*       get company's name
        CALL FUNCTION 'BUPA_NUMBERS_GET'
          EXPORTING
            iv_partner_guid = wa_companies-bupaguid
          IMPORTING
            es_but000       = ls_but000.
        IF sy-subrc = 0.
          lm_companycode_list-comp_name = ls_but000-name_org1.
        ENDIF.
        APPEND lm_companycode_list.
      ENDIF.

----


----
----

Hope this will help.

Please reward suitable points.

Regards

- Atul