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.
*
Tuesday, May 6, 2008
Sample ABAP Program for MB1B Call Transaction
Labels:
Sample ABAP Code Programs
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2008
(300)
-
▼
May
(80)
- Object oriented programming (OOP) All Steps
- Object oriented programming (OOP) Step2
- Object oriented programming (OOP) Step-by-step
- Object oriented programming (OOP) explained with a...
- Interview Question on BAPI, RFC, ABAP Objects, Tables
- The Other 50 ABAP Interview Faq's
- More than 100 ABAP Interview Faq's
- Events in Report
- Example: The IDoc Type ORDERS01
- Program for Outbound IDOC
- Basic Configuration in IDOC
- Sample ABAP Program to Upload table using new func...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for giv...
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application...
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing scr...
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert ...
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from w...
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/downlo...
- Sample ABAP Program to download table using new fu...
- Sample ABAP Program to Download file to Presentati...
- Sample ABAP Program to display pop message to avoi...
- Sample ABAP Program of ALV Grid
- Sample ABAP Program of Dialogue Module Pool
- Sample ABAP Program to DIALOGUE FLOW LOGIC
- Sample ABAP Program to Delete a file from the appl...
- Sample ABAP Program to Compare to Unix or PC files...
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference betwee...
- Sample ABAP Program of BW User Exit
- Sample SAP ABAP Program to Browse a file on the ap...
- Sample SAP ABAP Program of ALV Grid control using ...
- SE30 - Runtime Analysis Tool
- List of System fields
- Write a report that displays the text 'Hello world...
- HR (Human Resource) Tutorials Free downloads
- FI (Financial) Tutorials Free downloads
- PM (Plant Maintenance) Tutorials Free downloads
- WM (Warehouse Management) Tutorials Free downloads
- QM (Quality Management) Tutorials Free downloads
- PP (Production Planning) Tutorials Free downloads
- SD (Sales and Distribution) Tutorials Free downloads
- MM (Material Management) Tutorials Free downloads
- IDOC INTRODUCTION & STRUCTURE
- Step-by-Step Guide for using LSMW to Update Custom...
- LIST of TABLES
- Transporting Objects and Standard Text from one cl...
- SAP R/3 INTERVIEW ARCHITECTURE QUESTIONS
- SAP TRANSACTIONS INTERVIEW QUESTIONS
- SAP MODULARIZATION INTERVIEW QUESTIONS
- SAP LOGICAL DATABASE INTERVIEW QUESTIONS
- SAP R/3 DATA DICTIONARY INTERVIEW QUESTIONS
- SAP BDC INTERVIEW QUESTIONS & ANSWERS
- SAP ABAP MENU PAINTER & SCREEN PAINTER Tutorials
- SAP ABAP WORKFLOW Tutorials PDF Free downloads
- SAP ABAP ITS Tutorials PDF Free downloads
- SAP ABAP EDI Tutorials PDF Free downloads
- SAP ABAP BAPI Tutorials PDF Free downloads
- SAP ABAP Change&Transport System Tutorials PDF Fre...
- SAP ABAP OBJECTS Tutorials PDF Free downloads
- SAP ABAP USER EXITS Tutorials PDF Free downloads
- SAP ABAP ALE Tutorials PDF Free downloads
- SAP ABAP IDOC Tutorials PDF Free downloads
- SAP ABAP LSMW Tutorials PDF Free downloads
- SAP ABAP BDC (Batch Data Communication) Tutorials ...
- SAP ABAP SAPSCRIPTS Tutorials Free downloads
- ALV Grid free download
- SAP ABAP INTERACTIVE REPORTING FAQs
- SAP ABAP REPORTING GENERAL
- SAP REPORTS FAQ
-
▼
May
(80)
No comments:
Post a Comment