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

Dialog programming

Former Member
0 Likes
391

hi all,

any one can help me,

Create a dialog program that will allow the user to edit, add and display Material description in multiple languages. There will be separate transactions for Display and Change modes.

tables are mara,makt and T002

The first screen should input a valid Material number. The next screen should display the descriptions maintained for the material in all the languages along with the language key. The user should be able to edit or add descriptions for multiple languages.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
368

Hai.

Check the examples they may help you.

REPORT ZVRDOC0 no standard page heading

line-size 300

line-count 50(5).

TABLES : vbak, "Sales Document Header Level

vbap, "Sales Document Header Level

kna1. "General Data in customer Master

*INTERNAL TABLE T_VBAP

DATA : Begin of t_vbap occurs 0,

vbeln like vbap-vbeln,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

end of t_vbap.

*INTERNAL TABLE T_TAB.

DATA : Begin of t_tab occurs 0,

vbeln like vbak-vbeln,

kunnr like vbak-kunnr,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_tab.

*INTERNAL TABLE T_FINAL.

DATA : Begin of t_final occurs 0,

vbeln like vbap-vbeln,

kunnr like vbak-kunnr,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_final.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-bO3.

parameters : P_kunnr like vbak-kunnr.

select-options : S_vbeln for vbak-vbeln,

S_audat for vbak-audat.

SELECTION-SCREEN END OF BLOCK B1.

start-of-selection.

select vbeln matnr posnr arktx kwmeng cmkua from vbap

into corresponding fields of table t_vbap where vbeln in S_vbeln .

IF sy-subrc EQ 0.

select vbakkunnr vbakvbeln vbakaudat vbaknetwr vbak~vkorg

kna1name1 kna1land1 into table t_Tab from

vbak join kna1 on kna1kunnr = vbakkunnr

FOR ALL ENTRIES IN t_vbap

where vbak~vbeln = t_vbap-Vbeln and

vbak~kunnr = p_kunnr and

vbak~audat in S_audat .

ENDIF.

*end-of-selection.

loop at t_vbap.

read table t_tab with key vbeln = t_vbap-vbeln.

move :

t_vbap-vbeln to t_final-vbeln,

t_vbap-matnr to t_final-matnr,

t_vbap-posnr to t_final-posnr,

t_vbap-arktx to t_final-arktx,

t_vbap-kwmeng to t_final-kwmeng,

t_vbap-cmkua to t_final-cmkua,

t_tab-kunnr to t_final-kunnr,

t_tab-audat to t_final-audat,

t_tab-netwr to t_final-netwr,

t_tab-vkorg to t_final-vkorg,

t_tab-name1 to t_final-name1,

t_tab-land1 to t_final-land1.

append t_final.

clear t_Final.

endloop.

sort t_Final by vbeln Kunnr matnr posnr .

loop at t_final.

at new vbeln.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse.

ULINE /1(250).

endat.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse,

20 SY-VLINE, 21 t_final-posnr color 5 inverse,

40 SY-VLINE, 41 t_final-matnr color 5 inverse,

60 SY-VLINE, 61 t_final-arktx color 4 inverse,

80 SY-VLINE, 81 t_final-kwmeng color 4 inverse,

100 SY-VLINE, 101 t_final-cmkua color 4 inverse,

120 SY-VLINE, 121 t_final-kunnr color 3 inverse,

140 SY-VLINE, 141 t_final-audat color 3 inverse,

160 SY-VLINE, 161 t_final-netwr color 2 inverse,

180 SY-VLINE, 181 t_final-vkorg color 2 inverse,

210 SY-VLINE, 211 t_final-name1 color 1 inverse,

230 SY-VLINE, 231 t_final-land1 color 1 inverse,

250 SY-VLINE.

at end of vbeln.

sum.

ULINE /1(250).

write: /60 SY-VLINE, 'Total' ,

81 t_final-kwmeng color 4 inverse ,100 SY-VLINE,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

at last.

SKIP 2.

sum.

ULINE /1(250).

write: /1 SY-VLINE, 60 SY-VLINE, 'Grand Total' ,

81 t_final-kwmeng color 4 inverse , 100 SY-VLINE ,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

endloop.

TOP-OF-PAGE.

ULINE /50(24).

WRITE : /50 SY-VLINE , 52 'SALES ORDER DETAILS' COLOR 5,

73 SY-VLINE.

ULINE /50(24).

ULINE .

WRITE: /10 'CURRENT DATE :', 25 SY-DATUM COLOR 1 INVERSE,

