Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sending Mail

Former Member
0 Likes
798

Hi,

I want to add an option of sending mail in my code.First of all i explain my code, it consists of 4 menu's(MM,BOM,Routing,Product Version).I have already added the field of mail option. I have the code for mailing for single perform.But in this case i want to know whether i have to use single perform or with one common perform with some condition.with this i have pasted the code for one of the menu and the corresponding fields(selection Screen).I want the code of sending mail by using single perform (by using conditions) and selection screen of mail option with

4 common name for 4 fields.

Thanks For Advance Help

Selection Screen(MM):

form fieldcat_mm.

sort itab_mm by werks.

perform attr_fcat1 using :

'WERKS' 'X' '1' '0' 'PLANT' '4',

'MATNR' 'X' '1' '1' 'MATERIAL NO.' '18',

'MAKTX' 'X' '1' '2' 'DESCRIPTION.' '40',

'MBRSH' ' ' '1' '3' 'INDUSTRY SECTOR' '5',

'MTART' ' ' '1' '4' 'MATERIAL TYPE' '4',

'DISPO' ' ' '1' '5' 'MRP CONTROLLER' '4',

'LVORM' ' ' '1' '6' 'DELETION FLAG' '1',

'MSTAE' ' ' '1' '7' 'CROSS PLANT MATERIAL STATUS' '5',

'MEINS' ' ' '1' '8' 'UOM' '3',

'BISMT' ' ' '1' '9' 'OLD MATERIAL NO.' '18',

'SPART' ' ' '1' '10' 'DIVISION' '5',

'DISMM' ' ' '1' '11' 'MRP TYPE' '2',

'MINBE' ' ' '1' '12' 'REORDER POINT' '16',

'FXHOR' ' ' '1' '13' 'PLAN TIME FENCE' '5',

'LGPRO' ' ' '1' '14' 'PROD. STORAGE LOCATION' '5',

'DZEIT' ' ' '1' '15' 'INHOUSE PROD. DAYS' '5',

'PLIFZ' ' ' '1' '16' 'PLAN DELY TIME' '5',

'DISLS' ' ' '1' '17' 'LOT SIZE' '2',

'BSTFE' ' ' '1' '18' 'FIXED LOT SIZE' '16',

'BSTMA' ' ' '1' '19' 'MAX LOT SIZE' '16',

'BSTMI' ' ' '1' '20' 'MIN LOT SIZE' '16',

'MABST' ' ' '1' '21' 'MAX STOCK LEVEL' '16',

'BESKZ' ' ' '1' '22' 'PROC TYPE' '6',

'SOBSL' ' ' '1' '23' 'SPL PROC TYPE' '8',

'EISBE' ' ' '1' '24' 'SAFETY STOCK' '16',

'STRGR' ' ' '1' '25' 'STRATEGY GROUP' '5',

'VRMOD' ' ' '1' '26' 'CONSUMPTION MODE' '5',

'VINT1' ' ' '1' '27' 'BACKWARD CONSUMPTION' '5',

'VINT2' ' ' '1' '28' 'FORWARD CONSUMPTION' '5',

'ALTSL' ' ' '1' '29' 'SELECTION METHOD' '3',

'SBDKZ' ' ' '1' '30' 'COLLECTIVE IND.' '3',

'SAUFT' ' ' '1' '31' 'REPETITIVE MANFG. IND.' '3',

'SFEPR' ' ' '1' '32' 'REM PROFILE' '5',

'FEVOR' ' ' '1' '33' 'PROD. SCHEDULER' '5',

'SFCPF' ' ' '1' '34' 'PROD. SCHEDULER PROFILE' '5',

'BEARZ' ' ' '1' '35' 'PROCESSING TIME' '5',

'BASMZ' ' ' '1' '36' 'BASE QUANTITY' '16',

'USEQU' ' ' '1' '37' 'QUOTA ARRNGEMENT USAGE' '16',

'NCOST' ' ' '1' '38' 'DO NOT COST' '16'.

endform. "FIELDCAT_MM

Code For MM:

&----


*& Include ZPP_GETDATA

&----


type-pools : slis.

data: ls_fieldcat type slis_fieldcat_alv. "FIELD CATALOG LIST

data: gt_fieldcat type slis_fieldcat_alv occurs 0.

*DATA : gt_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0.

" fIELD CATALOG TABLE

*DATA: s_layout TYPE slis_layout_alv. " LIST LAYOUT.

types: s_event type slis_alv_event.

types: s_events type slis_t_event.

types : it_sort type slis_t_sortinfo_alv.

types : w_sort type slis_sortinfo_alv.

types: i_events type slis_t_event.

*DATA : dynitab TYPE ddshretval OCCURS 0.

field-symbols <fs> type standard table.

*FIELD-SYMBOLS <fs> TYPE ANY.

data : header_text(90) type c.

*DATA : FLAG.

--


TO DEFINE ATTRIBUTES FOR FIELD CATALOGS-----

