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

about material master data batch input

Former Member
0 Likes
799

hello

i wrote a batch input for material master data. but it can't work ,i can't use it to create material.hope someone help me!thanks.code is below.

report z_mat_batchinput no standard page heading

line-size 255 message-id YB.

*----

-


  • mat batch input

*----

-


include bdcrecx1.

include .

tables: mara,marm,MARC,MARD,T134,NRIV,T006A,T023,T001W,T001L,

TVKO,TVTW,T025,TTGR,TLGR,TVKWZ,T006.

data: DIMID like t006-DIMID.

data: flag, K, tmp.

DATA: X TYPE I.

************ÉÏÔØÎļþÄÚ±í************************

data: begin of record occurs 0,

MATNR(018), " ÎïÁϺÅ

MTART(004), " ÎïÁÏÀàÐÍ

**generaldata1**

MAKTX(040), " ÎïÁÏÃèÊö

  • EAKTX(040), " Ó¢ÎÄÃèÊö

MEINS(003), " »ù±¾¼ÆÁ¿µ¥Î»

MATKL(009), " ÎïÁÏ×é

BISMT(018), " ¾ÉÎïÁϺÅ

  • EXTWG(018), " ÍⲿÎïÁÏ×é

  • SPART(002), " ²¿ÃÅ

MTPOS_MARA(004), " ÆÕͨÏîÄ¿Àà±ð×é

BRGEW(017), " Ã«ÖØ

GEWEI(003), " ÖØÁ¿µ¥Î»

NTGEW(017), " ¾»ÖØ

VOLUM(017), " Ìå»ý

VOLEH(003), " Ìå»ýµ¥Î»

GROES(032), " Á¿¸Ù

MAGRV(004), " ÎïÁÏ×éµÄ°ü×°Îï

**generaldata2**

NORMT(018), " ¹¤Òµ±ê×¼ÃèÊö

FERTH(018), " ÀàÐÍ

WRKST(048), " ¹æ¸ñ

**generaldata1**

  • EAN11(018), " ²úÆ·±íʶÂë

**generaldata2**

  • ZEIAR(003), " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ

WERKS(004), " ¹¤³§

VKORG(004), " ÏúÊÛ×éÖ¯

VTWEG(002), " ·ÖÏúÇþµÀ

**salesorg 1**

  • VRKME(003), " ÏúÊÛµ¥Î»

  • VMREN(006), " ÏúÊÛµ¥Î»×ª»»Òò×Ó

  • VMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

SPART(002), " ²úÆ·×é

DWERK(004), " ½»»õ¹¤³§

TAXKM(001), " ÎïÁÏ˰·ÖÀà

**salesorg 2**

KONDM(002), " ÎïÁ϶¨¼Û×é

KTGRM(002), " ¿ÆÄ¿ÉèÖÃ×é

  • MVGR1(003), " ÎïÁÏ×é 1

  • MVGR2(003), " ÎïÁÏ×é 2

MTPOS(004), " ÏîÄ¿Àà±ð×é

  • VERSG(001), " ÎïÁÏͳ¼Æ×é

**ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**

MTVFP(002), " ¿ÉÓÃÐÔ¼ì²é

XCHPF(001), " Åú´Î¹ÜÀí

  • YCHPF(001), " ÅúÁ¿¹ÜÀí

TRAGR(004), " ÔËÊä×é

ladgr(004), " ×°ÔØ×é

**pur**

  • BSTME(003), " ¶©µ¥µ¥Î»

  • UMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

  • UMREN(006), " ¶©µ¥µ¥Î»×ª»»Òò×Ó

  • WEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä

EKGRP(003), " ²É¹º×é

  • LGORT(004), " ¿â´æµØ

**Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**

  • AUSME(003), " ·¢»õµ¥Î»

  • UMREJ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

  • UMREF(006), " ·¢»õµ¥Î»×ª»»Òò×Ó

  • XCHPF(001), " ÅúÁ¿¹ÜÀí

**MRP 1**

  • DISGR(004), " MRP×é

DISMM(002), " MRPÀàÐÍ

  • FXHOR(003), " ¼Æ»®µÄʱ½ì

DISPO(003), " MRP¿ØÖÆÕß

DISLS(002), " ÅúÁ¿

MAABC(001), " ABC±êʶ

  • BSTFE(018), " ¹Ì¶¨ÅúÁ¿´óС

**MRP 2**

  • RESKZ(001), " »ñÈ¡ÀàÐÍ

BESKZ(001), " ²É¹ºÀàÐÍ

  • SOBSL(002), " ÌØÊâ²É¹ºÀà

  • LGPRO(004), " ·¢»õ²Ö´¢µØµã

  • RGEKZ(001), " ·´³å

PLIFZ(003), " ¼Æ»®½»»õʱ¼ä

  • VEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä

DZEIT(008), "×ÔÖÆÉú²ú

FHORI(003), " ¼Æ»®±ß¼ÊÂë

  • EISBE(018), " °²È«¿â´æ

**MRP 3**

PERKZ(001), " ÆÚ¼ä±êʶ

STRGR(002), " ²ßÂÔ×é

  • VRMOD(001), " ÏûºÄģʽ

  • VINT1(003), " ÄæÏòÏûºÄÆÚ¼ä

  • VINT2(003), " ÏòǰÏûºÄÆÚ¼ä

NTVFP(002), " ¿ÉÓÃÐÔ¼ì²é

**MRP 4**

  • SAUFT(001), " ÖØ¸´ÖÆÔì±êÖ¾

  • SFEPR(004), " ÖØ¸´Éú²ú²ÎÊýÎļþ

**¹¤×÷¼Æ»®**

  • FEVOR(003), " Éú²úµ÷¶ÈÔ±

  • FRTME(003), " Éú²úµ¥Î»

  • SMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

  • SMREN(006), " Éú²úµ¥Î»×ª»»Òò×Ó

  • UEETK(001), " ÎÞÏÞÖÆ¹ýÁ¿½»»õ

**»á¼Æ 1**

BKLAS(004), " ÆÀ¹ÀÀà

  • BWTTY(001), " ¹À¼Û·ÖÀà

VPRSV(001), " ¼Û¸ñ¿ØÖÆ

PEINH(006), " ¼Û¸ñµ¥Î»

VERPR(015), " ÒÆ¶¯Æ½¾ù¼Û

STPRS(015), " ±ê×¼¼Û

**»á¼Æ 2**

  • BWPRH(014), " ÉÌÒµ¼Û¸ñ 1

**³É±¾ 1**

  • LOSGR(018), " ÅúÁ¿³É±¾ºËËã

**³É±¾ 2**

  • ZPLP1(014), " ¼Æ»®¼Û¸ñ 1

  • ZPLD1(010), " ¼Æ»®ÈÕÆÚ 1

**qm**

ART1(8), "¼ìÑéÀàÐÍ1

AKTIV1(1), "ÒѼ¤»î

QMPUR(1), "¼¤»î²É¹ºÖÐµÄ QM

SSQSS(8), "QM ¿ØÖÆÂë¡¢

  • QMATV(8), "QM¼ìÑéÉèÖÃ

  • ART2(8), "¼ìÑéÀàÐÍ2

  • AKTIV2(6), "ÒѼ¤»î

  • ART3(8), "¼ìÑéÀàÐÍ3

  • AKTIV3(6), "ÒѼ¤»î

end of record.

************ÏÂÔØ¸ñʽ/´íÎóÎļþÄÚ±í**************

data: begin of record1 occurs 0,

MATNR(018), " ÎïÁϺÅ

MTART(008), " ÎïÁÏÀàÐÍ

**»ù±¾Êý¾Ý1**

MAKTX(040), " ÎïÁÏÃèÊö

  • EAKTX(040), " Ó¢ÎÄÃèÊö

MEINS(013), " »ù±¾¼ÆÁ¿µ¥Î»

MATKL(009), " ÎïÁÏ×é

BISMT(018), " ¾ÉÎïÁϺÅ

  • EXTWG(018), " ÍⲿÎïÁÏ×é

  • SPART(002), " ²¿ÃÅ

MTPOS_MARA(004), " ÆÕͨÏîÄ¿Àà±ð×é

BRGEW(017), " Ã«ÖØ

GEWEI(008), " ÖØÁ¿µ¥Î»

NTGEW(017), " ¾»ÖØ