100 'CURRENT TIME :', 115 SY-UZEIT color 5 INVERSE.

WRITE: /10 'USERNAME :', 25 SY-UNAME COLOR 1 INVERSE,

100 'PAGE NO :', 113 SY-PAGNO COLOR 5 INVERSE.

WRITE: /10 'LOGON CLIENT :', 25 SY-MANDT COLOR 1 INVERSE,

100 'COLON N0 :', 114 SY-COLNO COLOR 5 INVERSE.

WRITE: /10 'CURRENT REPROT:', 25 SY-REPID COLOR 1 INVERSE,

100 'LANGUAGE :', 116 SY-LANGU COLOR 5 INVERSE.

ULINE.

ULINE /1(250).

write : /1 SY-VLINE, 2 'SALES DOC NO' color 6 inverse,

20 SY-VLINE, 21 'SALES DOC ITEM' color 6 inverse,

40 SY-VLINE,41 'MATERIAL NO' color 6 inverse,

60 SY-VLINE, 61 'SHORT SALES TEXT' color 6 inverse,

80 SY-VLINE, 81 'CUMM ORDER SALES' color 6 inverse,

100 SY-VLINE, 101 'CREDIT DATA' color 6 inverse,

120 SY-VLINE, 121 'CUSTOMER NO' color 6 inverse,

140 SY-VLINE, 141 'DOC DATE' color 6 inverse,

160 SY-VLINE, 161 'NET VALUE SALES' color 6 inverse,

180 SY-VLINE, 181 'SALES ORG' color 6 inverse,

210 SY-VLINE, 211 'CUSTOMER NAME' color 6 inverse,

230 SY-VLINE, 231 'CUSTOMER CONTY' color 6 inverse,

250 SY-VLINE.

ULINE /1(250).

END-OF-PAGE.

ULINE.

WRITE: /45 ' THIS IS END OF PAGE FOR SALES DOCUMENT DETAILS'

COLOR 6 .

-


REPORT zmm_mat_master_non_stock

NO STANDARD PAGE HEADING

LINE-SIZE 255.

  • Standard Include for Selection Screen

INCLUDE bdcrecx1.

  • Internal Table for Upload Data

DATA: BEGIN OF i_mat OCCURS 0,

  • mbrsh(001), " Industry Sector

  • mtart(004), " Material Type

  • Views

  • Organization Levels

  • werks(004), " Plant

  • Basic Data1 View

maktx(040), " Material Description

  • meins(003), " Unit of Measure

matkl(009), " Material Group

  • MTPOS_MARA(004), " Gen Item Category

  • Purchasing

ekgrp(003), " Purchasing Group

END OF i_mat.

  • Data Variables & Constants

CONSTANTS : c_x VALUE 'X'. " Flag

  • Parameters

PARAMETERS: p_file LIKE ibipparms-path. " Filename

  • At selection-screen on Value Request for file Name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • Get the F4 Values for the File

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

  • Start of Selection

START-OF-SELECTION.

  • Open the BDC Session

PERFORM open_group.

  • Upload the File into internal Table

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = i_mat

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.

  • Upload the Data from Internal Table

LOOP AT i_mat.

  • Basic Screen

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-MBRSH'

'C'."i_mat-mbrsh.

PERFORM bdc_field USING 'RMMG1-MTART'

'NLAG'."i_mat-mtart.

  • Views Selection

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(08)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTR'.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'

c_x."i_mat-kzsel_01.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'

c_x."i_mat-kzsel_02.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'

c_x."i_mat-kzsel_08.

  • Organization Levels

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'

'2000'."i_mat-werks.

  • Basic data1 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MAKT-MAKTX'

i_mat-maktx.

PERFORM bdc_field USING 'BDC_CURSOR'

'MARA-MTPOS_MARA'.

PERFORM bdc_field USING 'MARA-MEINS'

'EA'."i_mat-meins.

PERFORM bdc_field USING 'MARA-MATKL'

i_mat-matkl.

PERFORM bdc_field USING 'MARA-MTPOS_MARA'

'NLAG'."i_mat-mtpos_mara.

  • Basic data2 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MAKT-MAKTX'.

  • Purchasing View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_field USING 'MARC-EKGRP'

i_mat-ekgrp.

  • Call The Transaction

PERFORM bdc_transaction USING 'MM01'.

ENDLOOP.

  • Close the BDC Session

PERFORM close_group.

-


REPORT zmm_mat_master_non_stock

NO STANDARD PAGE HEADING