&----


*& Form attr_fcat1 (Material Master)

&----


form attr_fcat1 using

fieldname type slis_fieldname

key type c

row_pos like sy-curow

col_pos like sy-cucol

seltext_l type dd03p-scrtext_l

outputlen type dd03p-outputlen.

ls_fieldcat-fieldname = fieldname.

ls_fieldcat-key = key.

ls_fieldcat-row_pos = row_pos.

ls_fieldcat-col_pos = col_pos.

ls_fieldcat-seltext_l = seltext_l.

ls_fieldcat-outputlen = outputlen.

append ls_fieldcat to gt_fieldcat.

clear ls_fieldcat.

endform. "attr_fcat1

/----


/

*/ Form attr_fcat2 (Bill Of Material) */

/----


/

form attr_fcat using

fieldname type slis_fieldname

  • key TYPE c

row_pos like sy-curow

col_pos like sy-cucol

seltext_l type dd03p-scrtext_l

outputlen type dd03p-outputlen.

ls_fieldcat-fieldname = fieldname.

  • ls_fieldcat-key = key.

ls_fieldcat-row_pos = row_pos.

ls_fieldcat-col_pos = col_pos.

ls_fieldcat-seltext_l = seltext_l.

ls_fieldcat-outputlen = outputlen.

append ls_fieldcat to gt_fieldcat.

clear ls_fieldcat.

endform. "attr_fcat

types : msgid type sy-msgid,

msgno type sy-msgno,

msgv1 type sy-msgv1,

msgv2 type sy-msgv2,

msgv3 type sy-msgv3,

msgv4 type sy-msgv4.

data : ct_tot type i." count

types: l_msg(4096) type c.

*data : l_src like abapsource OCCURS 10 WITH HEADER LINE.

*data : l_src type standard table of abapsource initial size 0.

*DATA: where_clause(75) TYPE c,

  • iwhere LIKE TABLE OF where_clause.

types : begin of ty_makt,

matnr type mara-matnr,

idnrk type stpo-idnrk,

maktx type makt-maktx, "MATERIAL DESCRIPTION

end of ty_makt.

data: itab_makt type standard table of ty_makt initial size 0,

wa_makt type ty_makt. "work area (header line)

types : begin of ty_mm,

werks type marc-werks, "1

matnr type mara-matnr, "2

maktx type makt-maktx, "3

dispo type marc-dispo, "4

lvorm type mara-lvorm, "5

mtart type mara-mtart, "6

meins type mara-meins, "7

mstae type mara-mstae, "8

mbrsh type mara-mbrsh, "9

bismt type mara-bismt, "10

spart type mara-spart, "11

  • satnr TYPE mara-satnr,

lgpro type marc-lgpro, "12

fxhor type marc-fxhor, "13

dzeit type marc-dzeit, "14

plifz type marc-plifz, "15

strgr type marc-strgr, "16

vrmod type marc-vrmod, "17

vint1 type marc-vint1, "18

vint2 type marc-vint2, "19

altsl type marc-altsl, "20

sbdkz type marc-sbdkz, "21

sauft type marc-sauft, "22

sfepr type marc-sfepr, "23

fevor type marc-fevor, "24

sfcpf type marc-sfcpf, "25

bearz type marc-bearz, "26

basmg type marc-basmg, "27

dismm type marc-dismm, "29

disls type marc-disls, "30

beskz type marc-beskz, "31

sobsl type marc-sobsl, "32

minbe type marc-minbe, "33

eisbe type marc-eisbe, "34

bstmi type marc-bstmi, "35

bstma type marc-bstma, "36

bstfe type marc-bstfe, "37

mabst type marc-mabst, "38

usequ type marc-usequ, "39

ncost type marc-ncost, "40

end of ty_mm.

data : itab_mm type standard table of ty_mm initial size 0,

wa_mm type ty_mm.

data : itab_mm1 type standard table of ty_mm initial size 0,

wa_mm1 type ty_mm.

&----


*& Form populate_mm

&----


  • text

----


types : begin of ty_stko,

matnr type mara-matnr,

maktx type makt-maktx,

mtart type mara-mtart,

werks type marc-werks,

beskz type marc-beskz,

sobsl type marc-sobsl,

stlal type mast-stlal,

stlan type mast-stlan,

bmeng type stko-bmeng,

bmein type stko-bmein,

stlnr type stko-stlnr,

stlty type stko-stlty,

  • matnr TYPE stpo-idnrk,

com_qty type stpo-menge,

posnr type stpo-posnr,

postp type stpo-postp,

idnrk type stpo-idnrk,

  • stlnr TYPE stpo-stlnr,

menge type stpo-menge, " comp qty

meins type stpo-meins, " com uom

lgort type stpo-lgort,

stlst type stko-stlst,

alpgr type stpo-alpgr, " ALTERNATIVE ITEM GRP

