‎2007 Jul 06 8:51 AM
hi experts
plese send a program for BDC TC code me51 and mm01 in session method
‎2007 Jul 06 9:07 AM
hi,
This code is BDC for ME51, first you finish recording and then do my code, it will execute perfectly, and you should create flat file for ME41 screen.
report ZUDAY_BDC_TCL1 no standard page heading line-size 255.
include bdcrecx1.
TABLES EBAN.
DATA: BEGIN OF ITAB OCCURS 0,
NUMBER(3) TYPE C,
MATNR LIKE EBAN-MATNR,
TXZ01 LIKE EBAN-TXZ01,
MENGE(13) TYPE C,
MEINS LIKE EBAN-MEINS,
EEIND TYPE RM06B-EEIND,
EKGRP LIKE EBAN-EKGRP,
MATKL LIKE EBAN-MATKL,
WERKS(4) TYPE C,
END OF ITAB.
DATA: LVALUE TYPE I,
COUNT TYPE I,
TEMP(20) TYPE C,
CTRL TYPE I,
CTRL1(3) TYPE C,
PAGES(5) TYPE c VALUE '10',
PVALUE(3) TYPE C VALUE 0.
start-of-selection.
PERFORM GETDATA.
SORT ITAB BY NUMBER.
perform open_group.
LOOP AT ITAB.
IF ITAB-NUMBER <> LVALUE.
COUNT = 0.
perform bdc_dynpro using 'SAPMM06B' '0100'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-BSART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-BSART'
'NB'.
perform bdc_field using 'RM06B-LPEIN'
'T'.
perform bdc_field using 'EBAN-EKGRP'
'008'.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
PAGES = 10.
CTRL = 0.
LOOP AT ITAB WHERE NUMBER = ITAB-NUMBER.
CTRL = CTRL + 1.
IF CTRL >= 19.
PAGES = PAGES + 10.
ENDIF.
CTRL1 = CTRL.
IF CTRL >= 19.
CTRL1 = '19'.
ENDIF.
IF CTRL >= 10.
PVALUE = ''.
ENDIF.
perform bdc_field using 'RM06B-BNFPO'
PAGES.
Concatenate 'EBAN-MATNR(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-MATNR.
Concatenate 'EBAN-TXZ01(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-TXZ01.
Concatenate 'EBAN-MENGE(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-MENGE.
Concatenate 'EBAN-MEINS(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-MEINS.
Concatenate 'RM06B-EEIND(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-EEIND.
Concatenate 'EBAN-EKGRP(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-EKGRP.
Concatenate 'EBAN-MATKL(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-MATKL.
Concatenate 'EBAN-WERKS(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using Temp itab-WERKS.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-TXZ01'
ITAB-TXZ01. "'HD GLAD BOY tank silver'.
perform bdc_field using 'EBAN-MENGE'
ITAB-MENGE. "'500'.
perform bdc_field using 'RM06B-EEIND'
ITAB-EEIND."'27.06.2007'.
perform bdc_field using 'EBAN-EKGRP'
ITAB-EKGRP. "'001'.
perform bdc_field using 'EBAN-BADAT'
'15.06.2007'.
perform bdc_field using 'EBAN-FRGDT'
'26.06.2007'.
perform bdc_field using 'EBAN-PREIS'
'55.48'.
perform bdc_field using 'EBAN-WAERS'
'GBP'.
perform bdc_field using 'EBAN-PEINH'
'1'.
perform bdc_field using 'EBAN-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06B' '0106'.
Concatenate 'ElBAN-MATNR(' PVALUE CTRL1 ')' into Temp.
CONDENSE Temp NO-GAPS.
perform bdc_field using 'BDC_CURSOR' Temp.
perform bdc_field using 'BDC_OKCODE'
'/00'.
ENDLOOP.
LVALUE = ITAB-NUMBER.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RM06B-BNFPO'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'RM06B-BNFPO'
'80'.
*AT END OF NUMBER.
perform bdc_transaction using 'ME51'.
REFRESH BDCDATA.
*ENDAT.
ENDIF.
ENDLOOP.
perform close_group.
*&---------------------------------------------------------------------*
*& Form GETDATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GETDATA .
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = ' '
FILETYPE = ' '
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " GETDATAbefore developing object to MM01, you try with these predefined programs........
<b>RMDATGEN-----> for genarating sample flat file with entered material number.
RMDATIND-------> for genarating conversion prgram for MM01.</b>
regards,
Ashok reddy