LINE-SIZE 255.

  • Standard Include for Selection Screen

INCLUDE bdcrecx1.

  • Internal Table for Upload Data

DATA: BEGIN OF i_mat OCCURS 0,

  • mbrsh(001), " Industry Sector

  • mtart(004), " Material Type

  • Views

  • Organization Levels

  • werks(004), " Plant

  • Basic Data1 View

maktx(040), " Material Description

  • meins(003), " Unit of Measure

matkl(009), " Material Group

  • MTPOS_MARA(004), " Gen Item Category

  • Purchasing

ekgrp(003), " Purchasing Group

END OF i_mat.

  • Data Variables & Constants

CONSTANTS : c_x VALUE 'X'. " Flag

  • Parameters

PARAMETERS: p_file LIKE ibipparms-path. " Filename

  • At selection-screen on Value Request for file Name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • Get the F4 Values for the File

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

  • Start of Selection

START-OF-SELECTION.

  • Open the BDC Session

PERFORM open_group.

  • Upload the File into internal Table

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = i_mat

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.

  • Upload the Data from Internal Table

LOOP AT i_mat.

  • Basic Screen

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-MBRSH'

'C'."i_mat-mbrsh.

PERFORM bdc_field USING 'RMMG1-MTART'

'NLAG'."i_mat-mtart.

  • Views Selection

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(08)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTR'.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'

c_x."i_mat-kzsel_01.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'

c_x."i_mat-kzsel_02.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'

c_x."i_mat-kzsel_08.

  • Organization Levels

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'

'2000'."i_mat-werks.

  • Basic data1 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MAKT-MAKTX'

i_mat-maktx.

PERFORM bdc_field USING 'BDC_CURSOR'

'MARA-MTPOS_MARA'.

PERFORM bdc_field USING 'MARA-MEINS'

'EA'."i_mat-meins.

PERFORM bdc_field USING 'MARA-MATKL'

i_mat-matkl.

PERFORM bdc_field USING 'MARA-MTPOS_MARA'

'NLAG'."i_mat-mtpos_mara.

  • Basic data2 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MAKT-MAKTX'.

  • Purchasing View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_field USING 'MARC-EKGRP'

i_mat-ekgrp.

  • Call The Transaction

PERFORM bdc_transaction USING 'MM01'.

ENDLOOP.

  • Close the BDC Session

PERFORM close_group.

Regards.

Sowjanya.B.

2 REPLIES 2
Read only

Former Member
0 Likes
369

Hai.

Check the examples they may help you.

REPORT ZVRDOC0 no standard page heading

line-size 300

line-count 50(5).

TABLES : vbak, "Sales Document Header Level

vbap, "Sales Document Header Level

kna1. "General Data in customer Master

*INTERNAL TABLE T_VBAP

DATA : Begin of t_vbap occurs 0,

vbeln like vbap-vbeln,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

end of t_vbap.

*INTERNAL TABLE T_TAB.

DATA : Begin of t_tab occurs 0,

vbeln like vbak-vbeln,

kunnr like vbak-kunnr,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_tab.

*INTERNAL TABLE T_FINAL.

DATA : Begin of t_final occurs 0,

vbeln like vbap-vbeln,

kunnr like vbak-kunnr,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_final.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-bO3.

parameters : P_kunnr like vbak-kunnr.

select-options : S_vbeln for vbak-vbeln,

S_audat for vbak-audat.

SELECTION-SCREEN END OF BLOCK B1.

start-of-selection.

select vbeln matnr posnr arktx kwmeng cmkua from vbap

into corresponding fields of table t_vbap where vbeln in S_vbeln .

IF sy-subrc EQ 0.

select vbakkunnr vbakvbeln vbakaudat vbaknetwr vbak~vkorg

kna1name1 kna1land1 into table t_Tab from

vbak join kna1 on kna1kunnr = vbakkunnr

FOR ALL ENTRIES IN t_vbap

where vbak~vbeln = t_vbap-Vbeln and

vbak~kunnr = p_kunnr and

vbak~audat in S_audat .

ENDIF.

*end-of-selection.

loop at t_vbap.

read table t_tab with key vbeln = t_vbap-vbeln.

move :

t_vbap-vbeln to t_final-vbeln,

t_vbap-matnr to t_final-matnr,

t_vbap-posnr to t_final-posnr,

t_vbap-arktx to t_final-arktx,

t_vbap-kwmeng to t_final-kwmeng,

t_vbap-cmkua to t_final-cmkua,

t_tab-kunnr to t_final-kunnr,