alprf type stpo-alprf, " RANKING ORDER

alpst type stpo-alpst, " STRATEGY

ewahr type stpo-ewahr, " USAGE PROB. %

itsob type stpo-itsob, " SPL PROC TYPE FOR BOM ITEM

upskz type stpo-upskz, " INDICATOR SUB ITEM LIST

bklas type mbew-bklas, " VALUATION CLASS

vprsv type mbew-vprsv, " PRICE CONTROL INDICATOR

peinh type mbew-peinh, " PRICE UNIT

stprs type mbew-stprs, " STANDARD PRICE

verpr type mbew-verpr, " MOVING AVERAGEPRICE

end of ty_stko.

data: itab_stko type standard table of ty_stko initial size 0,

wa_stko type ty_stko.

*TYPES : BEGIN OF ty_stpo,

  • matnr TYPE mara-matnr,

*/***********************************************************/

  • owerk TYPE marc-werks, "Original Plant

  • omatnr TYPE marc-matnr, "Original Material

  • stufe1(20) TYPE c, "Level with Dot

  • mngko TYPE csxgen-mngko, "Norms

  • wrk02 TYPE t460a-wrk02, "Inter Plant

*

*/***********************************************************/

  • maktx TYPE makt-maktx,

  • mtart TYPE mara-mtart,

  • werks TYPE marc-werks,

  • beskz TYPE marc-beskz,

  • sobsl TYPE marc-sobsl,

  • stlal TYPE mast-stlal,

  • stlan TYPE mast-stlan,

  • bmeng TYPE stko-bmeng,

  • bmein TYPE stko-bmein,

  • stlnr TYPE stko-stlnr,

  • stlty TYPE stko-stlty,

  • stlst TYPE stko-stlst,

*

  • posnr TYPE stpo-posnr,

  • postp TYPE stpo-postp,

  • idnrk TYPE stpo-idnrk,

*

*

  • menge TYPE stpo-menge, " comp qty

  • meins TYPE stpo-meins, " com uom

  • lgort TYPE stpo-lgort,

  • alpgr TYPE stpo-alpgr, " ALTERNATIVE ITEM GRP

  • alprf TYPE stpo-alprf, " RANKING ORDER

  • alpst TYPE stpo-alpst, " STRATEGY

  • ewahr TYPE stpo-ewahr, " USAGE PROB. %

  • itsob TYPE stpo-itsob, " SPL PROC TYPE FOR BOM ITEM

  • upskz TYPE stpo-upskz, " INDICATOR SUB ITEM LIST

  • bklas TYPE mbew-bklas, " VALUATION CLASS

  • vprsv TYPE mbew-vprsv, " PRICE CONTROL INDICATOR

  • peinh TYPE mbew-peinh, " PRICE UNIT

  • stprs TYPE mbew-stprs, " STANDARD PRICE

  • verpr TYPE mbew-verpr, " MOVING AVERAGEPRICE

*

  • END OF ty_stpo.

*DATA: itab_stpo TYPE STANDARD TABLE OF ty_stpo INITIAL SIZE 0,

  • wa_stpo TYPE ty_stpo.

types: begin of stpo_tab,

owerk type marc-werks, "Org. Plant

omatnr type marc-matnr, "Org. Material

bwerk type marc-werks, "Base Plant

matnr type marc-matnr, "Material

werks type marc-werks, "Plant No.

maktx type makt-maktx, "Assy. Material Description

mtart type mara-mtart, "Material Type

idnrk type stpo-idnrk, "Child Part No.

cmaktx type makt-maktx, "Child. Material Description

beskz type marc-beskz, "Procurement Type

lgort type csxgen-lgort, "Issue Loc

sobsl type marc-sobsl, "Spl. Proc. type

stlan type csxgen-stlan, "BOM Usage

meins type csxgen-meins, "UOM

stufe1(20) type c, "Level with dot

stufe type csxgen-stufe, "Level no.

menge type csxgen-menge, "Base Quantity

mngko type csxgen-mngko, "Norms

xmein type csxgen-xmein, "Base UOM

xmeng type csxgen-xmeng, "Base Quantity

ewahr type stpo-ewahr, "Usage Probability

itsob type csxgen-itsob, "BOM Spl. Proc. Type

posnr type csxgen-posnr, "BOM Item No.

vprsv type mbew-vprsv, "Price control Indicator

verpr type mbew-verpr, "Moving Average Price

stlal type mast-stlal, "Alternate BOM

stlst type stko-stlst, "BOM Status

stprs type mbew-stprs, "Standard Price

peinh type mbew-peinh, "Price Unit

bklas type mbew-bklas, "Valuation Class

wrk02 type t460a-wrk02, "Inter Plant

ekgrp type marc-ekgrp, "Purchasing Group

maabc type marc-maabc, "ABC Indicator

postp type csxgen-postp, "ITEM Category

dismm type marc-dismm, "MRP Type