VOLUM(017), " Ìå»ý

VOLEH(008), " Ìå»ýµ¥Î»

GROES(032), " Á¿¸Ù

MAGRV(014), " ÎïÁÏ×éµÄ°ü×°Îï

**»ù±¾Êý¾Ý2**

NORMT(018), " ¹¤Òµ±ê×¼ÃèÊö

FERTH(018), " ÀàÐÍ

WRKST(048), " ¹æ¸ñ

**»ù±¾Êý¾Ý1**

  • EAN11(018), " ²úÆ·±íʶÂë

**»ù±¾Êý¾Ý2**

  • ZEIAR(003), " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ

WERKS(004), " ¹¤³§

VKORG(008), " ÏúÊÛ×éÖ¯

VTWEG(008), " ·ÖÏúÇþµÀ

**ÏúÊÛ×éÖ¯ 1**

  • VRKME(003), " ÏúÊÛµ¥Î»

  • VMREN(006), " ÏúÊÛµ¥Î»×ª»»Òò×Ó

  • VMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

SPART(006), " ²úÆ·×é

DWERK(008), " ½»»õ¹¤³§

TAXKM(010), " ÎïÁÏ˰·ÖÀà

**ÏúÊÛ×éÖ¯ 2**

KONDM(010), " ÎïÁ϶¨¼Û×é

KTGRM(010), " ¿ÆÄ¿ÉèÖÃ×é

  • MVGR1(003), " ÎïÁÏ×é 1

  • MVGR2(003), " ÎïÁÏ×é 2

MTPOS(010), " ÏîÄ¿Àà±ð×é

  • VERSG(001), " ÎïÁÏͳ¼Æ×é

**ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**

MTVFP(010), " ¿ÉÓÃÐÔ¼ì²é

XCHPF(008), " Åú´Î¹ÜÀí

  • YCHPF(001), " ÅúÁ¿¹ÜÀí

TRAGR(006), " ÔËÊä×é

ladgr(006), " ×°ÔØ×é

**²É¹º**

  • BSTME(003), " ¶©µ¥µ¥Î»

  • UMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

  • UMREN(006), " ¶©µ¥µ¥Î»×ª»»Òò×Ó

  • WEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä

EKGRP(006), " ²É¹º×é

  • LGORT(004), " ¿â´æµØ

**Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**

  • AUSME(003), " ·¢»õµ¥Î»

  • UMREJ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

  • UMREF(006), " ·¢»õµ¥Î»×ª»»Òò×Ó

  • XCHPF(001), " ÅúÁ¿¹ÜÀí

**MRP 1**

  • DISGR(004), " MRP×é

DISMM(009), " MRPÀàÐÍ

  • FXHOR(003), " ¼Æ»®µÄʱ½ì

DISPO(011), " MRP¿ØÖÆÕß

DISLS(004), " ÅúÁ¿

MAABC(007), " ABC±êʶ

  • BSTFE(018), " ¹Ì¶¨ÅúÁ¿´óС

**MRP 2**

  • RESKZ(001), " »ñÈ¡ÀàÐÍ

BESKZ(008), " ²É¹ºÀàÐÍ

  • SOBSL(002), " ÌØÊâ²É¹ºÀà

  • LGPRO(004), " ·¢»õ²Ö´¢µØµã

  • RGEKZ(001), " ·´³å

PLIFZ(012), " ¼Æ»®½»»õʱ¼ä

  • VEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä

DZEIT(008), "×ÔÖÆÉú²ú

FHORI(010), " ¼Æ»®±ß¼ÊÂë

  • EISBE(018), " °²È«¿â´æ

**MRP 3**

PERKZ(008), " ÆÚ¼ä±êʶ

STRGR(006), " ²ßÂÔ×é

  • VRMOD(001), " ÏûºÄģʽ

  • VINT1(003), " ÄæÏòÏûºÄÆÚ¼ä

  • VINT2(003), " ÏòǰÏûºÄÆÚ¼ä

NTVFP(010), " ¿ÉÓÃÐÔ¼ì²é

**MRP 4**

  • SAUFT(001), " ÖØ¸´ÖÆÔì±êÖ¾

  • SFEPR(004), " ÖØ¸´Éú²ú²ÎÊýÎļþ

**¹¤×÷¼Æ»®**

  • FEVOR(003), " Éú²úµ÷¶ÈÔ±

  • FRTME(003), " Éú²úµ¥Î»

  • SMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó

  • SMREN(006), " Éú²úµ¥Î»×ª»»Òò×Ó

  • UEETK(001), " ÎÞÏÞÖÆ¹ýÁ¿½»»õ

**»á¼Æ 1**

BKLAS(006), " ÆÀ¹ÀÀà

  • BWTTY(001), " ¹À¼Û·ÖÀà

VPRSV(008), " ¼Û¸ñ¿ØÖÆ

PEINH(008), " ¼Û¸ñµ¥Î»

VERPR(015), " ÒÆ¶¯Æ½¾ù¼Û

STPRS(015), " ±ê×¼¼Û

**»á¼Æ 2**

  • BWPRH(014), " ÉÌÒµ¼Û¸ñ 1

**³É±¾ 1**

  • LOSGR(018), " ÅúÁ¿³É±¾ºËËã

**³É±¾ 2**

  • ZPLP1(014), " ¼Æ»®¼Û¸ñ 1

  • ZPLD1(010), " ¼Æ»®ÈÕÆÚ 1

**ÖÊÁ¿¹ÜÀí**

ART1(8), "¼ìÑéÀàÐÍ1

AKTIV1(6), "ÒѼ¤»î

QMPUR(010), "¼¤»î²É¹ºÖÐµÄ QM

SSQSS(8), "QM ¿ØÖÆÂë¡¢

  • QMATV(8), "QM¼ìÑéÉèÖÃ

  • ART2(8), "¼ìÑéÀàÐÍ2

  • AKTIV2(6), "ÒѼ¤»î

  • ART3(8), "¼ìÑéÀàÐÍ3

  • AKTIV3(6), "ÒѼ¤»î

end of record1.

selection-screen begin of block 0 with frame title text-001.

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

selection-screen begin of line .

selection-screen position 1.

parameters: test like rkec1-test .

selection-screen

comment 3(4) text-004 for field test.

selection-screen position 26.

parameters: oldfile like rlgrap-filename.

selection-screen

comment 9(17) text-003 for field oldfile.

selection-screen: end of line.

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

selection-screen begin of line.

selection-screen position 1.

parameters: dnldflag like rkec1-test default 'X'.

selection-screen

comment 3(4) text-005 for field dnldflag.

selection-screen position 26.

parameters: outfile like rlgrap-filename .

selection-screen

comment 9(17) text-006 for field outfile.

selection-screen: end of line.

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

selection-screen end of block 0 .

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-002.

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

selection-screen begin of line.

selection-screen position 1.

PARAMETERS: GEN1 LIKE RKEC1-TEST.

selection-screen

comment 3(9) text-007 for field GEN1.

selection-screen position 26.

PARAMETERS: GEN2 LIKE RKEC1-TEST.

selection-screen

comment 28(9) text-008 for field GEN2.

selection-screen end of line.

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

selection-screen begin of line.

selection-screen position 1.

PARAMETERS: SALORG1 LIKE RKEC1-TEST.

selection-screen

comment 3(21) text-009 for field SALORG1.

selection-screen position 26.

PARAMETERS: SALORG2 LIKE RKEC1-TEST.

selection-screen

comment 28(21) text-010 for field SALORG2.

selection-screen position 51.

PARAMETERS: SALPLANT LIKE RKEC1-TEST.

selection-screen

comment 53(19) text-011 for field SALPLANT.

selection-screen end of line.

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

selection-screen begin of line.

selection-screen position 1.

PARAMETERS: PURCHASE LIKE RKEC1-TEST.

selection-screen

comment 3(21) text-012 for field PURCHASE.

selection-screen position 26.

PARAMETERS: PLTSTRG1 LIKE RKEC1-TEST.

selection-screen

comment 28(21) text-018 for field PLTSTRG1.

selection-screen end of line.

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

selection-screen begin of line.

selection-screen position 1.

PARAMETERS: MRP1 LIKE RKEC1-TEST.

selection-screen

comment 3(4) text-013 for field MRP1.

selection-screen position 13.

