cancel
Showing results for 
Search instead for 
Did you mean: 

lsmw for mb1b transaction.

Former Member
0 Kudos

hello,

is it possible to do lsmw for mb1b transaction.

if possible then how ?

any suggestions please.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member184655
Active Contributor
0 Kudos

Dear Santosh,

You can create a new LSMW by recording method for the T Code MB1B.

Goto T Code LSMW,create a project,sub-project and object and then in the first step select recording

method and enter for the T Code MB1B.

The other option is creating a BDC by recording the procedure using SHDB,then create a program and T

code for the same.

Check and revert back.

Regards

Mangalraj.S

Former Member
0 Kudos

Hi

you can use the LSMW for the transaction MB1B .

Or

use the program to stock transfer from plant to plant :

REPORT YMBIE096 LINE-SIZE 80.

*----------------------------------------------------------------------*
* Program: YMBIE096
* Author: Sheila Titchener
* Date: Mar 1999
* Purpose: To move stock to new plant
*----------------------------------------------------------------------*
TABLES: MCHB.

* internal table
DATA: BEGIN OF I_MCHB OCCURS 0,
MATNR LIKE MCHB-MATNR,
LGORT LIKE MCHB-LGORT,
CHARG LIKE MCHB-CHARG,
J_2CTRNR LIKE MCHB-J_2CTRNR,
J_2CELNG LIKE MCHB-J_2CELNG,
CLABS LIKE MCHB-CLABS,
END OF I_MCHB.

*-----------------------new code smt nov 98-----------------------------
* batch input tables
DATA BEGIN OF BDCDATA OCCURS 100.
INCLUDE STRUCTURE BDCDATA.
DATA END OF BDCDATA.

DATA BEGIN OF MESSTAB OCCURS 10.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA END OF MESSTAB.
*

SELECT-OPTIONS S_MATNR FOR MCHB-MATNR.
PARAMETERS: P_DISP AS CHECKBOX.
DATA W_MODE.
DATA W_MESSAGE LIKE MESSAGE.
*----------------------------------------------------------------------*
START-OF-SELECTION.
*----------------------------------------------------------------------*

SELECT MATNR LGORT J_2CELNG CHARG CLABS J_2CTRNR FROM MCHB
INTO CORRESPONDING FIELDS OF TABLE I_MCHB
WHERE MATNR IN S_MATNR
AND WERKS = 'BT'.

*----------------------------------------------------------------------*
END-OF-SELECTION.
*----------------------------------------------------------------------*

LOOP AT I_MCHB.
CHECK I_MCHB-J_2CELNG NE 0.
CHECK I_MCHB-J_2CELNG = I_MCHB-CLABS.
PERFORM MOVE_STOCK.
ENDLOOP.


*&---------------------------------------------------------------------*
*& Form MOVE_STOCK
*&---------------------------------------------------------------------*
* Call transaction MB1B to transfer stock
*----------------------------------------------------------------------*
FORM MOVE_STOCK.
DATA: W_QTY(10).
WRITE I_MCHB-J_2CELNG TO W_QTY DECIMALS 0.


REFRESH: BDCDATA, MESSTAB.

PERFORM DYNPRO USING:
'X' 'SAPMM07M' '0400',
' ' 'RM07M-BWARTWA' '301',
' ' 'RM07M-WERKS' 'BT',
' ' 'RM07M-LGORT' I_MCHB-LGORT,
' ' 'BDC_OKCODE' '/0',

'X' 'SAPMM07M' '0421',
' ' 'MSEGK-UMWRK' '94',
' ' 'MSEGK-UMLGO' I_MCHB-LGORT,
' ' 'BDC_OKCODE' 'NLE',
*CODING BLOCK
'X' 'SAPLKACB' '0002',
' ' 'BDC_OKCODE' '/0',


'X' 'SAPMM07M' '0421',
' ' 'MSEG-MATNR(1)' I_MCHB-MATNR,
' ' 'MSEG-ERFMG(1)' W_QTY,
' ' 'MSEG-CHARG(1)' I_MCHB-CHARG,
' ' 'BDC_OKCODE' '/0',
*CODING BLOCK
'X' 'SAPLKACB' '0002',
' ' 'BDC_OKCODE' '/0',

*CODING BLOCK
'X' 'SAPLKACB' '0002',
' ' 'BDC_OKCODE' '/0',


* 'X' 'SAPMM07M' '0410',
* ' ' 'BDC_OKCODE' '/0',
*CODING BLOCK
* 'X' 'SAPLKACB' '0002',
* ' ' 'BDC_OKCODE' '/8',

*CODING BLOCK
* 'X' 'SAPLKACB' '0002',
* ' ' 'BDC_OKCODE' '/8',

'X' 'SAPLJ2CW' '0190',
' ' 'J_5C7-UMCHA' I_MCHB-CHARG,
' ' 'BDC_OKCODE' '/7',

'X' 'SAPMM07M' '0421',
' ' 'BDC_OKCODE' '/11',
*CODING BLOCK
'X' 'SAPLKACB' '0002',
' ' 'BDC_OKCODE' '/0'.
IF P_DISP = 'X'.
W_MODE = 'A'.
ELSE.
W_MODE = 'N'.
ENDIF.
CALL TRANSACTION 'MB1B' USING BDCDATA MODE W_MODE UPDATE 'S'
MESSAGES INTO MESSTAB.

WRITE: / I_MCHB-MATNR, I_MCHB-CHARG, I_MCHB-LGORT,
I_MCHB-J_2CTRNR, I_MCHB-J_2CELNG.

IF SY-SUBRC NE 0.
* what to do if there's an error????
LOOP AT MESSTAB.
SY-MSGNO = MESSTAB-MSGNR.
CALL FUNCTION 'WRITE_MESSAGE'
EXPORTING
MSGID = MESSTAB-MSGID
MSGNO = SY-MSGNO
MSGTY = MESSTAB-MSGTYP
MSGV1 = MESSTAB-MSGV1
MSGV2 = MESSTAB-MSGV2
MSGV3 = MESSTAB-MSGV3
MSGV4 = MESSTAB-MSGV4
MSGV5 = MESSTAB-MSGV4
IMPORTING
* error =
MESSG = W_MESSAGE
* msgln =
EXCEPTIONS
OTHERS = 1.
WRITE: / W_MESSAGE.
* message id messtab-msgid type 'I' number messtab-msgnr.
ENDLOOP.

ENDIF.


ENDFORM. " CHANGE_BILLING_TYPE

*-----------------------------------------------------------------------
* FORM DYNPRO - new form smt nov 1998
*-----------------------------------------------------------------------
* > DYNBEGIN
* > NAME
* > VALUE
*-----------------------------------------------------------------------
*
FORM DYNPRO USING DYNBEGIN NAME VALUE.

IF DYNBEGIN = 'X'.
CLEAR BDCDATA.
MOVE: NAME TO BDCDATA-PROGRAM,
VALUE TO BDCDATA-DYNPRO,
'X' TO BDCDATA-DYNBEGIN.
APPEND BDCDATA.
ELSE.
CLEAR BDCDATA.
MOVE: NAME TO BDCDATA-FNAM,
VALUE TO BDCDATA-FVAL.
APPEND BDCDATA.
ENDIF.

ENDFORM.
*

Edited by: raj on Jun 5, 2009 7:55 AM

Former Member
0 Kudos

Yes you can create a LSMW for MB1B,

when you do recording enter transaction mb1b then in initial screen itself you can find new button please go with it, then after entering inside enter desired values then for next item again press new item.

Hope this will solve your problem.

If still you are facing problem please let me know with more informations like which movement type and which storage location.