dispo type marc-dispo, "MRP Controller

usequ type marc-usequ, "Quota Arrangement

kausf type marc-kausf, "component scrap %

ausme type marc-ausme, "Unit of Issue

sobsk type marc-sobsk, "spec Procurement Costing

matkl type mara-matkl, "Material Group

meins_i type mara-meins, "Basic Unit of issue

alpgr type csxgen-alpgr, "Alternate item group

alprf type csxgen-alprf, "Alternate item price

alpst type csxgen-alpst, "Alternate item strategy

end of stpo_tab.

data: itab_stpo type standard table of stpo_tab initial size 0,

wa_stpo type stpo_tab. "work area (header line)

types: begin of otpl_itab.

include structure t460a.

types: end of otpl_itab.

data : itab_otpl type standard table of otpl_itab initial size 0,

wa_otpl type otpl_itab.

types: begin of ty_mara,

matnr type mara-matnr, "Material

matkl type mara-matkl,

meins type mara-meins,

mtart type mara-mtart,

end of ty_mara.

data: itab_mara type standard table of ty_mara initial size 0,

wa_mara type ty_mara. "work area (header line)

data: stpo type table of csxgen,

stpo_wa like line of stpo.

/=====================================================================/

types: begin of marc_tab,

matnr type marc-matnr, "Material

werks type marc-werks, "Plant No.

beskz type marc-beskz,

sobsl type marc-sobsl,

ekgrp type marc-ekgrp, "Purchasing Group

maabc type marc-maabc, "ABC Indicator

dismm type marc-dismm, "MRP Type

dispo type marc-dispo, "MRP Controller

usequ type marc-usequ, "Quota Arrangement

kausf type marc-kausf, "component scrap %

ausme type marc-ausme, "Unit of Issue

sobsk type marc-sobsk, "spec Procurement Costing

end of marc_tab.

data: itab_marc type standard table of marc_tab initial size 0,

wa_marc type marc_tab. "work area (header line)

types : begin of ty_mbew,

matnr type mara-matnr,

bwkey type marc-werks,

bklas type mbew-bklas,

vprsv type mbew-vprsv,

peinh type mbew-peinh,

stprs type mbew-stprs,

verpr type mbew-verpr,

end of ty_mbew.

data : itab_mbew type standard table of ty_mbew initial size 0,

wa_mbew type ty_mbew.

&----


*& Form populate_mm

&----


  • text

----


form populate_mm.

select distinct

b~werks

b~matnr

b~lgpro

b~fxhor

b~dzeit

b~plifz

b~strgr

b~vrmod

b~vint1

b~vint2

b~altsl

b~sbdkz

b~sauft

b~sfepr

b~fevor

b~sfcpf

b~bearz

b~basmg

b~dismm

b~dispo

b~disls

b~beskz

b~sobsl

b~minbe

b~eisbe

b~bstmi

b~bstma

b~bstfe

b~mabst

b~usequ

b~ncost

from marc as b

into corresponding fields of table itab_mm

where b~werks in werks

and b~matnr in matnr

and b~dispo in dispo

and b~dismm in dismm

and b~sobsl in sobsl

and b~beskz in beskz.

sort itab_mm by matnr.

select distinct

a~matnr

a~lvorm

a~mtart

a~meins

a~mstae

a~mstae

a~mbrsh

a~bismt

a~spart

into corresponding fields of table itab_mm1

from mara as a

for all entries in itab_mm

where a~matnr = itab_mm-matnr

and a~mtart in mtart.

sort itab_mm1 by matnr.

select matnr maktx from makt

into corresponding fields of table itab_makt

for all entries in itab_mm1

where matnr = itab_mm1-matnr

and spras = 'EN'.

sort itab_makt by matnr.

loop at itab_mm into wa_mm.

read table itab_mm1 into wa_mm1 with key

matnr = wa_mm-matnr binary search.

wa_mm-lvorm = wa_mm1-lvorm.

wa_mm-mtart = wa_mm1-mtart.

wa_mm-meins = wa_mm1-meins.

wa_mm-mstae = wa_mm1-mstae.

wa_mm-mbrsh = wa_mm1-mbrsh.

wa_mm-bismt = wa_mm1-bismt.

wa_mm-spart = wa_mm1-spart.

read table itab_makt into wa_makt with key

matnr = wa_mm-matnr binary search.

wa_mm-maktx = wa_makt-maktx.

shift wa_mm-matnr left deleting leading '0'.

modify itab_mm from wa_mm.

clear : wa_mm, wa_mm1, wa_makt.

endloop.

assign itab_mm to <fs>.

header_text = text-022."'MATERIAL MASTER DATA DOWNLOAD'.

endform. "populate_mm

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
757

better to split ur program into 4 parts , call perform send_mail for each option.

Regards

Prabhu

Hi,