PARAMETERS: MRP2 LIKE RKEC1-TEST.

selection-screen

comment 15(4) text-014 for field MRP2.

selection-screen position 26.

PARAMETERS: MRP3 LIKE RKEC1-TEST.

selection-screen

comment 28(4) text-015 for field MRP3.

selection-screen position 37.

PARAMETERS: MRP4 LIKE RKEC1-TEST.

selection-screen

comment 39(4) text-016 for field MRP4.

selection-screen position 51.

PARAMETERS: PLANTSTR LIKE RKEC1-TEST.

selection-screen

comment 53(8) text-017 for field PLANTSTR.

selection-screen end of line.

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

selection-screen begin of line.

selection-screen position 1.

PARAMETERS: QAU LIKE RKEC1-TEST.

selection-screen

comment 3(8) text-023 for field QAU.

selection-screen position 13.

PARAMETERS: ACC1 LIKE RKEC1-TEST.

selection-screen

comment 15(5) text-019 for field ACC1.

selection-screen position 26.

PARAMETERS: ACC2 LIKE RKEC1-TEST.

selection-screen

comment 28(5) text-020 for field ACC2.

selection-screen position 37.

PARAMETERS: COR1 LIKE RKEC1-TEST.

selection-screen

comment 39(5) text-021 for field COR1.

selection-screen position 51.

PARAMETERS: COR2 LIKE RKEC1-TEST.

selection-screen

comment 53(5) text-022 for field COR2.

selection-screen end of line.

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

SELECTION-SCREEN END OF BLOCK 1.

at selection-screen on value-request for oldfile.

call function 'KD_GET_FILENAME_ON_F4'

EXPORTING

mask = ',Îı¾Îļþ(ÖÆ±í·û·Ö¸ô),*.txt'

static = 'X'

CHANGING

file_name = oldfile.

at selection-screen on value-request for outfile.

call function 'KD_GET_FILENAME_ON_F4'

EXPORTING

mask = ',Microsoft Excel¹¤×÷²¾,*.xls'

static = 'X'

CHANGING

file_name = outfile.

initialization.

******µÃµ½ÎļþĿ¼*******

call function 'WS_QUERY'

EXPORTING

query = 'CD'

IMPORTING

return = outfile.

if sy-subrc <> 0.

message e005 with outfile.

endif.

oldfile = outfile.

concatenate outfile 'mat_fat' into outfile.

*ÅúÊäÈëĬÈÏÃû³Æ

group = 'MATBATCHIN'.

start-of-selection.

if dnldflag eq 'X' and not ( outfile is initial ).

perform download_data.

stop.

endif.

perform upload_data.

if test = ' '.

*ÊÓͼ²ÎÊý¼ì²é