t_tab-audat to t_final-audat,

t_tab-netwr to t_final-netwr,

t_tab-vkorg to t_final-vkorg,

t_tab-name1 to t_final-name1,

t_tab-land1 to t_final-land1.

append t_final.

clear t_Final.

endloop.

sort t_Final by vbeln Kunnr matnr posnr .

loop at t_final.

at new vbeln.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse.

ULINE /1(250).

endat.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse,

20 SY-VLINE, 21 t_final-posnr color 5 inverse,

40 SY-VLINE, 41 t_final-matnr color 5 inverse,

60 SY-VLINE, 61 t_final-arktx color 4 inverse,

80 SY-VLINE, 81 t_final-kwmeng color 4 inverse,

100 SY-VLINE, 101 t_final-cmkua color 4 inverse,

120 SY-VLINE, 121 t_final-kunnr color 3 inverse,

140 SY-VLINE, 141 t_final-audat color 3 inverse,

160 SY-VLINE, 161 t_final-netwr color 2 inverse,

180 SY-VLINE, 181 t_final-vkorg color 2 inverse,

210 SY-VLINE, 211 t_final-name1 color 1 inverse,

230 SY-VLINE, 231 t_final-land1 color 1 inverse,

250 SY-VLINE.

at end of vbeln.

sum.

ULINE /1(250).

write: /60 SY-VLINE, 'Total' ,

81 t_final-kwmeng color 4 inverse ,100 SY-VLINE,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

at last.

SKIP 2.

sum.

ULINE /1(250).

write: /1 SY-VLINE, 60 SY-VLINE, 'Grand Total' ,

81 t_final-kwmeng color 4 inverse , 100 SY-VLINE ,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

endloop.

TOP-OF-PAGE.

ULINE /50(24).

WRITE : /50 SY-VLINE , 52 'SALES ORDER DETAILS' COLOR 5,

73 SY-VLINE.

ULINE /50(24).

ULINE .

WRITE: /10 'CURRENT DATE :', 25 SY-DATUM COLOR 1 INVERSE,

100 'CURRENT TIME :', 115 SY-UZEIT color 5 INVERSE.

WRITE: /10 'USERNAME :', 25 SY-UNAME COLOR 1 INVERSE,

100 'PAGE NO :', 113 SY-PAGNO COLOR 5 INVERSE.

WRITE: /10 'LOGON CLIENT :', 25 SY-MANDT COLOR 1 INVERSE,

100 'COLON N0 :', 114 SY-COLNO COLOR 5 INVERSE.

WRITE: /10 'CURRENT REPROT:', 25 SY-REPID COLOR 1 INVERSE,

100 'LANGUAGE :', 116 SY-LANGU COLOR 5 INVERSE.

ULINE.

ULINE /1(250).

write : /1 SY-VLINE, 2 'SALES DOC NO' color 6 inverse,

20 SY-VLINE, 21 'SALES DOC ITEM' color 6 inverse,

40 SY-VLINE,41 'MATERIAL NO' color 6 inverse,

60 SY-VLINE, 61 'SHORT SALES TEXT' color 6 inverse,

80 SY-VLINE, 81 'CUMM ORDER SALES' color 6 inverse,

100 SY-VLINE, 101 'CREDIT DATA' color 6 inverse,

120 SY-VLINE, 121 'CUSTOMER NO' color 6 inverse,

140 SY-VLINE, 141 'DOC DATE' color 6 inverse,

160 SY-VLINE, 161 'NET VALUE SALES' color 6 inverse,

180 SY-VLINE, 181 'SALES ORG' color 6 inverse,

210 SY-VLINE, 211 'CUSTOMER NAME' color 6 inverse,

230 SY-VLINE, 231 'CUSTOMER CONTY' color 6 inverse,

250 SY-VLINE.

ULINE /1(250).

END-OF-PAGE.

ULINE.

WRITE: /45 ' THIS IS END OF PAGE FOR SALES DOCUMENT DETAILS'

COLOR 6 .

-


REPORT zmm_mat_master_non_stock

NO STANDARD PAGE HEADING

LINE-SIZE 255.

  • Standard Include for Selection Screen

INCLUDE bdcrecx1.

  • Internal Table for Upload Data

DATA: BEGIN OF i_mat OCCURS 0,

  • mbrsh(001), " Industry Sector

  • mtart(004), " Material Type

  • Views

  • Organization Levels

  • werks(004), " Plant

  • Basic Data1 View

maktx(040), " Material Description

  • meins(003), " Unit of Measure