I want to add an option of sending mail in my code.First of all i explain my code, it consists of 4 menu's(MM,BOM,Routing,Product Version).I have already added the field of mail option. I have the code for mailing for single perform.But in this case i want to know whether i have to use single perform or with one common perform with some condition.with this i have pasted the code for one of the menu and the corresponding fields(selection Screen).I want the code of sending mail by using single perform (by using conditions) and selection screen of mail option with

4 common name for 4 fields.

Thanks For Advance Help

Selection Screen(MM):

form fieldcat_mm.

sort itab_mm by werks.

perform attr_fcat1 using :

'WERKS' 'X' '1' '0' 'PLANT' '4',

'MATNR' 'X' '1' '1' 'MATERIAL NO.' '18',

'MAKTX' 'X' '1' '2' 'DESCRIPTION.' '40',

'MBRSH' ' ' '1' '3' 'INDUSTRY SECTOR' '5',

'MTART' ' ' '1' '4' 'MATERIAL TYPE' '4',

'DISPO' ' ' '1' '5' 'MRP CONTROLLER' '4',

'LVORM' ' ' '1' '6' 'DELETION FLAG' '1',

'MSTAE' ' ' '1' '7' 'CROSS PLANT MATERIAL STATUS' '5',

'MEINS' ' ' '1' '8' 'UOM' '3',

'BISMT' ' ' '1' '9' 'OLD MATERIAL NO.' '18',

'SPART' ' ' '1' '10' 'DIVISION' '5',

'DISMM' ' ' '1' '11' 'MRP TYPE' '2',

'MINBE' ' ' '1' '12' 'REORDER POINT' '16',

'FXHOR' ' ' '1' '13' 'PLAN TIME FENCE' '5',

'LGPRO' ' ' '1' '14' 'PROD. STORAGE LOCATION' '5',

'DZEIT' ' ' '1' '15' 'INHOUSE PROD. DAYS' '5',

'PLIFZ' ' ' '1' '16' 'PLAN DELY TIME' '5',

'DISLS' ' ' '1' '17' 'LOT SIZE' '2',

'BSTFE' ' ' '1' '18' 'FIXED LOT SIZE' '16',

'BSTMA' ' ' '1' '19' 'MAX LOT SIZE' '16',

'BSTMI' ' ' '1' '20' 'MIN LOT SIZE' '16',

'MABST' ' ' '1' '21' 'MAX STOCK LEVEL' '16',

'BESKZ' ' ' '1' '22' 'PROC TYPE' '6',

'SOBSL' ' ' '1' '23' 'SPL PROC TYPE' '8',

'EISBE' ' ' '1' '24' 'SAFETY STOCK' '16',

'STRGR' ' ' '1' '25' 'STRATEGY GROUP' '5',

'VRMOD' ' ' '1' '26' 'CONSUMPTION MODE' '5',

'VINT1' ' ' '1' '27' 'BACKWARD CONSUMPTION' '5',

'VINT2' ' ' '1' '28' 'FORWARD CONSUMPTION' '5',

'ALTSL' ' ' '1' '29' 'SELECTION METHOD' '3',

'SBDKZ' ' ' '1' '30' 'COLLECTIVE IND.' '3',

'SAUFT' ' ' '1' '31' 'REPETITIVE MANFG. IND.' '3',

'SFEPR' ' ' '1' '32' 'REM PROFILE' '5',

'FEVOR' ' ' '1' '33' 'PROD. SCHEDULER' '5',

'SFCPF' ' ' '1' '34' 'PROD. SCHEDULER PROFILE' '5',

'BEARZ' ' ' '1' '35' 'PROCESSING TIME' '5',

'BASMZ' ' ' '1' '36' 'BASE QUANTITY' '16',

'USEQU' ' ' '1' '37' 'QUOTA ARRNGEMENT USAGE' '16',

'NCOST' ' ' '1' '38' 'DO NOT COST' '16'.

endform. "FIELDCAT_MM

Code For MM:

&----


*& Include ZPP_GETDATA

&----


type-pools : slis.

data: ls_fieldcat type slis_fieldcat_alv. "FIELD CATALOG LIST

data: gt_fieldcat type slis_fieldcat_alv occurs 0.

*DATA : gt_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0.

" fIELD CATALOG TABLE

*DATA: s_layout TYPE slis_layout_alv. " LIST LAYOUT.

types: s_event type slis_alv_event.

types: s_events type slis_t_event.

types : it_sort type slis_t_sortinfo_alv.

types : w_sort type slis_sortinfo_alv.

types: i_events type slis_t_event.

*DATA : dynitab TYPE ddshretval OCCURS 0.

field-symbols <fs> type standard table.

*FIELD-SYMBOLS <fs> TYPE ANY.

data : header_text(90) type c.

*DATA : FLAG.

--


TO DEFINE ATTRIBUTES FOR FIELD CATALOGS-----

&----


*& Form attr_fcat1 (Material Master)

&----


form attr_fcat1 using

fieldname type slis_fieldname

key type c

