Go on link..

link us with ...

Thursday, December 30, 2010

BDC Program for Transaction MI10

*---------------------------------------------------------------------*
* Report ZVVF_MR323_BDCMI10 *
*---------------------------------------------------------------------*
* *
* MODULE : Material Management *
* *
*---------------------------------------------------------------------*
* Objective : BDC Program for Transaction MI10.The Program will be *
* called from Module-pool Program ZVVF_MM032_PHYINV *
* when the user selects option 3)Posting Physical *
* Inventory Difference *
* Program : Update Tables (X) Download Data ( ) Outputs List ( )*
* Technical Specs No : *
* Date Created : *
* Author : *
* Location : *
* LDB : *
* *
*---------------------------------------------------------------------*
REPORT ZVVF_MR323_BDCMI10.

*---------------------------------------------------------------------*
* Structures Starts with WA_ *
*---------------------------------------------------------------------*
TYPES: BEGIN of WA_BDC,
ZLDAT(10) type c, " Count Date
BLDAT(10) type c, " Document Date
WERKS type werks_d, " Plant
LGORT type lgort_d, " Storage Location
MATNR type matnr_d, " Material
CHARG type charg_d, " Batch
ERFMG type menge_d, " Quantity
GRUND(4) type c, " Reason Movement
QUANTITY(13) TYPE C,
ERFME TYPE I_ERFME, " Unit of Entry
END of WA_BDC.

*---------------------------------------------------------------------*
* Internal Table Starts with IT_ *
*---------------------------------------------------------------------*
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: IT_MSG TYPE TABLE OF BDCMSGCOLL.
DATA: IT_BDC TYPE WA_BDC OCCURS 0 WITH HEADER LINE.

*---------------------------------------------------------------------*
* Data Starts with W_ *
*---------------------------------------------------------------------*
DATA : EXT_PERIOD TYPE TPRG-PRGBZ,
INT_PERIOD TYPE TPRG-PRGRS VALUE 1.

*---------------------------------------------------------------------*
* Constants Starts with C_ *
*---------------------------------------------------------------------*
CONSTANTS : C_GRUND LIKE ISEG-GRUND VALUE '0004'.

*---------------------------------------------------------------------*
* START OF SELECTION *
*---------------------------------------------------------------------*
START-OF-SELECTION.

CALL FUNCTION 'PERIOD_AND_DATE_CONVERT_OUTPUT'
EXPORTING
* COUNTRY = ' '
INTERNAL_DATE = SY-DATUM
INTERNAL_PERIOD = INT_PERIOD
* LANGUAGE = SYST-LANGU
* I_PERIV =
* I_WERKS =
* I_MRPPP =
IMPORTING
EXTERNAL_DATE = IT_BDC-ZLDAT
EXTERNAL_PERIOD = EXT_PERIOD
* EXTERNAL_PRINTTEXT =
* EXCEPTIONS
* DATE_INVALID = 1
* PERIODE_INVALID = 2
* OTHERS = 3
.

it_bdc-bldat = IT_BDC-ZLDAT .

import matnr to it_bdc-matnr
charg to it_bdc-charg
menge to it_bdc-erfmg
lgort to it_bdc-lgort
werks to it_bdc-werks
meins to it_bdc-erfme
FROM MEMORY ID 'MM032_MI10'.

IT_BDC-QUANTITY = IT_BDC-ERFMG.
IT_BDC-GRUND = C_GRUND.

append it_bdc.

loop at it_bdc.

perform bdc_dynpro using 'SAPMM07I' '0700'.
perform bdc_field using 'BDC_CURSOR'
'IKPF-LGORT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RM07I-ZLDAT'
it_bdc-ZLDAT.
perform bdc_field using 'RM07I-BLDAT'
it_bdc-BLDAT.
perform bdc_field using 'IKPF-WERKS'
it_bdc-WERKS.
perform bdc_field using 'IKPF-LGORT'
it_bdc-LGORT.
perform bdc_dynpro using 'SAPMM07I' '0731'.
perform bdc_field using 'BDC_CURSOR'
'ISEG-GRUND(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'ISEG-MATNR(01)'
it_bdc-MATNR.
perform bdc_field using 'ISEG-CHARG(01)'
it_bdc-CHARG.
perform bdc_field using 'ISEG-ERFMG(01)'
it_bdc-QUANTITY.
perform bdc_field using 'ISEG-GRUND(01)'
it_bdc-GRUND.
perform bdc_field using 'ISEG-ERFME(01)'
it_bdc-ERFME.

call transaction 'MI10' using BDCDATA mode 'E' update 'A'
MESSAGES INTO IT_MSG.

endloop.

*----------------------------------------------------------------------*
* FORM : Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.

*----------------------------------------------------------------------*
* FORM : Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> ''.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.

No comments:

link us...

For Visitors

if you want to publish or Add something on ERP, SAP , SAP FUNCTIONAL, SAP ABAP then mail us along with your email-id. contain must be yours

email-id :- avinashkr_raj@yahoo.com(any email)

email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)