Skip to Content
0
Former Member
Jun 29, 2007 at 06:08 AM

pls help ths mmo1 transaction

11 Views

pls see the code in between **************************************

****************************************

report ZMM_CONSUME_ITEMS

no standard page heading line-size 255.

include bdcrecx1.

TABLES: MARA , RMMG1 , MAKT , RMCLF , MARC , MPOP , MBEW .

DATA: BEGIN OF ITAB OCCURS 0,

MATNR LIKE RMMG1-MATNR,

MBRSH LIKE RMMG1-MBRSH,

MTART LIKE RMMG1-MTART,

WERKS LIKE RMMG1-WERKS,

LGORT LIKE RMMG1-LGORT,

MAKTX LIKE MAKT-MAKTX,

MEINS LIKE MARA-MEINS,

MATKL LIKE MARA-MATKL,

BRGEW LIKE MARA-BRGEW,

GEWEI LIKE MARA-GEWEI,

KLART LIKE RMCLF-KLART,

PAGPOS LIKE RMCLF-PAGPOS,

MTVFP LIKE MARC-MTVFP,

TRAGR LIKE MARA-TRAGR,

LADGR LIKE MARC-LADGR,

VABME LIKE MARA-VABME,

DISMM LIKE MARC-DISMM,

DISPO LIKE MARC-DISPO,

DISLS LIKE MARC-DISLS,

PLIFZ LIKE MARC-PLIFZ,

FHORI LIKE MARC-FHORI,

PERKZ LIKE MARC-PERKZ,

PRMOD LIKE MPOP-PRMOD,

PERAN LIKE MPOP-PERAN,

ANZPR LIKE MPOP-ANZPR,

KZINI LIKE MPOP-KZINI,

SIGGR LIKE MPOP-SIGGR,

AUTRU LIKE MARC-AUTRU,

MODAV LIKE MPOP-MODAV,

IPRKZ LIKE MARA-IPRKZ,

INSMK LIKE MARC-INSMK,

BKLAS LIKE MBEW-BKLAS,

VPRSV LIKE MBEW-VPRSV,

PEINH LIKE MBEW-PEINH,

  • VERPR LIKE MBEW-VERPR,

verpr type p decimals 2,

EKALR LIKE MBEW-EKALR,

LOSGR LIKE MARC-LOSGR,

BWTTY(1) TYPE C,

BWTAR TYPE C,

BLLAS TYPE C,

WEBAZ TYPE C,

end of itab.

start-of-selection.

PERFORM GET_CONSUMEITEMS_LIST.

perform open_group.

LOOP AT ITAB.

REFRESH BDCDATA.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

ITAB-MATNR. "'CONSUMMABLE100'.

perform bdc_field using 'RMMG1-MBRSH'

ITAB-MBRSH. "'M'.

perform bdc_field using 'RMMG1-MTART'

ITAB-MTART. "'ZCON'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(17)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(02)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(04)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(06)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(07)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(08)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(09)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(10)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(11)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(12)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(13)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(14)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(15)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(16)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(17)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '0080'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-LGORT'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'RMMG1-WERKS'

ITAB-WERKS. "'1100'.

perform bdc_field using 'RMMG1-LGORT'

ITAB-LGORT. "'1101'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'BDC_CURSOR'

'MARA-MATKL'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

perform bdc_field using 'MARA-MATKL'

ITAB-MATKL. "'05'.

perform bdc_field using 'MARA-MTPOS_MARA'

'NLAG'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'BDC_CURSOR'

'MARA-VABME'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

perform bdc_field using 'MARA-VABME'

ITAB-VABME. "'1'.

perform bdc_field using 'MARA-MATKL'

ITAB-MATKL. "'05'.

perform bdc_dynpro using 'SAPLMGMM' '4040'.

perform bdc_field using 'BDC_OKCODE'

'=SP12'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

perform bdc_field using 'BDC_CURSOR'

'MARC-DISMM'.

perform bdc_field using 'MARC-DISMM'

ITAB-DISMM. "'ND'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARC-BESKZ'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARC-PERKZ'

'M'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

perform bdc_field using 'MARA-IPRKZ'

ITAB-PERKZ. "'D'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'=PB01'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

perform bdc_dynpro using 'SAPLQPLS' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RMQAM-ARGUMENT'.

perform bdc_field using 'BDC_OKCODE'

'=NEU'.

perform bdc_dynpro using 'SAPLQPLS' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RMQAM-AKTIV(01)'.

perform bdc_field using 'BDC_OKCODE'

'=WEIT'.

perform bdc_field using 'RMQAM-ART(01)'

'01'.

perform bdc_field using 'RMQAM-AKTIV(01)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

********************************************************************************************

*********************************************************************************************

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

perform bdc_field using 'BDC_CURSOR'

'MBEW-VERPR'.

perform bdc_field using 'MBEW-BKLAS'

ITAB-BKLAS. "'2000'.

perform bdc_field using 'MBEW-PEINH'

'1'.

perform bdc_field using 'MBEW-VERPR'

ITAB-VERPR. "'786'.

__________>>> this VERPR is not uploading, this should be upload with respective of field VPRSV. i make it as mandatory this field VPRSV.

WARNING MESSAGE COMING WHEN AM UPLODING

THE MBEW-VERPR IS longer than screen field.

pls help how to upload this verpr. this is a currency field.

is there any spl. process to upload currency fields.

****************************************************************************************

*******************************************************************************************

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MARA-MEINS'

ITAB-MEINS. "'EA'.

perform bdc_field using 'MARC-LOSGR'

'1'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

ITAB-MAKTX. "'CONSUMMABLE ITEM NAME'.

perform bdc_field using 'MBEW-BKLAS'

ITAB-BKLAS. "'2000'.

perform bdc_field using 'MBEW-PEINH'

itab-peinh. "'1'.

perform bdc_field using 'MBEW-VERPR'

itab-verpr. "'786.00'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM01'.

REFRESH BDCDATA.

CLEAR BDCDATA.

CLEAR ITAB.

ENDLOOP.

perform close_group.

FORM GET_CONSUMEITEMS_LIST.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'C:\Documents and Settings\Administrator\Desktop\CONSUME.txt'

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ITAB

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • FILE_OPEN_ERROR = 2

  • FILE_READ_ERROR = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • NO_AUTHORITY = 10

  • OTHERS = 11

.

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.