row_pos like sy-curow

col_pos like sy-cucol

seltext_l type dd03p-scrtext_l

outputlen type dd03p-outputlen.

ls_fieldcat-fieldname = fieldname.

ls_fieldcat-key = key.

ls_fieldcat-row_pos = row_pos.

ls_fieldcat-col_pos = col_pos.

ls_fieldcat-seltext_l = seltext_l.

ls_fieldcat-outputlen = outputlen.

append ls_fieldcat to gt_fieldcat.

clear ls_fieldcat.

endform. "attr_fcat1

/----


/

*/ Form attr_fcat2 (Bill Of Material) */

/----


/

form attr_fcat using

fieldname type slis_fieldname

  • key TYPE c

row_pos like sy-curow

col_pos like sy-cucol

seltext_l type dd03p-scrtext_l

outputlen type dd03p-outputlen.

ls_fieldcat-fieldname = fieldname.

  • ls_fieldcat-key = key.

ls_fieldcat-row_pos = row_pos.

ls_fieldcat-col_pos = col_pos.

ls_fieldcat-seltext_l = seltext_l.

ls_fieldcat-outputlen = outputlen.

append ls_fieldcat to gt_fieldcat.

clear ls_fieldcat.

endform. "attr_fcat

types : msgid type sy-msgid,

msgno type sy-msgno,

msgv1 type sy-msgv1,

msgv2 type sy-msgv2,

msgv3 type sy-msgv3,

msgv4 type sy-msgv4.

data : ct_tot type i." count

types: l_msg(4096) type c.

*data : l_src like abapsource OCCURS 10 WITH HEADER LINE.

*data : l_src type standard table of abapsource initial size 0.

*DATA: where_clause(75) TYPE c,

  • iwhere LIKE TABLE OF where_clause.

types : begin of ty_makt,

matnr type mara-matnr,

idnrk type stpo-idnrk,

maktx type makt-maktx, "MATERIAL DESCRIPTION

end of ty_makt.

data: itab_makt type standard table of ty_makt initial size 0,

wa_makt type ty_makt. "work area (header line)

types : begin of ty_mm,

werks type marc-werks, "1

matnr type mara-matnr, "2

maktx type makt-maktx, "3

dispo type marc-dispo, "4

lvorm type mara-lvorm, "5

mtart type mara-mtart, "6

meins type mara-meins, "7

mstae type mara-mstae, "8

mbrsh type mara-mbrsh, "9

bismt type mara-bismt, "10

spart type mara-spart, "11

  • satnr TYPE mara-satnr,

lgpro type marc-lgpro, "12

fxhor type marc-fxhor, "13

dzeit type marc-dzeit, "14

plifz type marc-plifz, "15

strgr type marc-strgr, "16

vrmod type marc-vrmod, "17

vint1 type marc-vint1, "18

vint2 type marc-vint2, "19

altsl type marc-altsl, "20

sbdkz type marc-sbdkz, "21

sauft type marc-sauft, "22

sfepr type marc-sfepr, "23

fevor type marc-fevor, "24

sfcpf type marc-sfcpf, "25

bearz type marc-bearz, "26

basmg type marc-basmg, "27

dismm type marc-dismm, "29

disls type marc-disls, "30

beskz type marc-beskz, "31

sobsl type marc-sobsl, "32

minbe type marc-minbe, "33

eisbe type marc-eisbe, "34

bstmi type marc-bstmi, "35

bstma type marc-bstma, "36

bstfe type marc-bstfe, "37

mabst type marc-mabst, "38

usequ type marc-usequ, "39

ncost type marc-ncost, "40

end of ty_mm.

data : itab_mm type standard table of ty_mm initial size 0,

wa_mm type ty_mm.

data : itab_mm1 type standard table of ty_mm initial size 0,

wa_mm1 type ty_mm.

&----


*& Form populate_mm

&----


  • text

----


types : begin of ty_stko,

matnr type mara-matnr,

maktx type makt-maktx,

mtart type mara-mtart,

werks type marc-werks,

beskz type marc-beskz,

sobsl type marc-sobsl,

stlal type mast-stlal,

stlan type mast-stlan,

bmeng type stko-bmeng,

bmein type stko-bmein,

stlnr type stko-stlnr,

stlty type stko-stlty,

  • matnr TYPE stpo-idnrk,

com_qty type stpo-menge,

posnr type stpo-posnr,

postp type stpo-postp,

idnrk type stpo-idnrk,

  • stlnr TYPE stpo-stlnr,

menge type stpo-menge, " comp qty

meins type stpo-meins, " com uom

lgort type stpo-lgort,

stlst type stko-stlst,

alpgr type stpo-alpgr, " ALTERNATIVE ITEM GRP

alprf type stpo-alprf, " RANKING ORDER

alpst type stpo-alpst, " STRATEGY

ewahr type stpo-ewahr, " USAGE PROB. %