matkl(009), " Material Group

  • MTPOS_MARA(004), " Gen Item Category

  • Purchasing

ekgrp(003), " Purchasing Group

END OF i_mat.

  • Data Variables & Constants

CONSTANTS : c_x VALUE 'X'. " Flag

  • Parameters

PARAMETERS: p_file LIKE ibipparms-path. " Filename

  • At selection-screen on Value Request for file Name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • Get the F4 Values for the File

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

  • Start of Selection

START-OF-SELECTION.

  • Open the BDC Session

PERFORM open_group.

  • Upload the File into internal Table

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = i_mat

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.

  • Upload the Data from Internal Table

LOOP AT i_mat.

  • Basic Screen

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-MBRSH'

'C'."i_mat-mbrsh.

PERFORM bdc_field USING 'RMMG1-MTART'

'NLAG'."i_mat-mtart.

  • Views Selection

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(08)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTR'.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'

c_x."i_mat-kzsel_01.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'

c_x."i_mat-kzsel_02.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'

c_x."i_mat-kzsel_08.

  • Organization Levels

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'

'2000'."i_mat-werks.

  • Basic data1 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MAKT-MAKTX'

i_mat-maktx.

PERFORM bdc_field USING 'BDC_CURSOR'

'MARA-MTPOS_MARA'.

PERFORM bdc_field USING 'MARA-MEINS'

'EA'."i_mat-meins.

PERFORM bdc_field USING 'MARA-MATKL'

i_mat-matkl.

PERFORM bdc_field USING 'MARA-MTPOS_MARA'

'NLAG'."i_mat-mtpos_mara.

  • Basic data2 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MAKT-MAKTX'.

  • Purchasing View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_field USING 'MARC-EKGRP'

i_mat-ekgrp.

  • Call The Transaction

PERFORM bdc_transaction USING 'MM01'.

ENDLOOP.

  • Close the BDC Session

PERFORM close_group.

-


REPORT zmm_mat_master_non_stock

NO STANDARD PAGE HEADING

LINE-SIZE 255.

  • Standard Include for Selection Screen

INCLUDE bdcrecx1.

  • Internal Table for Upload Data

DATA: BEGIN OF i_mat OCCURS 0,

  • mbrsh(001), " Industry Sector

  • mtart(004), " Material Type

  • Views

  • Organization Levels

  • werks(004), " Plant

  • Basic Data1 View

maktx(040), " Material Description

  • meins(003), " Unit of Measure

matkl(009), " Material Group

  • MTPOS_MARA(004), " Gen Item Category

  • Purchasing

ekgrp(003), " Purchasing Group

END OF i_mat.

  • Data Variables & Constants

CONSTANTS : c_x VALUE 'X'. " Flag

  • Parameters

PARAMETERS: p_file LIKE ibipparms-path. " Filename

  • At selection-screen on Value Request for file Name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • Get the F4 Values for the File

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

  • Start of Selection

START-OF-SELECTION.

  • Open the BDC Session

PERFORM open_group.

  • Upload the File into internal Table

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = i_mat

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.

  • Upload the Data from Internal Table

LOOP AT i_mat.

  • Basic Screen

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-MBRSH'

'C'."i_mat-mbrsh.

PERFORM bdc_field USING 'RMMG1-MTART'

'NLAG'."i_mat-mtart.

  • Views Selection

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(08)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTR'.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'

c_x."i_mat-kzsel_01.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'

c_x."i_mat-kzsel_02.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'

c_x."i_mat-kzsel_08.

  • Organization Levels

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'

'2000'."i_mat-werks.

  • Basic data1 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MAKT-MAKTX'

i_mat-maktx.

PERFORM bdc_field USING 'BDC_CURSOR'

'MARA-MTPOS_MARA'.

PERFORM bdc_field USING 'MARA-MEINS'

'EA'."i_mat-meins.

PERFORM bdc_field USING 'MARA-MATKL'

i_mat-matkl.

PERFORM bdc_field USING 'MARA-MTPOS_MARA'

'NLAG'."i_mat-mtpos_mara.

  • Basic data2 View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MAKT-MAKTX'.

  • Purchasing View

PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_field USING 'MARC-EKGRP'

i_mat-ekgrp.

  • Call The Transaction

PERFORM bdc_transaction USING 'MM01'.

ENDLOOP.

  • Close the BDC Session

PERFORM close_group.

Regards.

Sowjanya.B.

Read only

0 Likes
368

i want create dialog progam with table control, which should edit the required fields.