Tuesday, July 1, 2008

SAP Plant Details Company code and Controlling Area for a Plant

SAP Plant Details Company code and Controlling Area for a Plant

To extract the Plant Details, Company Code details and Controlling area details for a Plant the following Function Module can be used.

ITOB_CHECK_PLANT

The above mentioned function module extracts all the details from the table T001W Plants/Branches, it also extracts details from the following fields.

T001K-BUKRS               Company Code
TKA01-KOKRS              Controlling Area

Following are the Input Parameters

T001W-WERKS                     PLANT
SY-BINPT                              Batch input, program running under batch input
TKA02-GSBER                      Business Area
SY-BINPT                              Batch input, program running under batch input DIALOG_MODE
SY-BINPT                              Batch input, program running under batch input DIALOG_CURSOR
DD03D-FIELDNAME             Field name
SY-STEPL                             Screens, current table line index
SY-BINPT                             Batch input, program running under batch input
SY-MSGTY                           Messages, message type

Find the program below.

REPORT ZEX_ITOBCHECKPLANT .

Parameter: p_werks like T001W-WERKS.

Data: wa_plant type T001W,
      d_bukrs like T001K-BUKRS,
      d_kokrs like TKA01-KOKRS.


CALL FUNCTION 'ITOB_CHECK_PLANT'
  EXPORTING
    WERK_IMP                = p_werks
   DETERMINE_MODE          = 'X'
*   GSBER_IMP               =
   USE_BUF                 = 'X'
   DIALOG_MODE             = 'X'
   DIALOG_CURSOR           = ' '
   DIALOG_STEPL            = 0
   INIT_MESSAGE_DATA       = 'X'
   X_MESS_TYPE             = 'E'
 IMPORTING
   T001W_EXP               = wa_plant
   BUKRS_EXP               = d_bukrs
   KOKRS_EXP               = d_kokrs
 EXCEPTIONS
   EMPTY_KEY               = 1
   APPLICATION_ERROR       = 2
   OTHERS                  = 3
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


See Also:
SAP Locating Plants for a Given Material
SAP get Plant Description For a given Material
SAP PLANT MATERIAL and STORAGE LOCATION
Company Code For a Plant

No comments:

Post a Comment