1, report ZLLLL.
Data: ZMSTUDENT begins,
ZMSID type ZMSID,
Zmno type ZMCNO,
ZMKNO type ZMKNO,
ZMNAME type ZMNAME,
Zmsex type ZMSSEX,
ZMSAGE type ZMSAGE,
ZMSTEL type ZMSTEL,
End of ZMSTUDENT.
Data: itab class table (storage table) of zm students with header row.
BDC data similar to BDC data appears at 0 in the title line (execution parameter transfer table).
The number of occurrences of Message _ tablelike bdcmsgcoll with title line is 0. (Return execution result)
Data: the beginning of it_message appears at 0,
Msgtp type bdc_mart,
Matnr likes makt-matnr,
Text (40),
End of it_message.
Select-the screen starts with the frame title text -00 1 block BLK.
Parameter: mandatory default value' n' for CTU mode of type P_TYP,
P_FILE LIKE RLGRAP-FILENAME mandatory.
The selection screen of BLK block ends.
On the value selection screen, request P_FILE.
Execute SELECT_FILE.
Select Start.
Execute GET_FILE_DATA.
Execute pross_data.
* -
Form Selection _ File.
Data: FILETABLE of type l_FILETAB,
A line similar to L_FILETAB,
L_RC type I
Call method CL _ GUI _ FRONTEND _ SERVICES => file _ open _ dialog box.
export
WINDOW_TITLE =' Open file'
initial_DIRECTORY = 'C:/'
change
File table = file label
RC = L_RC
exception
File opening dialog failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
Other = 5
.
If sy-subrec <: & gt0.
Message ID sy-msgid type sy-msgty number sy-msgno
Same as sy-msgv1sy-msgv2sy-msgv3 sy-msgv4.
Quit
Otherwise.
Read the table l_filetab into the l _ waftab index 1.
p_file = l_waftab-filename。
Clear: l_filetab,
l _ wat iab。
ENDIF。
The ending form. "select _ file
* & amp-
Form to get file data.
Data lt_excel type table of alsmex_tabline with header row.
Data l_index such as sy-tabix.
Field symbol.
Call the function "ALSM_EXCEL_TO_INTERNAL_TABLE"
export
File name = p _ file
i_begin_col = ' 1 '
i_begin_row = '2 '
i_end_col = '50 '
i_end_row = '50000 '
table
intern = lt_excel
exception
Inconsistent parameter = 1
upload_ole = 2
Other = 3.
*&& Import data in EXCEL format into the internal table TAB_LOAD.
Loop in lt_excel.
Move lt_excel-col to l_index.
* Assign the component l_index of the structure itab to.
* move lt_excel-value to.
* At the end of the line.
* convert gt_user-uname to uppercase.
Case L_INDEX.
When' 1'.
Move lT_EXCEL-VALUE to ZMSTUDENT-ZMSID.
When' 2'.
Move lT_EXCEL-VALUE to ZMSTUDENT-ZMCNO.
When' 3'.
Move lT_EXCEL-VALUE to ZMSTUDENT-ZMKNO.
When' 4'.
Move lT_EXCEL-VALUE to ZMSTUDENT-ZMNAME.
When' 5'.
Move lT_EXCEL-VALUE to ZMSTUDENT-ZMSSEX.
When' 6'.
Move lt_excel-value to zmstudent-zmsage.
When' 7'.
Move lt_excel-value to zmstudent-zmstel.
The ending.
At the end of the line.
Add itab.
Clear itab.
Ndat.
End the loop.
The ending form. "get file data"
* & amp-
Form PROSS_DATA.
Data: l_line 1(6).
Data: aa(3), bb(3), cc(3).
Data source: LC(5).
Loop in itab.
Use' zmll001'2000' to execute bdc _ dynpro. (Program name and screen number are required)
Execute bdc_field with "BDC_CURSOR".
' LS_ZMSTUDENT-ZMSTEL '。
Use "BDC_OKCODE" to execute bdc_field.
Save.
Move ITAB-ZMCNO to AA. (because the zmcno field is num type, it should be enlarged in the char type field here.)
Move ITAB- zimkno to BB.
Move ITAB· zeg to CC.
* * * * * * * * * * * * * * The following paragraph is the code of the screen capture ~ ~ ~ * * * * * * * * * * * * * * * * * * * * * * * * * * *.
Execute bdc_field using' LS_ZMSTUDENT-ZMSID'.
itab-zmsid。
* Record -ZMSID_00 1.
Execute bdc_field using' LS_ZMSTUDENT-ZMCNO'.
AA。
* itab-ZMCNO。
* record -ZMCNO_002.
Use' LS_ZMSTUDENT-ZMKNO' to execute bdc_field.
BB。
* itab-ZMKNO。
* record -ZMKNO_003.
Execute bdc_field using' LS_ZMSTUDENT-ZMNAME'.
itab-ZMNAME。
* record -ZMNAME_004.
Execute bdc_field using' LS_ZMSTUDENT-ZMSSEX'.
itab-ZMSSEX。
* record -ZMSSEX_005.
Execute bdc_field using' LS_ZMSTUDENT-ZMSAGE'.
Cc
* itab-ZMSAGE。
* record -ZMSAGE_006.
Execute bdc_field using' LS_ZMSTUDENT-ZMSTEL'.
itab-ZMSTEL。
* record -ZMSTEL_007.
End the loop.
Use "BDC_OKCODE" to execute bdc_field.
=BACK 1 '。
Call transaction' ZMM' using bdcdata mode p_typ.
Update "l"
Message to message_table.
Description table message _ table line l_line 1.
Read the table message _ tableindex l _ line1.
If sy-subrc = 0.
it _ message-msgtp = message _ table-msgtyp。
* it_message-matnr = itma-matnr。
Select a single text
Starting from t 100
INTO it _ message-text
Where sprsl = sy- Gu Lan and
Arbgb = message_table-msgid and
msgnr = message_table-msgnr。
Replace the first appearance of'&' in it _ message-text with message _ table-msgv1
Replace the first occurrence of'&'in it _ message-text with message _ table-msgv2.
Replace the first appearance of' & in it _ message-text with message _ table-msgv3.
Replace the first occurrence of'&'in it _ message-text with message _ table-msgv4.
ENDIF。
Append it_message.
Clear it _ message.
CLEAR:message_table,message_table[],bdcdata,bdcdata[]。
The ending form. " PROSS_DATA
* & amp-
Use the program DYNPRO to form BDC_DYNPRO.
Clear bdcdata.
Bdcdata-program = program.
bdcdata-dynpro = dynpro。
bdcdata-dynbegin = 'X '。
Add bdcdata.
The ending form. " BDC_DYNPRO
* & amp-
Use fnam fval to form BDC_FIELD.
Clear bdcdata.
bdcdata-fnam = fnam。
bdcdata-fval = fval。
Add bdcdata.
The ending form. “BDC_FIELD