itsob type stpo-itsob, " SPL PROC TYPE FOR BOM ITEM

upskz type stpo-upskz, " INDICATOR SUB ITEM LIST

bklas type mbew-bklas, " VALUATION CLASS

vprsv type mbew-vprsv, " PRICE CONTROL INDICATOR

peinh type mbew-peinh, " PRICE UNIT

stprs type mbew-stprs, " STANDARD PRICE

verpr type mbew-verpr, " MOVING AVERAGEPRICE

end of ty_stko.

data: itab_stko type standard table of ty_stko initial size 0,

wa_stko type ty_stko.

*TYPES : BEGIN OF ty_stpo,

  • matnr TYPE mara-matnr,

*/***********************************************************/

  • owerk TYPE marc-werks, "Original Plant

  • omatnr TYPE marc-matnr, "Original Material

  • stufe1(20) TYPE c, "Level with Dot

  • mngko TYPE csxgen-mngko, "Norms

  • wrk02 TYPE t460a-wrk02, "Inter Plant

*

*/***********************************************************/

  • maktx TYPE makt-maktx,

  • mtart TYPE mara-mtart,

  • werks TYPE marc-werks,

  • beskz TYPE marc-beskz,

  • sobsl TYPE marc-sobsl,

  • stlal TYPE mast-stlal,

  • stlan TYPE mast-stlan,

  • bmeng TYPE stko-bmeng,

  • bmein TYPE stko-bmein,

  • stlnr TYPE stko-stlnr,

  • stlty TYPE stko-stlty,

  • stlst TYPE stko-stlst,

*

  • posnr TYPE stpo-posnr,

  • postp TYPE stpo-postp,

  • idnrk TYPE stpo-idnrk,

*

*

  • menge TYPE stpo-menge, " comp qty

  • meins TYPE stpo-meins, " com uom

  • lgort TYPE stpo-lgort,

  • alpgr TYPE stpo-alpgr, " ALTERNATIVE ITEM GRP

  • alprf TYPE stpo-alprf, " RANKING ORDER

  • alpst TYPE stpo-alpst, " STRATEGY

  • ewahr TYPE stpo-ewahr, " USAGE PROB. %

  • itsob TYPE stpo-itsob, " SPL PROC TYPE FOR BOM ITEM

  • upskz TYPE stpo-upskz, " INDICATOR SUB ITEM LIST

  • bklas TYPE mbew-bklas, " VALUATION CLASS

  • vprsv TYPE mbew-vprsv, " PRICE CONTROL INDICATOR

  • peinh TYPE mbew-peinh, " PRICE UNIT

  • stprs TYPE mbew-stprs, " STANDARD PRICE

  • verpr TYPE mbew-verpr, " MOVING AVERAGEPRICE

*

  • END OF ty_stpo.

*DATA: itab_stpo TYPE STANDARD TABLE OF ty_stpo INITIAL SIZE 0,

  • wa_stpo TYPE ty_stpo.

types: begin of stpo_tab,

owerk type marc-werks, "Org. Plant

omatnr type marc-matnr, "Org. Material

bwerk type marc-werks, "Base Plant

matnr type marc-matnr, "Material

werks type marc-werks, "Plant No.

maktx type makt-maktx, "Assy. Material Description

mtart type mara-mtart, "Material Type

idnrk type stpo-idnrk, "Child Part No.

cmaktx type makt-maktx, "Child. Material Description

beskz type marc-beskz, "Procurement Type

lgort type csxgen-lgort, "Issue Loc

sobsl type marc-sobsl, "Spl. Proc. type

stlan type csxgen-stlan, "BOM Usage

meins type csxgen-meins, "UOM

stufe1(20) type c, "Level with dot

stufe type csxgen-stufe, "Level no.

menge type csxgen-menge, "Base Quantity

mngko type csxgen-mngko, "Norms

xmein type csxgen-xmein, "Base UOM

xmeng type csxgen-xmeng, "Base Quantity

ewahr type stpo-ewahr, "Usage Probability

itsob type csxgen-itsob, "BOM Spl. Proc. Type

posnr type csxgen-posnr, "BOM Item No.

vprsv type mbew-vprsv, "Price control Indicator

verpr type mbew-verpr, "Moving Average Price

stlal type mast-stlal, "Alternate BOM

stlst type stko-stlst, "BOM Status

stprs type mbew-stprs, "Standard Price

peinh type mbew-peinh, "Price Unit

bklas type mbew-bklas, "Valuation Class

wrk02 type t460a-wrk02, "Inter Plant

ekgrp type marc-ekgrp, "Purchasing Group

maabc type marc-maabc, "ABC Indicator

postp type csxgen-postp, "ITEM Category

dismm type marc-dismm, "MRP Type

dispo type marc-dispo, "MRP Controller

usequ type marc-usequ, "Quota Arrangement

kausf type marc-kausf, "component scrap %

ausme type marc-ausme, "Unit of Issue