IF ( GEN1 NE 'X' AND GEN2 NE 'X' AND SALORG1 NE 'X'

AND SALORG2 NE 'X' AND SALPLANT NE 'X'

AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'

AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'

AND MRP4 NE 'X' AND PLANTSTR NE 'X'

AND ACC1 NE 'X' AND ACC2 NE 'X'

AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .

MESSAGE E000 WITH 'ÇëÑ¡ÔñÐèά»¤ÊÓͼ'.

ENDIF.

perform open_group.

SORT RECORD BY WERKS MATNR.

loop at record.

perform bdc_fill.

perform bdc_transaction using 'MM01'.

clear: bdcdata.

refresh: bdcdata.

endloop.

perform close_group.

else.

perform file_check.

endif.

end-of-selection.

*&----

-


*& Form UPLOAD_DATA

*&----

-


  • ÉÏÔØÅúÊäÈëÊý¾Ý

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


form upload_data.

call function 'WS_UPLOAD'

EXPORTING

filename = oldfile

filetype = 'DAT'

TABLES

data_tab = record

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_table_width = 4

invalid_type = 5

no_batch = 6

unknown_error = 7

gui_refuse_filetransfer = 8

customer_error = 9

others = 10.

if sy-subrc <> 0.

message E000 with 'ÇëÊäÈëÉÏÔØÎļþ'.

endif.

read table record with key MATNR = '**'.

if sy-tabix lt 1.

message E000 with 'ÉÏÔØÎļþÎļþÍ·ÓëÊý¾ÝÖ®¼äÎÞ**'.

endif.

delete record from 1 to sy-tabix.

endform. " UPLOAD_DATA

*&----

-


*& Form BDC_FILL

*&----

-


  • ÅúÊäÈë

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


form bdc_fill.

data: N type I,

M type I,

S_MATNR(018),

test(1) type N.

PERFORM BDC_FILL_INITALSCR. "³õʼÆÁÄ»

tmp = '0'.

condense record-matnr no-gaps.

test = record-matnr(1).

if test <> ''.

M = STRLEN( RECORD-MATNR ).

M = 18 - M.

DO M TIMES.

CONCATENATE '0' RECORD-MATNR INTO S_MATNR.

RECORD-MATNR = S_MATNR.

ENDDO.

endif.

**ÅжÏÎïÁÏ»ù±¾ÊÓͼÊÇ·ñÒѾ­±»Î¬»¤¹ý**

SELECT SINGLE * FROM MARA WHERE MATNR = RECORD-MATNR.

IF SY-SUBRC NE 0.

K = '0'.

Else.

condense MARA-PSTAT no-gaps.

N = strlen( mara-pstat ).

M = 0.

record-meins = mara-meins.

do N times.

K = MARA-PSTAT+M.

IF K = 'K'.

EXIT.

ENDIF.

M = M + 1.

enddo.

ENDIF.

IF ( ( GEN1 EQ 'X' OR GEN2 EQ 'X' ) AND SALORG1 NE 'X'

AND SALORG2 NE 'X' AND SALPLANT NE 'X'

AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'

AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'

AND MRP4 NE 'X' AND PLANTSTR NE 'X'

AND ACC1 NE 'X' AND ACC2 NE 'X'

AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .

IF K EQ 'K'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(15)'.

perform bdc_field using 'BDC_OKCODE'

'/N'.

ELSE.

PERFORM BDC_FILL_CHOICEVIEW. "Ñ¡ÔñÊÓͼ

ENDIF.

ELSE.

PERFORM BDC_FILL_CHOICEVIEW. "Ñ¡ÔñÊÓͼ

PERFORM BDC_FILL_ORGVIEW. "×éÖ¯¼¶±ð

ENDIF.

TRANSLATE record-MEINS TO UPPER CASE.

  • TRANSLATE record-BSTME TO UPPER CASE.

  • TRANSLATE record-VRKME TO UPPER CASE.

  • TRANSLATE record-FRTME TO UPPER CASE.

  • TRANSLATE record-AUSME TO UPPER CASE.

if gen1 eq 'X'.

IF K NE 'K'.

PERFORM GENERALDATA1.

ENDIF.

endif.

if gen2 eq 'X'.

IF K NE 'K'.

perform generaldata2.

ENDIF.

endif.

if salorg1 eq 'X'.

perform salorg1.

endif.

if salorg2 eq 'X'.

perform salorg2.

endif.

if salplant eq 'X'.

perform salplant.

endif.

if purchase eq 'X'.

perform purchasedata.

endif.

if mrp1 eq 'X'.

perform MRP1.

endif.

if mrp2 eq 'X'.

perform MRP2.

endif.

if mrp3 eq 'X'.

perform MRP3.

endif.

if mrp4 eq 'X'.

perform MRP4.

endif.

if PLANTSTR eq 'X'.

perform PLANTSTR.

endif.

if PLTSTRG1 eq 'X'.

perform PLTSTRG1.

endif.

if qau eq 'X'.

perform qualitydata.

endif.

if ACC1 eq 'X'.

perform ACC1DATA.

endif.

if ACC2 eq 'X'.

perform ACC2DATA.

endif.

if COR1 eq 'X'.

perform COR1DATA.

endif.

if COR2 eq 'X'.

perform COR2DATA.

endif.

perform BDC_SAVE.

endform. " BDC_FILL

*&----


*

*& Form GENERALDATA1

*&----


*

  • Ò»°ãÊý¾Ý 1

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form generaldata1.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

"'=ZU01'.

'/00'.

perform bdc_field using 'MAKT-MAKTX'

record-MAKTX. " ÎïÁÏÃèÊö

perform bdc_field using 'MARA-MEINS'

record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»

perform bdc_field using 'MARA-MATKL'

record-MATKL. " ÎïÁÏ×é

perform bdc_field using 'MARA-BISMT'

record-BISMT.

  • perform bdc_field using 'MARA-EXTWG'

  • record-EXTWG.

  • perform bdc_field using 'MARA-SPART'

  • record-SPART.

perform bdc_field using 'MARA-MTPOS_MARA'

record-MTPOS_MARA.

perform bdc_field using 'BDC_CURSOR'

'MARA-GROES'.

perform bdc_field using 'MARA-BRGEW'

record-BRGEW.

if record-gewei = '' and ( salorg1 = 'X' or salorg2 = 'X'

or salplant = 'X' ).

perform bdc_field using 'MARA-GEWEI'

'KG'. " ÖØÁ¿µ¥Î»

else.

perform bdc_field using 'MARA-GEWEI'

record-GEWEI. " ÖØÁ¿µ¥Î»

endif.

perform bdc_field using 'MARA-NTGEW'

record-NTGEW.

perform bdc_field using 'MARA-VOLUM'

record-VOLUM.

perform bdc_field using 'MARA-VOLEH'

record-VOLEH.

perform bdc_field using 'MARA-GROES'

record-GROES.

  • condense record-EAN11 no-gaps.

  • if record-EAN11 <> ''.

  • perform bdc_field using 'MARA-EAN11'

  • record-EAN11.

  • perform bdc_field using 'MARA-NUMTP'

  • 'HT'.

  • endif.

perform bdc_field using 'MARA-MAGRV'

record-MAGRV.

  • perform bdc_dynpro using 'SAPLMGMM' '4300'.

  • perform bdc_field using 'BDC_OKCODE'

  • '=ZU02'.

  • condense record-EAKTX no-gaps.

  • if record-EAKTX <> ''.

  • perform bdc_field using 'SKTEXT-SPRAS(2)'

  • 'EN'.

  • perform bdc_field using 'SKTEXT-MAKTX(2)'

  • record-EAKTX.

  • endif.

  • perform bdc_dynpro using 'SAPLMGMM' '4300'.

  • perform bdc_field using 'BDC_OKCODE'

  • '=MAIN'.

  • if record-meins <> 'PAK'.

  • perform bdc_field using 'SMEINH-UMREN(05)'

  • '1'.

  • perform bdc_field using 'SMEINH-MEINH(05)'

  • 'PAK'.

  • perform bdc_field using 'SMEINH-UMREZ(05)'

  • '1'.

  • endif.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

endform. " GENERALDATA

*&----


*

*& Form generaldata2

*&----


*

  • Ò»°ãÊý¾Ý 2

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM generaldata2.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

record-MAKTX.

perform bdc_field using 'BDC_CURSOR'

'MARA-NORMT'.

condense record-ferth no-gaps.

if record-ferth <> ''.

perform bdc_field using 'MARA-FERTH'

record-FERTH.

endif.

perform bdc_field using 'MARA-NORMT'

record-NORMT.

perform bdc_field using 'MARA-WRKST'

record-WRKST.

  • perform bdc_field using 'MARA-ZEIAR'

  • record-ZEIAR.

ENDFORM. " generaldata2

*&----


*

*& Form salorg1

*&----


*

  • ÏúÊÛ×éÖ¯ 1

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM salorg1.

condense RECORD-SPART no-gaps.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'MAKT-MAKTX'

RECORD-MAKTX. " ÎïÁÏÃèÊö

IF K NE 'K'.

perform bdc_field using 'MARA-MEINS'

record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»

ENDIF.

perform bdc_field using 'MARA-SPART'

record-SPART. " ²úÆ·×é

perform bdc_field using 'MVKE-DWERK'

record-DWERK. " ½»»õ¹¤³§

PERFORM BDC_FIELD USING 'MG03STEUER-TAXKM(01)'

RECORD-TAXKM. " ÎïÁÏ˰·ÖÀà

  • condense RECORD-VRKME no-gaps.

  • IF RECORD-MEINS <> RECORD-VRKME and RECORD-VRKME <> ''.

  • perform bdc_field using 'MVKE-VRKME'

  • record-VRKME. " ÏúÊÛµ¥Î»

  • select single * from MARM where matnr = record-matnr

  • and meinh = record-vrkme.

  • if SY-SUBRC NE 0.

  • tmp = 'W'.

  • select single * from t006 where MSEHI = record-meins.

  • if t006-DIMID = 'AAAADL'.

  • DIMID = ''.

  • else.

  • DIMID = t006-DIMID.

  • endif.

  • select single * from t006 where MSEHI = record-vrkme.

  • if dimid <> t006-DIMID.

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '=ENTR'.

  • perform bdc_field using 'RMMZU-UMREN'

  • record-VMREN. "ÏúÊÛµ¥Î»×ª»»Òò×Ó

  • perform bdc_field using 'RMMZU-UMREZ'

  • record-VMREZ. "»ù±¾µ¥Î»×ª»»Òò×Ó

*

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/00'.

  • endif.

  • endif.

  • ENDIF.

perform bdc_dynpro using 'SAPLMGMM' '4200'.

perform bdc_field using 'BDC_OKCODE' " µ÷ÓÃ˰Àà×ÓÆÁÄ»

'/00'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' " ·µ»ØÏúÊÛ×éÖ¯ 1ÆÁÄ»

'/00'.

ENDFORM. " salorg1

*&----


*

*& Form salorg2

*&----


*

  • ÏúÊÛ×éÖ¯ 2

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM salorg2.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'MVKE-KTGRM'.

  • PERFORM BDC_FIELD USING 'MVKE-VERSG'

  • RECORD-VERSG. " ÎïÁÏͳ¼Æ×é

PERFORM BDC_FIELD USING 'MVKE-KTGRM'

RECORD-KTGRM. " ¿ÆÄ¿ÉèÖÃ×é

PERFORM BDC_FIELD USING 'MVKE-KONDM'

RECORD-KONDM. " ÎïÁ϶¨¼Û×é

perform bdc_field using 'MVKE-MTPOS'

RECORD-MTPOS. " ÏîÄ¿Àà±ð×é

  • PERFORM BDC_FIELD USING 'MVKE-MVGR1'

  • RECORD-MVGR1. " ÎïÁÏ×é 1

  • PERFORM BDC_FIELD USING 'MVKE-MVGR2'

  • RECORD-MVGR2. " ÎïÁÏ×é 2

ENDFORM. " salorg2

*&----


*

*& Form salplant

*&----


*

  • ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM salplant.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

select single * from marc where matnr = record-matnr

and werks = record-werks.

if SY-SUBRC NE 0 OR MARC-MTVFP = ''.

PERFORM BDC_FIELD USING 'MARC-MTVFP'

RECORD-MTVFP. " ¿ÉÓÃÐÔ¼ì²é

endif.

PERFORM BDC_FIELD USING 'MARA-TRAGR'

RECORD-TRAGR. " ÔËÊä×é

PERFORM BDC_FIELD USING 'MARC-LADGR'

RECORD-LADGR. " ×°ÔØ×é

perform bdc_field using 'MARC-XCHPF'

record-XCHPF. " ÅúÁ¿¹ÜÀí

ENDFORM. " salplant

*&----


*

*& Form PURCHASEDATA

*&----


*

  • ²É¹ºÊý¾Ý

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form purchasedata.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MARC-WEBAZ'.

perform bdc_field using 'MAKT-MAKTX'

record-MAKTX.

IF K NE 'K'.

perform bdc_field using 'MARA-MEINS'

record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»

perform bdc_field using 'MARA-MATKL'

record-MATKL. " ÎïÁÏ×é

ENDIF.

  • condense RECORD-BSTME no-gaps.

  • IF RECORD-MEINS <> RECORD-BSTME and RECORD-BSTME <> ''.

  • perform bdc_field using 'MARA-BSTME'

  • record-BSTME. " ¶©µ¥µ¥Î»

  • select single * from MARM where matnr = record-matnr

  • and meinh = record-bstme.

  • if SY-SUBRC NE 0 and

  • ( record-vrkme <> record-bstme or tmp <> 'W' ).

  • tmp = 'W'.

  • select single * from t006 where MSEHI = record-meins.

  • if t006-DIMID = 'AAAADL'.

  • DIMID = ''.

  • else.

  • DIMID = t006-DIMID.

  • endif.

  • select single * from t006 where MSEHI = record-bstme.

  • if dimid <> t006-DIMID.

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '=ENTR'.

  • perform bdc_field using 'RMMZU-UMREN'

  • record-UMREN. "¶©µ¥µ¥Î»×ª»»Òò×Ó

  • perform bdc_field using 'RMMZU-UMREZ'

  • record-UMREZ. "»ù±¾µ¥Î»×ª»»Òò×Ó

*

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/00'.

  • endif.

  • endif.

  • ENDIF.

perform bdc_field using 'MARC-EKGRP'

record-EKGRP. " ²É¹º×é

  • perform bdc_field using 'MARC-WEBAZ'

  • record-WEBAZ. " ÊÕ»õ´¦Àíʱ¼ä

endform. " PURCHASEDATA

*&----


*

*& Form MRP1

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM MRP1.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

  • IF K NE 'K'.

  • perform bdc_field using 'MARA-MEINS'

  • record-MEINS. " »ù±¾µ¥Î»

  • ENDIF.

  • perform bdc_field using 'MARC-DISGR'

  • record-DISGR. " MRP×é

perform bdc_field using 'MARC-MAABC'

record-MAABC. " ABC±êʶ

perform bdc_field using 'MARC-DISMM'

record-DISMM. " MRPÀàÐÍ

  • perform bdc_field using 'MARC-FXHOR'

  • record-FXHOR. " ¼Æ»®µÄʱ½ì

perform bdc_field using 'MARC-DISPO'

record-DISPO. " MRP¿ØÖÆÕß

perform bdc_field using 'MARC-DISLS'

record-DISLS. " ÅúÁ¿

  • perform bdc_field using 'MARC-BSTFE'

  • record-BSTFE. " ¹Ì¶¨ÅúÁ¿´óС

ENDFORM. " MRP1

*&----


*

*& Form MRP2

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM MRP2.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

if record-mtart <> 'ERSA' and record-mtart <> 'ROH1'

and record-mtart <> 'ROH'.

perform bdc_field using 'MARC-BESKZ'

record-BESKZ. " »ñÈ¡ÀàÐÍ

endif.

  • perform bdc_field using 'MARC-SOBSL'

  • record-SOBSL. " ÌØÊâ²É¹ºÀà

  • perform bdc_field using 'MARC-LGPRO'

  • record-LGPRO. " ·¢»õ²Ö´¢µØµã

  • perform bdc_field using 'MARC-RGEKZ'

  • record-RGEKZ. " ·´³å

perform bdc_field using 'MARC-PLIFZ'

record-PLIFZ. " ¼Æ»®½»»õʱ¼ä

perform bdc_field using 'MARC-DZEIT'

record-DZEIT. " ×ÔÖÆÉú²ú

  • perform bdc_field using 'MARC-WEBAZ'

  • record-VEBAZ. " ÊÕ»õ´¦Àíʱ¼ä

perform bdc_field using 'MARC-FHORI'

record-FHORI. " ¼Æ»®±ß¼ÊÂë

  • perform bdc_field using 'MARC-EISBE'

  • record-EISBE. " °²È«¿â´æ

ENDFORM. " MRP2

*&----


*

*& Form MRP3

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM MRP3.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

perform bdc_field using 'MARC-PERKZ'

record-PERKZ. " ÆÚ¼ä±êʶ

perform bdc_field using 'MARC-STRGR'

record-STRGR. " ²ßÂÔ×é

  • perform bdc_field using 'MARC-VRMOD'

  • record-VRMOD. " ÏûºÄģʽ

  • perform bdc_field using 'MARC-VINT1'

  • record-VINT1. " ÄæÏòÏûºÄÆÚ¼ä

  • perform bdc_field using 'MARC-VINT2'

  • record-VINT2. " ÏòǰÏûºÄÆÚ¼ä

select single * from marc where matnr = record-matnr

and werks = record-werks.

if SY-SUBRC NE 0 OR MARC-MTVFP = ''.

perform bdc_field using 'MARC-MTVFP'

record-NTVFP. " ¿ÉÓÃÐÔ¼ì²é

endif.

ENDFORM. " MRP3

*&----


*

*& Form MRP4

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM MRP4.

  • perform bdc_dynpro using 'SAPLMGMM' '4000'.

  • perform bdc_field using 'BDC_OKCODE'

  • '/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

  • perform bdc_field using 'MARC-SAUFT'

  • record-SAUFT. " ÖØ¸´ÖÆÔì±êÖ¾

  • perform bdc_field using 'MARC-SFEPR'

  • record-SFEPR. " ÖØ¸´Éú²ú²ÎÊýÎļþ

ENDFORM. " MRP4

*&----


*

*& Form PLANTSTR

*&----


*

  • ¹¤×÷¼Æ»®

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM PLANTSTR.

  • perform bdc_dynpro using 'SAPLMGMM' '4000'.

  • perform bdc_field using 'BDC_OKCODE'

  • '/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

  • IF K NE 'K'.

  • perform bdc_field using 'MARA-MEINS'

  • record-MEINS. " »ù±¾µ¥Î»

  • ENDIF.

  • perform bdc_field using 'MARC-FEVOR'

  • record-FEVOR. " Éú²úµ÷¶ÈÔ±

  • perform bdc_field using 'MARC-UEETK'

  • record-UEETK. " ÎÞÏÞÖÆ¹ýÁ¿½»»õ

  • condense RECORD-FRTME no-gaps.

  • IF RECORD-MEINS <> RECORD-FRTME ."and RECORD-FRTME <> ''.

  • perform bdc_field using 'MARC-FRTME'

  • record-FRTME. " Éú²úµ¥Î»

  • select single * from MARM where matnr = record-matnr

  • and meinh = record-frtme.

  • if SY-SUBRC NE 0 and ( tmp <> 'W' or record-vrkme <> record-frtme

  • and record-bstme <> record-frtme ).

  • tmp = 'W'.

  • select single * from t006 where MSEHI = record-meins.

  • if t006-DIMID = 'AAAADL'.

  • DIMID = ''.

  • else.

  • DIMID = t006-DIMID.

  • endif.

  • select single * from t006 where MSEHI = record-frtme.

  • if dimid <> t006-DIMID.

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '=ENTR'.

  • perform bdc_field using 'RMMZU-UMREN'

  • record-SMREN.

*"Éú²úµ¥Î»×ª»»Òò×Ó

  • perform bdc_field using 'RMMZU-UMREZ'

  • record-SMREZ.

*"»ù±¾µ¥Î»×ª»»Òò×Ó

*

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/00'.

  • endif.

  • endif.

  • endif.

ENDFORM. " PLANTSTR

*&----

-


*& Form PLTSTRG1

*&----

-


  • Ò»°ã¹¤³§Êý¾Ý/²Ö´¢ 1

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


form PLTSTRG1.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX.

  • perform bdc_field using 'BDC_CURSOR'

  • 'MARC-XCHPF'.

  • IF K NE 'K'.

  • perform bdc_field using 'MARA-MEINS'

  • record-MEINS.

  • ENDIF.

  • condense RECORD-AUSME no-gaps.

  • IF RECORD-MEINS <> RECORD-AUSME and RECORD-AUSME <> ''.

  • perform bdc_field using 'MARC-AUSME'

  • record-AUSME. " ·¢»õµ¥Î»

  • select single * from MARM where matnr = record-matnr

  • and meinh = record-ausme.

  • if SY-SUBRC NE 0 and ( tmp <> 'W' or record-vrkme <> record-ausme

  • and record-bstme <> record-ausme

  • and record-frtme <> record-ausme ).

  • select single * from t006 where MSEHI = record-meins.

  • if t006-DIMID = 'AAAADL'.

  • DIMID = ''.

  • else.

  • DIMID = t006-DIMID.

  • endif.

  • select single * from t006 where MSEHI = record-ausme.

  • if dimid <> t006-DIMID.

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '=ENTR'.

  • perform bdc_field using 'RMMZU-UMREN'

  • record-UMREf. "·¢»õµ¥Î»×ª»»Òò×Ó

  • perform bdc_field using 'RMMZU-UMREZ'

  • record-UMREj. "»ù±¾µ¥Î»×ª»»Òò×Ó

*

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/00'.

  • endif.

  • endif.

  • ENDIF.

  • perform bdc_field using 'MARC-XCHPF'

  • record-XCHPF. " ÅúÁ¿¹ÜÀí

  • perform bdc_field using 'MARA-IPRKZ'

  • ''.

endform. " PLTSTRG1

*&----

-


*

*& Form ACC1DATA

*&----

-


*

  • »á¼Æ 1

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM ACC1DATA.

  • condense record-bwtty no-gaps.

condense record-vprsv no-gaps.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

  • IF K NE 'K'.

  • perform bdc_field using 'MARA-MEINS'

  • record-MEINS. " »ù±¾µ¥Î»

  • ENDIF.

  • PERFORM BDC_FIELD USING 'MBEW-BWTTY'

  • record-BWTTY. " ¹À¼Û·ÖÀà

PERFORM BDC_FIELD USING 'MBEW-BKLAS'

record-BKLAS. " ÆÀ¹ÀÀà

PERFORM BDC_FIELD USING 'MBEW-VPRSV'

record-VPRSV. " ¼Û¸ñ¿ØÖÆ

PERFORM BDC_FIELD USING 'MBEW-PEINH'

record-peinh. " ¼Û¸ñµ¥Î»

condense record-VPRSV no-gaps.

PERFORM BDC_FIELD USING 'MBEW-STPRS'

record-STPRS. " ±ê×¼¼Û

PERFORM BDC_FIELD USING 'MBEW-VERPR'

record-VERPR. " ÒÆ¶¯Æ½¾ù¼Û

ENDFORM. " ACC1DATA

*&----

-


*

*& Form ACC2DATA

*&----

-


*

  • »á¼Æ 2

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM ACC2DATA.

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

  • perform bdc_field using 'MBEW-BWPRH'

  • record-BWPRH. " ÉÌÒµ¼Û¸ñ 1

ENDFORM. " ACC2DATA

*&----


*

*& Form COR1DATA

*&----


*

  • ³É±¾ 1

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM COR1DATA.

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

  • IF K NE 'K'.

  • perform bdc_field using 'MARA-MEINS'

  • record-MEINS. " »ù±¾µ¥Î»

  • ENDIF.

  • PERFORM BDC_FIELD USING 'MBEW-HKMAT'

  • 'X'. " ÎïÁÏÀ´Ô´

  • condense record-losgr.

  • X = strlen( record-losgr ).

  • if X <> 0.

  • PERFORM BDC_FIELD USING 'MARC-LOSGR'

  • record-LOSGR. " ÅúÁ¿³É±¾ºËËã

  • else.

  • PERFORM BDC_FIELD USING 'MARC-LOSGR'

  • '1'. " ÅúÁ¿³É±¾ºËËã

  • endif.

ENDFORM. " COR1DATA

*&----


*

*& Form COR2DATA

*&----


*

  • ³É±¾ 2

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM COR2DATA.

  • PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

  • PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/00'.

  • perform bdc_field using 'MAKT-MAKTX'

  • record-MAKTX. " ÎïÁÏÃèÊö

  • perform bdc_field using 'MBEW-ZPLP1'

  • record-ZPLP1. " ¼Æ»®¼Û¸ñ1

  • PERFORM BDC_FIELD USING 'MBEW-ZPLD1'

  • record-ZPLD1. " ¼Æ»®ÈÕÆÚ1

ENDFORM. " COR2DATA

*&----

-


*& Form DOWNLOAD_DATA

*&----

-


  • ÏÂÔØ¸ñʽ

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


form download_data.

refresh record1.

clear record1.

record1-MATNR = 'ÎïÁϺÅÂë'.

record1-MTART = 'ÎïÁÏÀàÐÍ'.

record1-WERKS = '¹¤³§'.

  • record1-LGORT = '¿â´æµØ'.

record1-VKORG = 'ÏúÊÛ×éÖ¯'.

record1-VTWEG = '·ÖÏúÇþµÀ'.

**»ù±¾Êý¾Ý1**

record1-MAKTX = 'ÎïÁÏÃèÊö'.

  • record1-EAKTX = 'Ó¢ÎÄÃèÊö'.

record1-MEINS = '»ù±¾¼ÆÁ¿µ¥Î»'.

record1-MATKL = 'ÎïÁÏ×é'.

record1-BISMT = '¾ÉÎïÁϺÅ'.

  • record1-EXTWG = 'ÍⲿÎïÁÏ×é'.

  • record1-SPART = '²¿ÃÅ'.

record1-MTPOS_MARA = 'ÆÕͨÏîÄ¿Àà±ð×é'.

record1-BRGEW = 'Ã«ÖØ'.

record1-GEWEI = 'ÖØÁ¿µ¥Î»'.

record1-NTGEW = '¾»ÖØ'.

record1-VOLUM = 'Ìå»ý'.

record1-VOLEH = 'Ìå»ýµ¥Î»'.

record1-GROES = 'Á¿¸Ù'.

record1-MAGRV = 'ÎïÁÏ×éµÄ°ü×°Îï'.

**»ù±¾Êý¾Ý2**

record1-NORMT = '¹¤Òµ±ê×¼ÃèÊö'.

record1-FERTH = 'ÀàÐÍ'.

record1-WRKST = '¹æ¸ñ'.

**»ù±¾Êý¾Ý1**

  • record1-EAN11 = '²úÆ·±íʶÂë'.

**»ù±¾Êý¾Ý2**

  • RECORD1-ZEIAR = 'ºÏÀí´¢±¸ÖÜתÆÚ'.

**ÏúÊÛ×éÖ¯ 1**

  • record1-VRKME = 'ÏúÊÛµ¥Î»'.

  • record1-VMREZ = '»ù±¾µ¥Î»×ª»»Òò×Ó'.

  • record1-VMREN = 'ÏúÊÛµ¥Î»×ª»»Òò×Ó'.

RECORD1-SPART = '²úÆ·×é'.

record1-DWERK = '½»»õ¹¤³§'.

record1-TAXKM = 'ÎïÁÏ˰·ÖÀà'.

**ÏúÊÛ×éÖ¯ 2**

record1-KONDM = 'ÎïÁ϶¨¼Û×é'.

record1-KTGRM = '¿ÆÄ¿ÉèÖÃ×é'.

record1-MTPOS = 'ÏîÄ¿Àà±ð×é'.

  • record1-MVGR1 = 'ÎïÁÏ×é1'.

  • record1-MVGR2 = 'ÎïÁÏ×é2'.

  • record1-VERSG = 'ÎïÁÏͳ¼Æ×é'.

**ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**

record1-MTVFP = '¿ÉÓÃÐÔ¼ì²é'.

record1-TRAGR = 'ÔËÊä×é'.

record1-ladgr = '×°ÔØ×é'.

record1-XCHPF = 'ÅúÁ¿¹ÜÀí'.

**²É¹º**

  • record1-BSTME = '¶©µ¥µ¥Î»'.

  • record1-UMREZ = '»ù±¾µ¥Î»×ª»»Òò×Ó'.

  • record1-UMREN = '¶©µ¥µ¥Î»×ª»»Òò×Ó'.

  • record1-WEBAZ = 'ÊÕ»õ´¦Àíʱ¼ä'.

record1-EKGRP = '²É¹º×é'.

**MRP 1**

  • record1-DISGR = 'MRP×é'.

record1-MAABC = 'ABC±êʶ'.

record1-DISMM = 'MRPÀàÐÍ'.

  • record1-FXHOR = '¼Æ»®µÄʱ½ì'.

record1-DISPO = 'MRP¿ØÖÆÕß'.

record1-DISLS = 'ÅúÁ¿'.

  • record1-BSTFE = '¹Ì¶¨ÅúÁ¿´óС'.

**MRP 2**

record1-BESKZ = '»ñÈ¡ÀàÐÍ'.

  • record1-SOBSL = 'ÌØÊâ²É¹ºÀà'.

  • record1-LGPRO = '·¢»õ²Ö´¢µØµã'.

  • record1-RGEKZ = '·´³å'.

record1-PLIFZ = '¼Æ»®½»»õʱ¼ä'.

record1-DZEIT = '×ÔÖÆÉú²ú'.

  • record1-VEBAZ = 'ÊÕ»õ´¦Àíʱ¼ä'.

record1-FHORI = '¼Æ»®±ß¼ÊÂë'.

  • record1-EISBE = '°²È«¿â´æ'.

**MRP 3**

record1-PERKZ = 'ÆÚ¼ä±êʶ'.

record1-STRGR = '²ßÂÔ×é'.

  • record1-VRMOD = 'ÏûºÄģʽ'.

  • record1-VINT1 = 'ÄæÏòÏûºÄÆÚ¼ä'.

  • record1-VINT2 = 'ÏòǰÏûºÄÆÚ¼ä'.

record1-NTVFP = '¿ÉÓÃÐÔ¼ì²é'.

**MRP 4**

  • record1-SAUFT = 'ÖØ¸´ÖÆÔì±êÖ¾'.

  • record1-SFEPR = 'ÖØ¸´Éú²ú²ÎÊýÎļþ'.

**¹¤×÷¼Æ»®**

  • record1-FEVOR = 'Éú²úµ÷¶ÈÔ±'.

  • record1-FRTME = 'Éú²úµ¥Î»'.

  • record1-SMREZ = '»ù±¾µ¥Î»×ª»»Òò×Ó'.

  • record1-SMREN = 'Éú²úµ¥Î»×ª»»Òò×Ó'.

  • record1-UEETK = 'ÎÞÏÞÖÆ¹ýÁ¿½»»õ'.

**Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**

  • record1-AUSME = '·¢»õµ¥Î»'.

  • record1-UMREJ = '»ù±¾µ¥Î»×ª»»Òò×Ó'.

  • record1-UMREF = '·¢»õµ¥Î»×ª»»Òò×Ó'.

record1-XCHPF = 'ÅúÁ¿¹ÜÀí'.

**»á¼Æ 1**

  • record1-BWTTY = '¹À¼Û·ÖÀà'.

record1-BKLAS = 'ÆÀ¹ÀÀà'.

record1-VPRSV = '¼Û¸ñ¿ØÖÆ'.

record1-PEINH = '¼Û¸ñµ¥Î»'.

record1-VERPR = 'ÒÆ¶¯Æ½¾ù¼Û'.

record1-STPRS = '±ê×¼¼Û¸ñ'.

**»á¼Æ 2**

  • record1-BWPRH = 'ÉÌÒµ¼Û¸ñ1'.

**³É±¾ 1**

  • record1-LOSGR = 'ÅúÁ¿³É±¾ºËËã'.

**³É±¾ 2**

  • record1-ZPLP1 = '¼Æ»®¼Û¸ñ1'.

  • record1-ZPLD1 = '¼Æ»®ÈÕÆÚ1'.

**ÖÊÁ¿¹ÜÀí**

record1-QMPUR = 'QM²É¹º¼¤»î'.

record1-SSQSS = 'QM¿ØÖÆÂë'.

  • record1-QMATV = '¼ìÑéÉèÖÃ'.

record1-ART1 = '¼ìÑéÀàÐÍ1'.

record1-AKTIV1 = '¼¤»îµÄ'.

  • record1-ART2 = '¼ìÑéÀàÐÍ2'.

  • record1-AKTIV2 = '¼¤»îµÄ'.

  • record1-ART3 = '¼ìÑéÀàÐÍ3'.

  • record1-AKTIV3 = '¼¤»îµÄ'.

append record1.

clear record1.

record1-MATNR = '***' .

append record1.

clear record1.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

filename = outfile

FILETYPE = 'DAT'

tables

data_tab = record1

EXCEPTIONS

FILE_WRITE_ERROR = 1

OTHERS = 22

.

  • call function 'GUI_DOWNLOAD'

  • EXPORTING

  • filename = outfile

  • filetype = 'DAT'

  • TABLES

  • data_tab = record1

  • EXCEPTIONS

  • file_open_error = 1

  • file_write_error = 2.

if sy-subrc <> 0.

write: / icon_red_light as icon, 'ÏÂÔØÎ´³É¹¦'.

else.

write: / icon_green_light as icon, 'ÏÂÔØ³É¹¦,ÎļþÃû£º',

outfile.

write: / ' ÇëÓÃEXCEL´ò¿ª'.

endif.

endform. " DOWNLOAD_DATA

*&----

-


*& Form FILE_CHECK

*&----

-


  • ¼ì²éÉÏÔØÊý¾Ý

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


form file_check.

data M type I.

X = 3.

flag = 0.

loop at record.

  • ¼ì²éÎïÁϱàÂë

if record-matnr is initial.

write : at /5 icon_red_light as icon , X ,'ÐÐÎïÁϱàÂë²»ÄÜΪ¿Õ'.

flag = 1.

else.

M = STRLEN( record-matnr ).

if M > 12.

write : at /5 icon_red_light as icon , X ,'ÐÐÎïÁϱàÂë´íÎó'.

flag = 1.

endif.

endif.

  • ¼ì²éÎïÁÏÀàÐÍ

SELECT SINGLE * FROM T134 WHERE MTART = record-MTART.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'ÐÐÎïÁÏÀàÐÍ´íÎó'.

FLAG = 1.

ENDIF.

  • ¼ì²éÎïÁÏÃèÊö

IF record-MAKTX IS INITIAL.

write: at /5 icon_red_light as icon , X ,'ÐÐÎïÁÏÃèÊö´íÎó'.

FLAG = 1.

ENDIF.

  • ¼ì²éµ¥Î»

TRANSLATE record-MEINS TO UPPER CASE.

SELECT SINGLE * FROM T006A WHERE MSEH3 = record-MEINS.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'Ðлù±¾µ¥Î»´íÎó'.

FLAG = 1.

ENDIF.

  • M = strlen( record-bstme ).

  • if M <> 0.

  • TRANSLATE record-BSTME TO UPPER CASE.

  • SELECT SINGLE * FROM T006A WHERE MSEH3 = record-BSTME.

  • IF SY-SUBRC NE 0.

  • write: at /5 icon_red_light as icon , X ,'Ðж©µ¥µ¥Î»´íÎó'.

  • FLAG = 1.

  • ENDIF.

  • endif.

  • M = strlen( record-ausme ).

  • if M <> 0.

  • TRANSLATE record-AUSME TO UPPER CASE.

  • SELECT SINGLE * FROM T006A WHERE MSEH3 = record-AUSME.

  • IF SY-SUBRC NE 0.

  • write: at /5 icon_red_light as icon , X ,'Ðз¢»õµ¥Î»´íÎó'.

  • FLAG = 1.

  • ENDIF.

  • endif.

  • M = strlen( record-vrkme ).

  • if M <> 0.

  • TRANSLATE record-VRKME TO UPPER CASE.

  • SELECT SINGLE * FROM T006A WHERE MSEH3 = record-VRKME.

  • IF SY-SUBRC NE 0.

  • write: at /5 icon_red_light as icon , X ,'ÐÐÏúÊÛµ¥Î»´íÎó'.

  • FLAG = 1.

  • ENDIF.

  • endif.

  • M = strlen( record-FRTME ).

  • if M <> 0.

  • TRANSLATE record-FRTME TO UPPER CASE.

  • SELECT SINGLE * FROM T006A WHERE MSEH3 = record-FRTME.

  • IF SY-SUBRC NE 0.

  • write: at /5 icon_red_light as icon , X ,'ÐÐÉú²úµ¥Î»´íÎó'.

  • FLAG = 1.

  • ENDIF.

  • endif.

  • ¼ì²éÎïÁÏ×é

SELECT SINGLE * FROM T023 WHERE MATKL = record-MATKL.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'ÐÐÎïÁÏ×é´íÎó'.

FLAG = 1.

ENDIF.

  • ¼ì²é¹¤³§

SELECT SINGLE * FROM T001W WHERE WERKS = record-WERKS.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'Ðй¤³§´íÎó'.

FLAG = 1.

ENDIF.

  • ¼ì²éÏúÊÛ×éÖ¯

IF NOT ( record-VKORG IS INITIAL ).

SELECT SINGLE * FROM TVKO WHERE VKORG = record-VKORG.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'ÐÐÏúÊÛ×éÖ¯´íÎó'.

FLAG = 1.

ENDIF.

ENDIF.

  • ¼ì²é·ÖÏúÇþµÀ

IF NOT ( record-VTWEG IS INITIAL ).

SELECT SINGLE * FROM TVTW WHERE VTWEG = record-VTWEG.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'ÐзÖÏúÇþµÀ´íÎó'.

FLAG = 1.

ENDIF.

ENDIF.

  • ¼ì²éÆÀ¹ÀÀàÐÍ

SELECT SINGLE * FROM T025 WHERE BKLAS = record-BKLAS

AND KKREF = T134-KKREF.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'ÐÐÆÀ¹ÀÀàÐÍ´íÎó'.

FLAG = 1.

ENDIF.

  • ÔËÊä×é

IF NOT ( record-TRAGR IS INITIAL ).

SELECT SINGLE * FROM TTGR WHERE TRAGR = record-TRAGR.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'ÐÐÔËÊä×é´íÎó'.

FLAG = 1.

ENDIF.

ENDIF.

  • ×°ÔØ×é

IF NOT ( record-LADGR IS INITIAL ) .

SELECT SINGLE * FROM TLGR WHERE LADGR = record-LADGR.

IF SY-SUBRC NE 0.

write: at /5 icon_red_light as icon , X ,'ÐÐ×°ÔØ×é´íÎó'.

FLAG = 1.

ENDIF.

ENDIF.

  • ²úÆ·±íʶÂë

  • condense record-EAN11 no-gaps.

  • M = STRLEN( record-EAN11 ).

  • if M <> 16 and M <> 0.

  • write : at /5 icon_red_light as icon , X ,

  • 'ÐвúÆ·±íʶÂëӦΪʮÁùλ'.

  • flag = 1.

  • endif.

  • ¼Û¸ñ¿ØÖÆ

  • condense record-bwtty no-gaps.

condense record-vprsv no-gaps.

TRANSLATE record-vprsv TO UPPER CASE.

  • if record-BWTTY <> '' and record-vprsv <> 'V'.

  • write : at /5 icon_red_light as icon , X ,

  • 'ÐйÀ¼Û·ÖÀàºÍ¼Û¸ñ¿ØÖƳåÍ»'.

  • flag = 1.

  • endif.

X = X + 1.

endloop.

if flag = 0.

write : at /5 icon_green_light as icon,

' ûÓз¢ÏÖÊý¾ÝÂß¼­´íÎó' color 7.

endif.

endform. " FILE_CHECK

*&----

-


*& Form BDC_FILL_INITALSCR

*&----

-


  • ³õʼÆÁÄ»Êý¾Ý

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


FORM BDC_FILL_INITALSCR.

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'

record-MATNR.

perform bdc_field using 'RMMG1-MBRSH'

'M'.

perform bdc_field using 'RMMG1-MTART'

record-MTART.

ENDFORM. " BDC_FILL_INITALSCR

*&----

-


*& Form BDC_FILL_CHOICEVIEW

*&----

-


  • Ñ¡ÔñÊÓͼ

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


FORM BDC_FILL_CHOICEVIEW.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(15)'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

if gen1 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

endif.

if gen2 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(02)'

'X'.

endif.

if salorg1 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(04)'

'X'.

endif.

if salorg2 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(05)'

'X'.

endif.

if salplant eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(06)'

'X'.

endif.

if purchase eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(09)'

'X'.

endif.

if mrp1 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(12)'

'X'.

endif.

if mrp2 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(13)'

'X'.

endif.

if mrp3 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(14)'

'X'.

endif.

if mrp4 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(15)'

'X'.

endif.

if PLANTSTR eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(16)'

'X'.

endif.

if PLTSTRG1 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(17)'

'X'.

endif.

if qau eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

endif.

if ACC1 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(02)'

'X'.

endif.

if ACC2 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(03)'

'X'.

endif.

if COR1 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(04)'

'X'.

endif.

if COR2 eq 'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(05)'

'X'.

endif.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

ENDFORM. " BDC_FILL_CHOICEVIEW

*&----

-


*& Form BDC_FILL_ORGVIEW

*&----

-


  • ×éÖ¯¼¶±ð

*----

-


  • --> p1 text

  • <-- p2 text

*----

-


FORM BDC_FILL_ORGVIEW.

perform bdc_dynpro using 'SAPLMGMM' '0080'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-WERKS'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'RMMG1-WERKS' " ¹¤³§

record-WERKS.

  • ÏúÊÛ×éÖ¯

IF ( SALORG1 EQ 'X' OR SALORG2 EQ 'X' OR SALPLANT EQ 'X' ).

perform bdc_field using 'RMMG1-VKORG' " ÏúÊÛ×éÖ¯

record-VKORG.

perform bdc_field using 'RMMG1-VTWEG' " ·ÖÏúÇþµÀ

record-VTWEG.

endif.

ENDFORM. " BDC_FILL_ORGVIEW

*&----


*

*& Form BDC_SAVE

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM BDC_SAVE.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

ENDFORM. " BDC_SAVE

*&----


*

*& Form qualitydata

*&----


*

  • ÖÊÁ¿¹ÜÀí

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM qualitydata.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

condense record-ssqss no-gaps.

condense record-QMPUR no-gaps.

  • condense record-QMATV no-gaps.

PERFORM BDC_FIELD USING 'MARC-SSQSS'

RECORD-SSQSS. " QM¿ØÖÆÂë

PERFORM BDC_FIELD USING 'MARA-QMPUR'

RECORD-QMPUR. " QM²É¹º¼¤»î

  • PERFORM BDC_FIELD USING 'MARC-QMATV'

  • RECORD-QMATV. " ¼ìÑéÉèÖÃ

***************¼ìÑéÉèÖÃ**********************************

  • if record-qmatv = 'X'.

PERFORM bdc_dynpro

USING 'SAPLQPLS' '0100'.

PERFORM bdc_field

USING 'BDC_OKCODE' '=NEU'.

PERFORM bdc_dynpro

USING 'SAPLQPLS' '0100'.

IF RECORD-ART1 <> ''.

PERFORM bdc_field USING 'RMQAM-ART(1)' RECORD-ART1.

PERFORM bdc_field USING 'RMQAM-AKTIV(1)' RECORD-AKTIV1.

*

  • IF RECORD-ART2 <> ''.

  • PERFORM bdc_field

  • USING 'RMQAM-ART(2)' RECORD-ART2.

  • PERFORM bdc_field

  • USING 'RMQAM-AKTIV(2)' RECORD-AKTIV2.

*

  • IF RECORD-ART3 <> ''.

  • PERFORM bdc_field

  • USING 'RMQAM-ART(3)' RECORD-ART3.

  • PERFORM bdc_field

  • USING 'RMQAM-AKTIV(3)' RECORD-AKTIV3.

  • ENDIF.

  • ENDIF.

  • PERFORM bdc_field

  • USING 'BDC_OKCODE' '=WEIT'.

  • ENDIF.

ENDIF.

ENDFORM. " qualitydata

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
617

I would be a better idea to use BAPI_MATERIAL_SAVEDATA instead of a BDC.

Regards,

Rich Heilman

Read only

0 Likes
617

hello, Rich.

how can i do it with BAPI_MATERIAL_SAVEDATA,can you give the code ,thank you !

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
617

Here is a sample program which creates a material with the bare minmal fields, this will get you started.



report zrich_0003 .

data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: descdata type table of BAPI_MAKT with header line.
data: return type  bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.


parameters: p_matnr type mara-matnr.


headdata-material        = p_matnr.
headdata-ind_sector      = 'M'.
headdata-matl_type       = 'FERT'.
headdata-basic_view = 'X'.


clientdata-BASE_UOM   = 'EA'.
clientdatax-BASE_UOM   = 'X'.
clientdata-old_mat_no = 'Old Material'.
clientdatax-old_mat_no = 'X'.
clientdata-division = '00'.
clientdatax-division = 'X'.

descdata-LANGU = sy-langu.
descdata-MATL_DESC = 'This is the description'.
append descdata.

call function 'BAPI_MATERIAL_SAVEDATA'
  exporting
    headdata                   = headdata
    clientdata                 = clientdata
    clientdatax                = clientdatax
*   PLANTDATA                  =
*   PLANTDATAX                 =
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
*   SALESDATA                  =
*   SALESDATAX                 =
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
 importing
   return                     = return
  tables
    MATERIALDESCRIPTION        = descdata
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
*   TAXCLASSIFICATIONS         =
    returnmessages             = returnm
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =
          .

check sy-subrc  = 0.


Regards,

Rich Heilman