we can create material , without going to MM01 , we can directly create a material using a function module in our program .simply call that function module in your program, it will create material without going to transaction MM01.
THE CODE IS:
&---------------------------------------------------------------------*
*& Report ZAUTOMATERIALCREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZAUTOMATERIALCREATE.
DATA: KEY LIKE SWEINSTCOU-OBJKEY.
KEY = '1163'.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = 'BUS1001006'
OBJKEY = KEY
EVENT = 'CREATED'
* CREATOR = ' '
* TAKE_WORKITEM_REQUESTER = ' '
* START_WITH_DELAY = ' '
* START_RECFB_SYNCHRON = ' '
* NO_COMMIT_FOR_QUEUE = ' '
* DEBUG_FLAG = ' '
* NO_LOGGING = ' '
* IDENT =
* IMPORTING
* EVENT_ID =
* RECEIVER_COUNT =
* TABLES
* EVENT_CONTAINER =
* EXCEPTIONS
* OBJTYPE_NOT_FOUND = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
WRITE 'Event Triggered'.
ENDIF.
COMMIT WORK.
THE CODE IS:
&---------------------------------------------------------------------*
*& Report ZAUTOMATERIALCREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZAUTOMATERIALCREATE.
DATA: KEY LIKE SWEINSTCOU-OBJKEY.
KEY = '1163'.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = 'BUS1001006'
OBJKEY = KEY
EVENT = 'CREATED'
* CREATOR = ' '
* TAKE_WORKITEM_REQUESTER = ' '
* START_WITH_DELAY = ' '
* START_RECFB_SYNCHRON = ' '
* NO_COMMIT_FOR_QUEUE = ' '
* DEBUG_FLAG = ' '
* NO_LOGGING = ' '
* IDENT =
* IMPORTING
* EVENT_ID =
* RECEIVER_COUNT =
* TABLES
* EVENT_CONTAINER =
* EXCEPTIONS
* OBJTYPE_NOT_FOUND = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
WRITE 'Event Triggered'.
ENDIF.
COMMIT WORK.