Problem

How to retrieve information of GBU  in WP2

Solution


Using sales order data:

You need to have under hands :

  • The company code
  • The sales area
  • The division of the material

With these informations, you can access to the GBU information which are stored in SAP with a classification link (transaction CL20N)

You need to have access to table zwfat111 which contains the reference with the GBU link. And in the table t25b0 to get the texts


An exemple of code exists to retrieve GBU information (the selection of division is not copiable). FORM get_gbu of program ZWEBI02110.


Another way from Order information (Thanks Jorge)

***    GBU calculation  ***
    loop at  i_vbap assigning <st_vbap>.
      replace all occurences of '|' in <st_vbap>-ARKTX with ' '.
      replace all occurences of '|' in <st_vbap>-KDMAT with ' '.
      read table i_vbak
      with key vbeln <st_vbap>-vbeln
           assigning <st_vbak>.
      if sy-subrc eq 0.
        clearzgbuzclintzclasszdcdvzbukrs.
        zbukrs <st_vbak>-bukrs_vf.
        ZDCDV(2<st_vbak>-vtweg.
        ZDCDV+2(2<st_vbap>-spart.
        select single clint from kssk into zclint
         where objek zdcdv
           and kssk~mafid 'O'
           and kssk~klart 'ZS1'.
        if sy-subrc 0.
          select single class from klah into zclass where clint zclint.
          if sy-subrc 0.
            select single mgn_mk from zwfat111 into zgbu
                 where bukrs zbukrs
                 and   wwe01 zclass
                 and   datab le sy-datum
                 and   datbi ge sy-datum.
          endif.
        endif.
        <st_vbap>-gbu zgbu(2).
      endif.
    endloop.
***    GBU calculation  ***
 


Using only the material and plant:

  1. From the material master data, get the profit center from the table MARC.
  2. From the plant, get the company code from the table T001K.
  3. From the company code, get the controlling area from the table TKA02.
  4. From the profit center and the controlling area, get the latest valid row from the table ZWFAT186. The two-letter code in ZWFAT186-DESCRIPT2 gives the GBU.


GBU two-letter codes

GBU codeGBUGroup
SDSoda AshECo
PEPeroxidesECo
SISilicaECo
CHSpecial Chem (HF)ECo
RESpecial Chem (Rare Earth)ECo
CTCoatis & FibrasECo
RURusvynilECo
SPSpecialty PolymersSCo
CMCompositesSCo
CSNovecareSCo
PAAromaSCo
TSTechnology SolutionsSCo
OGOil & GasSCo
CBCorporate Business Servicesshared
NBNew Business Developmentshared
GYEnergyshared