sobsk type marc-sobsk, "spec Procurement Costing

matkl type mara-matkl, "Material Group

meins_i type mara-meins, "Basic Unit of issue

alpgr type csxgen-alpgr, "Alternate item group

alprf type csxgen-alprf, "Alternate item price

alpst type csxgen-alpst, "Alternate item strategy

end of stpo_tab.

data: itab_stpo type standard table of stpo_tab initial size 0,

wa_stpo type stpo_tab. "work area (header line)

types: begin of otpl_itab.

include structure t460a.

types: end of otpl_itab.

data : itab_otpl type standard table of otpl_itab initial size 0,

wa_otpl type otpl_itab.

types: begin of ty_mara,

matnr type mara-matnr, "Material

matkl type mara-matkl,

meins type mara-meins,

mtart type mara-mtart,

end of ty_mara.

data: itab_mara type standard table of ty_mara initial size 0,

wa_mara type ty_mara. "work area (header line)

data: stpo type table of csxgen,

stpo_wa like line of stpo.

/=====================================================================/

types: begin of marc_tab,

matnr type marc-matnr, "Material

werks type marc-werks, "Plant No.

beskz type marc-beskz,

sobsl type marc-sobsl,

ekgrp type marc-ekgrp, "Purchasing Group

maabc type marc-maabc, "ABC Indicator

dismm type marc-dismm, "MRP Type

dispo type marc-dispo, "MRP Controller

usequ type marc-usequ, "Quota Arrangement

kausf type marc-kausf, "component scrap %

ausme type marc-ausme, "Unit of Issue

sobsk type marc-sobsk, "spec Procurement Costing

end of marc_tab.

data: itab_marc type standard table of marc_tab initial size 0,

wa_marc type marc_tab. "work area (header line)

types : begin of ty_mbew,

matnr type mara-matnr,

bwkey type marc-werks,

bklas type mbew-bklas,

vprsv type mbew-vprsv,

peinh type mbew-peinh,

stprs type mbew-stprs,

verpr type mbew-verpr,

end of ty_mbew.

data : itab_mbew type standard table of ty_mbew initial size 0,

wa_mbew type ty_mbew.

&----


*& Form populate_mm

&----


  • text

----


form populate_mm.

select distinct

b~werks

b~matnr

b~lgpro

b~fxhor

b~dzeit

b~plifz

b~strgr

b~vrmod

b~vint1

b~vint2

b~altsl

b~sbdkz

b~sauft

b~sfepr

b~fevor

b~sfcpf

b~bearz

b~basmg

b~dismm

b~dispo

b~disls

b~beskz

b~sobsl

b~minbe

b~eisbe

b~bstmi

b~bstma

b~bstfe

b~mabst

b~usequ

b~ncost

from marc as b

into corresponding fields of table itab_mm

where b~werks in werks

and b~matnr in matnr

and b~dispo in dispo

and b~dismm in dismm

and b~sobsl in sobsl

and b~beskz in beskz.

sort itab_mm by matnr.

select distinct

a~matnr

a~lvorm

a~mtart

a~meins

a~mstae

a~mstae

a~mbrsh

a~bismt

a~spart

into corresponding fields of table itab_mm1

from mara as a

for all entries in itab_mm

where a~matnr = itab_mm-matnr

and a~mtart in mtart.

sort itab_mm1 by matnr.

select matnr maktx from makt

into corresponding fields of table itab_makt

for all entries in itab_mm1

where matnr = itab_mm1-matnr

and spras = 'EN'.

sort itab_makt by matnr.

loop at itab_mm into wa_mm.

read table itab_mm1 into wa_mm1 with key

matnr = wa_mm-matnr binary search.

wa_mm-lvorm = wa_mm1-lvorm.

wa_mm-mtart = wa_mm1-mtart.

wa_mm-meins = wa_mm1-meins.

wa_mm-mstae = wa_mm1-mstae.

wa_mm-mbrsh = wa_mm1-mbrsh.

wa_mm-bismt = wa_mm1-bismt.

wa_mm-spart = wa_mm1-spart.

read table itab_makt into wa_makt with key

matnr = wa_mm-matnr binary search.

wa_mm-maktx = wa_makt-maktx.

shift wa_mm-matnr left deleting leading '0'.

modify itab_mm from wa_mm.

clear : wa_mm, wa_mm1, wa_makt.

endloop.

assign itab_mm to <fs>.

header_text = text-022."'MATERIAL MASTER DATA DOWNLOAD'.

endform. "populate_mm

2 REPLIES 2
Read only

Former Member
0 Likes
758

better to split ur program into 4 parts , call perform send_mail for each option.

Regards

Prabhu

Read only

0 Likes
757

Hi Prabhu,

Your Suggestion is very much helped in solving my problem.I have divide my

Code in to 4 groups and used the switch case condition.Finally i have applied your

Suggestion.It worked out.

Thanks a lot.

regards,

Pradeep