C201 BDC UPLOAD Program in SAP ABAP.
C201 BDC Program in SAP ABAP.
*&---------------------------------------------------------------------*
*& Report ZPP01_UPLOAD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
report zpp01_upload.
*report zpp01_upload
* no standard page heading line-size 255.
* Include bdcrecx1_s:
* The call transaction using is called WITH AUTHORITY-CHECK!
* If you have own auth.-checks you can use include bdcrecx1 instead.
*include bdcrecx1_s.
tables: sscrfields.
include <icon>.
types : begin of ty_data,
matnr type matnr,
werks type werks_d,
profident type char4,
sttag type char10,
statu type char1,
verwe type char1,
losvn type char1,
losbs type char8,
plnme type plnme,
bmsch type string,
meinh type vorme,
vornr type vornr,
phflg type phflg,
pvznr type pvznr,
phseq type phseq,
arbpl type arbpl,
ktsch type char4,
ltxa1 type char40,
vgw01 type string,
vge01 type string,
lar01 type string,
vgw02 type string,
vge02 type string,
lar02 type string,
vgw03 type string,
vge03 type string,
lar03 type string,
vgw04 type string,
vge04 type string,
lar04 type string,
vgw05 type string,
vge05 type string,
lar05 type string,
vgw06 type string,
vge06 type string,
lar06 type string,
BMSCHN TYPE STRING, " added
mic type string,
char type string,
flag(3) type n,
end of ty_data.
field-symbols :<fsdata> type any.
types : begin of ty_data1,
matnr type matnr,
werks type werks_d,
profident type char4,
sttag type char10,
statu type char1,
verwe type char1,
losvn type char1,
losbs type char8,
plnme type plnme,
bmsch type bmsch,
meinh type vorme,
vornr type vornr,
flag(3) type n,
end of ty_data1.
types : begin of ty_data2,
phflg type phflg,
pvznr type pvznr,
phseq type phseq,
arbpl type arbpl,
ktsch type char4,
ltxa1 type char40,
vgw01 type string,
vge01 type string,
lar01 type string,
vgw02 type string,
vge02 type string,
lar02 type string,
vgw03 type string,
vge03 type string,
lar03 type string,
vgw04 type string,
vge04 type string,
lar04 type string,
vgw05 type string,
vge05 type string,
lar05 type string,
vgw06 type string,
vge06 type string,
lar06 type string,
BMSCH TYPE STRING,
mic type string,
char type string,
flag(3) type n,
end of ty_data2.
data : wa_data type ty_data,
lt_data type table of ty_data,
lt_data1 type table of ty_data1,
wa_data1 type ty_data1,
wa_data2 type ty_data2,
lt_data2 type table of ty_data2.
data it_data type ty_data occurs 0 with header line.
data ind(2) type c.
data flag(3) type n.
data var1(15) type c.
data var2(15) type c.
data var3(15) type c.
data var4(15) type c.
data var5(15) type c.
data var6(15) type c.
data var7(15) type c.
data var8(15) type c.
data var9(15) type c.
data var10(15) type c.
data var11(15) type c.
data var12(15) type c.
data var13(15) type c.
data var14(15) type c.
data var15(15) type c.
data var16(15) type c.
data var17(15) type c.
data var18(15) type c.
data var19(15) type c.
data var20(15) type c.
data: it_bdcdata type standard table of bdcdata,
wa_bdcdata type bdcdata,
it_mess type standard table of bdcmsgcoll,
wa_mess type bdcmsgcoll.
data: it_upload type standard table of alsmex_tabline,
wa_upload type alsmex_tabline.
data : w_update type ctu_params-updmode,
w_index type i,
w_line type i,
w_row type i value 1,
v_s type char15.
data: lv_lines type sy-tabix.
data cont(3) type n.
data:lv_filename type string,
lv_fullpath type string,
lv_path type string,
lv_action type i,
lv_file type string.
types: begin of ty_final,
** data element: SPRAS
* SPRAS_001(016),
** data element: ASNUM
* ASNUM_002(018),
* data element: ASKTX
asktx_003(040),
* data element: ASTYP
astyp_004(004),
* data element: MEINS
meins_005 type meins,
* data element: MATKL_SRV
matkl_006(009),
* data element: BWKLL
bklas_007(009),
* data element: J_1B_TAX_TARIFF_CODE
taxtariffcode_008(016),
** data element: SPRAS
tline(132),
ean11(18),
* new TYPE c,
end of ty_final.
data: it_final type standard table of ty_final,
wa_final type ty_final.
types:begin of excel_heading,
text(20) type c,
end of excel_heading.
data:it_heading type standard table of excel_heading initial size 0,
wa_heading type excel_heading.
field-symbols : <fs> type any .
selection-screen : begin of block b1 with frame title text-001.
parameters : p_mode type ctu_params-dismode default 'A' obligatory,
p_fname type ibipparms-path.
selection-screen : end of block b1.
selection-screen function key 1.
data: ls_sel_button type smp_dyntxt.
initialization.
ls_sel_button-icon_id = icon_export.
ls_sel_button-quickinfo = 'Download Production Version Template'.
ls_sel_button-icon_text = 'Download Template'.
sscrfields-functxt_01 = ls_sel_button.
at selection-screen.
case sscrfields-ucomm.
when 'FC01'.
perform export using 'ZPD'.
endcase.
at selection-screen on value-request for p_fname.
perform f4_filename.
start-of-selection.
perform upload_exceldata_itab.
if lt_data is not initial.
select * from makt into table @data(lt_makt) for all entries in @lt_data where matnr = @lt_data-matnr.
endif.
* IT_DATA[] = LT_DATA[].
loop at lt_data into wa_data.
it_data-bmsch = wa_data-bmsch.
it_data-matnr = wa_data-matnr.
it_data-werks = wa_data-werks.
it_data-profident = wa_data-profident.
it_data-sttag = wa_data-sttag.
it_data-statu = wa_data-statu.
it_data-verwe = wa_data-verwe.
it_data-losvn = wa_data-losvn.
it_data-losbs = wa_data-losbs.
it_data-plnme = wa_data-plnme.
it_data-meinh = wa_data-meinh.
it_data-vornr = wa_data-vornr.
wa_data2-pvznr = wa_data-pvznr.
wa_data2-phflg = wa_data-phflg.
wa_data2-phseq = wa_data-phseq.
wa_data2-arbpl = wa_data-arbpl.
wa_data2-ktsch = wa_data-ktsch.
wa_data2-ltxa1 = wa_data-ltxa1.
wa_data2-vgw01 = wa_data-vgw01.
wa_data2-vge01 = wa_data-vge01.
wa_data2-lar01 = wa_data-lar01.
wa_data2-vgw02 = wa_data-vgw02.
wa_data2-vge02 = wa_data-vge02.
wa_data2-lar02 = wa_data-lar02.
wa_data2-vgw03 = wa_data-vgw03.
wa_data2-vge03 = wa_data-vge03.
wa_data2-lar03 = wa_data-lar03.
wa_data2-vgw04 = wa_data-vgw04.
wa_data2-vge04 = wa_data-vge04.
wa_data2-lar04 = wa_data-lar04.
wa_data2-vgw05 = wa_data-vgw05.
wa_data2-vge05 = wa_data-vge05.
wa_data2-lar05 = wa_data-lar05.
wa_data2-vgw06 = wa_data-vgw06.
wa_data2-vge06 = wa_data-vge06.
wa_data2-lar06 = wa_data-lar06.
wa_data2-bmsch = wa_data-bmschn.
wa_data2-mic = wa_data-mic.
wa_data2-char = wa_data-char.
at new matnr.
add 1 to flag.
endat.
it_data-flag = flag.
wa_data2-flag = flag.
append wa_data2 to lt_data2.
on change of it_data-matnr.
collect it_data.
endon.
endloop.
loop at it_data .
read table lt_makt into data(ls_makt) with key matnr = it_data-matnr.
*
* WA_DATA2-arbpl.
*pe
perform bdc_dynpro using 'SAPLCPDI' '4000'.
perform bdc_field using 'BDC_CURSOR'
'RC27M-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC271-PLNNR'
' '.
perform bdc_field using 'RC27M-MATNR'
it_data-matnr .
perform bdc_field using 'RC27M-WERKS'
it_data-werks.
perform bdc_field using 'RC271-PROFIDNETZ'
it_data-profident.
perform bdc_field using 'RC271-STTAG'
it_data-sttag.
perform bdc_dynpro using 'SAPLCPDA' '4210'.
perform bdc_field using 'BDC_CURSOR'
'PLKOD-MEINH'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'PLKOD-WERKS'
it_data-werks.
perform bdc_field using 'PLKOD-PLNAL'
'1'.
perform bdc_field using 'PLKOD-KTEXT'
ls_makt-maktx.
perform bdc_field using 'PLKOD-VERWE'
it_data-verwe.
perform bdc_field using 'PLKOD-STATU'
it_data-statu.
perform bdc_field using 'PLKOD-VAGRP'
'1'.
perform bdc_field using 'PLKOD-BMSCH'
it_data-bmsch.
perform bdc_field using 'PLKOD-MEINH'
it_data-meinh.
perform bdc_field using 'PLKOD-LOSBS'
it_data-losbs.
perform bdc_field using 'PLKOD-PLNME'
it_data-plnme.
perform bdc_dynpro using 'SAPLCPDA' '4210'.
perform bdc_field using 'BDC_CURSOR'
'PLKOD-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=VOUE'.
perform bdc_field using 'PLKOD-WERKS'
it_data-werks.
perform bdc_field using 'PLKOD-PLNAL'
'1'.
perform bdc_field using 'PLKOD-KTEXT'
ls_makt-maktx.
perform bdc_field using 'PLKOD-VERWE'
it_data-verwe.
perform bdc_field using 'PLKOD-STATU'
it_data-statu.
perform bdc_field using 'PLKOD-VAGRP'
'1'.
perform bdc_field using 'PLKOD-BMSCH'
it_data-bmsch.
perform bdc_field using 'PLKOD-MEINH'
it_data-meinh.
perform bdc_field using 'PLKOD-LOSBS'
it_data-losbs.
perform bdc_field using 'PLKOD-PLNME'
it_data-plnme.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-STEUS(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
loop at lt_data2 into wa_data2 where flag = it_data-flag.
ind = ind + 1.
concatenate 'PLPOD-PHFLG(' ind ') ' into var1.
condense var1.
concatenate 'PLPOD-PVZNR(' ind') ' into var2.
concatenate 'PLPOD-PHSEQ(' ind ') ' into var3.
concatenate 'PLPOD-ARBPL(' ind ') ' into var4.
* concatenate 'PLPOD-KTSCH(' ind ') ' into var14.
concatenate 'PLPOD-STEUS(' ind ') ' into var5.
concatenate 'PLPOD-LTXA1(' ind ') ' into var6.
* concatenate 'PLPOD-LTXA2(' ind ') ' into var7.
concatenate 'PLPOD-VGW01(' ind ') ' into var8.
concatenate 'PLPOD-VGW02(' ind ') ' into var9.
concatenate 'PLPOD-VGW03(' ind ') ' into var10.
concatenate 'PLPOD-VGW04(' ind ') ' into var11.
concatenate 'PLPOD-VGW05(' ind ') ' into var12.
concatenate 'PLPOD-VGW06(' ind ') ' into var13.
concatenate 'PLPOD-VGE01(' ind ') ' into var14.
concatenate 'PLPOD-VGE02(' ind ') ' into var15.
concatenate 'PLPOD-VGE03(' ind ') ' into var16.
concatenate 'PLPOD-VGE04(' ind ') ' into var17.
concatenate 'PLPOD-VGE05(' ind ') ' into var18.
concatenate 'PLPOD-VGE06(' ind ') ' into var19.
concatenate 'PLPOD-BMSCH(' ind ') ' into var20.
condense: var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19, VAR20.
perform bdc_field using var1
wa_data2-phflg.
condense wa_data-pvznr.
perform bdc_field using var2
wa_data2-pvznr.
perform bdc_field using var3
wa_data2-phseq.
perform bdc_field using var4
wa_data2-arbpl.
* perform bdc_field using var14
* wa_data2-ktsch.
perform bdc_field using var5
wa_data2-ktsch.
*
*
perform bdc_field using var6
wa_data2-ltxa1.
* *************ADDED BY PK18/07
perform bdc_field using var20
wa_data2-bmsch.
* ****************************ADDED
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
* *****************ADDED
* perform bdc_field using var7
* wa_data2-ltxa1.
if wa_data2-phflg eq 'X'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
var8.
* perform bdc_field using 'BDC_CURSOR'
* var8.
condense wa_data2-vgw01.
perform bdc_field using var8
wa_data2-vgw01.
* CONDENSE wa_data2-vgw02.
if wa_data2-vgw02 is not initial.
perform bdc_field using var9
wa_data2-vgw02.
endif.
if wa_data2-vgw03 is not initial.
perform bdc_field using var10
wa_data2-vgw03.
endif.
if wa_data2-vgw04 is not initial.
perform bdc_field using var11
wa_data2-vgw04.
endif.
if wa_data2-vgw05 is not initial.
perform bdc_field using var12 wa_data2-vgw05.
endif.
if wa_data2-vgw06 is not initial.
perform bdc_field using var13
wa_data2-vgw06.
endif.
* *********
if wa_data2-vge01 is not initial.
perform bdc_field using var14
wa_data2-vge01.
endif.
if wa_data2-vge02 is not initial.
perform bdc_field using var15
wa_data2-vge02.
endif.
if wa_data2-vge03 is not initial.
perform bdc_field using var16
wa_data2-vge03.
endif.
if wa_data2-vge04 is not initial.
perform bdc_field using var17
wa_data2-vge04.
endif.
if wa_data2-vge05 is not initial.
perform bdc_field using var18
wa_data2-vge05.
endif.
if wa_data2-vge06 is not initial .
perform bdc_field using var19
wa_data2-vge06.
endif.
endif.
****************mc1 changes
if var8 = 'PLPOD-VGW01(2)'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-VORNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'=QMUE'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
perform bdc_field using 'RC27X-FLG_SEL(02)'
'X'.
perform bdc_field using 'PLPOD-VGW01(02)'
'1.2'.
perform bdc_field using 'PLPOD-VGE01(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW02(02)'
'1'.
perform bdc_field using 'PLPOD-VGE02(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW03(02)'
'1'.
perform bdc_field using 'PLPOD-VGE03(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW04(02)'
'8.99'.
perform bdc_field using 'PLPOD-VGE04(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW05(02)'
'5.57'.
perform bdc_field using 'PLPOD-VGE05(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW06(02)'
'1.01'.
perform bdc_field using 'PLPOD-VGE06(02)'
'ZII'.
perform bdc_dynpro using 'SAPLQPAA' '0150'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-VERWMERKM(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'PLMKB-VERWMERKM(01)'
wa_data2-mic.
perform bdc_field using 'PLMKB-MKVERSION(01)'
'1'.
perform bdc_field using 'PLMKB-QMTB_WERKS(01)'
''.
perform bdc_dynpro using 'SAPLQPAA' '1501'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-VERWMERKM'.
perform bdc_field using 'PLMKB-VERWMERKM'
wa_data2-mic..
perform bdc_field using 'PLMKB-QPMK_WERKS'
it_data-werks.
perform bdc_field using 'PLMKB-MKVERSION'
'1'.
perform bdc_dynpro using 'SAPLQPAA' '0150'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-STICHPRVER(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RQPAS-ENTRY_ACT'
'1'.
perform bdc_field using 'PLMKB-STICHPRVER(01)'
wa_data2-char.
perform bdc_dynpro using 'SAPLQPAA' '0150'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-STICHPRVER(01)'.
perform bdc_field using 'BDC_OKCODE'
'=QMBW'.
perform bdc_field using 'RQPAS-ENTRY_ACT'
'1'.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-LTXA1(04)'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
endif.
* *****
* endif.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-VORNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
endloop.
**at END OF matnr.
call transaction 'C201' using it_bdcdata
mode p_mode messages
into it_mess.
*endat.
clear ind.
refresh :it_bdcdata.
endloop.
loop at it_mess into wa_mess.
data : lv_text type string.
call function 'MASS_MESSAGE_GET'
exporting
sprsl = sy-langu
arbgb = wa_mess-msgid
msgnr = wa_mess-msgnr
msgv1 = wa_mess-msgv1
msgv2 = wa_mess-msgv1
msgv3 = wa_mess-msgv1
msgv4 = wa_mess-msgv1
importing
msgtext = lv_text
exceptions
message_not_found = 1
others = 2.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
write :/ lv_text.
* write : / wa_mess-msgnr,
* wa_mess-msgtyp,
* wa_mess-msgv1,
* wa_mess-msgv2,
* wa_mess-msgv3,
* wa_mess-msgv4,
* wa_mess-msg
endloop.
*perform bdc_transaction using 'C201'.
*perform close_group.
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_
*& --> P_
*&---------------------------------------------------------------------*
form bdc_dynpro using value(p_901)
value(p_902).
clear wa_bdcdata.
wa_bdcdata-program = p_901.
wa_bdcdata-dynpro = p_902.
wa_bdcdata-dynbegin = 'X'.
append wa_bdcdata to it_bdcdata.
endform.
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_
*& --> P_
*&---------------------------------------------------------------------*
form bdc_field using value(p_123)
value(p_124).
clear wa_bdcdata.
wa_bdcdata-fnam = p_123.
wa_bdcdata-fval = p_124.
append wa_bdcdata to it_bdcdata.
endform.
*&---------------------------------------------------------------------*
*& Form F4_FILENAME
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
form f4_filename .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FNAME'
importing
file_name = p_fname.
endform.
*&---------------------------------------------------------------------*
*& Form UPLOAD_EXCELDATA_ITAB
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
form upload_exceldata_itab .
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_fname
i_begin_col = '1'
i_begin_row = '6'
i_end_col = '38'
i_end_row = '60000'
tables
intern = it_upload
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc is not initial.
write : / 'File Error'(001).
exit.
endif.
if it_upload[] is initial.
write : / 'No Data Uploaded'(002).
exit.
else.
loop at it_upload into wa_upload .
if wa_upload-row eq w_row.
move wa_upload-col to w_index.
assign component w_index of structure wa_data to <fs>.
if wa_upload-value is initial.
exit.
else.
<fs> = wa_upload-value.
endif.
at end of row.
append wa_data to lt_data.
clear wa_data.
w_row = wa_upload-row + 1 .
endat.
else.
exit.
endif.
endloop.
endif.
endform.
*&---------------------------------------------------------------------*
*& Form EXPORT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_
*&---------------------------------------------------------------------*
form export using p_template_name.
call method cl_gui_frontend_services=>file_save_dialog
exporting
window_title = 'Please Select The Location'
default_extension = 'XLS'
default_file_name = lv_file
*FILE_FILTER = '*.XLS'
changing
filename = lv_filename
path = lv_path
fullpath = lv_fullpath
user_action = lv_action
exceptions
cntl_error = 1
error_no_gui = 2
others = 3.
* types:begin of excel_heading,
* text(20) type c,
* end of excel_heading.
* data:it_heading type standard table of excel_heading initial size 0,
* wa_heading type excel_heading.
*--Generate the heading for excel data
wa_heading-text = 'operation unit'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'operation'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'phase op flag'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'superior Operation'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Control Recipe Destination'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Resources'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Control Key'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Operation Text'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Resources'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base Unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = lv_fullpath
filetype = 'DAT'
* APPEND = ' '
write_field_separator = 'X'
tables
data_tab = it_final[]
fieldnames = it_heading[].
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
endform.
*& Report ZPP01_UPLOAD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
report zpp01_upload.
*report zpp01_upload
* no standard page heading line-size 255.
* Include bdcrecx1_s:
* The call transaction using is called WITH AUTHORITY-CHECK!
* If you have own auth.-checks you can use include bdcrecx1 instead.
*include bdcrecx1_s.
tables: sscrfields.
include <icon>.
types : begin of ty_data,
matnr type matnr,
werks type werks_d,
profident type char4,
sttag type char10,
statu type char1,
verwe type char1,
losvn type char1,
losbs type char8,
plnme type plnme,
bmsch type string,
meinh type vorme,
vornr type vornr,
phflg type phflg,
pvznr type pvznr,
phseq type phseq,
arbpl type arbpl,
ktsch type char4,
ltxa1 type char40,
vgw01 type string,
vge01 type string,
lar01 type string,
vgw02 type string,
vge02 type string,
lar02 type string,
vgw03 type string,
vge03 type string,
lar03 type string,
vgw04 type string,
vge04 type string,
lar04 type string,
vgw05 type string,
vge05 type string,
lar05 type string,
vgw06 type string,
vge06 type string,
lar06 type string,
BMSCHN TYPE STRING, " added
mic type string,
char type string,
flag(3) type n,
end of ty_data.
field-symbols :<fsdata> type any.
types : begin of ty_data1,
matnr type matnr,
werks type werks_d,
profident type char4,
sttag type char10,
statu type char1,
verwe type char1,
losvn type char1,
losbs type char8,
plnme type plnme,
bmsch type bmsch,
meinh type vorme,
vornr type vornr,
flag(3) type n,
end of ty_data1.
types : begin of ty_data2,
phflg type phflg,
pvznr type pvznr,
phseq type phseq,
arbpl type arbpl,
ktsch type char4,
ltxa1 type char40,
vgw01 type string,
vge01 type string,
lar01 type string,
vgw02 type string,
vge02 type string,
lar02 type string,
vgw03 type string,
vge03 type string,
lar03 type string,
vgw04 type string,
vge04 type string,
lar04 type string,
vgw05 type string,
vge05 type string,
lar05 type string,
vgw06 type string,
vge06 type string,
lar06 type string,
BMSCH TYPE STRING,
mic type string,
char type string,
flag(3) type n,
end of ty_data2.
data : wa_data type ty_data,
lt_data type table of ty_data,
lt_data1 type table of ty_data1,
wa_data1 type ty_data1,
wa_data2 type ty_data2,
lt_data2 type table of ty_data2.
data it_data type ty_data occurs 0 with header line.
data ind(2) type c.
data flag(3) type n.
data var1(15) type c.
data var2(15) type c.
data var3(15) type c.
data var4(15) type c.
data var5(15) type c.
data var6(15) type c.
data var7(15) type c.
data var8(15) type c.
data var9(15) type c.
data var10(15) type c.
data var11(15) type c.
data var12(15) type c.
data var13(15) type c.
data var14(15) type c.
data var15(15) type c.
data var16(15) type c.
data var17(15) type c.
data var18(15) type c.
data var19(15) type c.
data var20(15) type c.
data: it_bdcdata type standard table of bdcdata,
wa_bdcdata type bdcdata,
it_mess type standard table of bdcmsgcoll,
wa_mess type bdcmsgcoll.
data: it_upload type standard table of alsmex_tabline,
wa_upload type alsmex_tabline.
data : w_update type ctu_params-updmode,
w_index type i,
w_line type i,
w_row type i value 1,
v_s type char15.
data: lv_lines type sy-tabix.
data cont(3) type n.
data:lv_filename type string,
lv_fullpath type string,
lv_path type string,
lv_action type i,
lv_file type string.
types: begin of ty_final,
** data element: SPRAS
* SPRAS_001(016),
** data element: ASNUM
* ASNUM_002(018),
* data element: ASKTX
asktx_003(040),
* data element: ASTYP
astyp_004(004),
* data element: MEINS
meins_005 type meins,
* data element: MATKL_SRV
matkl_006(009),
* data element: BWKLL
bklas_007(009),
* data element: J_1B_TAX_TARIFF_CODE
taxtariffcode_008(016),
** data element: SPRAS
tline(132),
ean11(18),
* new TYPE c,
end of ty_final.
data: it_final type standard table of ty_final,
wa_final type ty_final.
types:begin of excel_heading,
text(20) type c,
end of excel_heading.
data:it_heading type standard table of excel_heading initial size 0,
wa_heading type excel_heading.
field-symbols : <fs> type any .
selection-screen : begin of block b1 with frame title text-001.
parameters : p_mode type ctu_params-dismode default 'A' obligatory,
p_fname type ibipparms-path.
selection-screen : end of block b1.
selection-screen function key 1.
data: ls_sel_button type smp_dyntxt.
initialization.
ls_sel_button-icon_id = icon_export.
ls_sel_button-quickinfo = 'Download Production Version Template'.
ls_sel_button-icon_text = 'Download Template'.
sscrfields-functxt_01 = ls_sel_button.
at selection-screen.
case sscrfields-ucomm.
when 'FC01'.
perform export using 'ZPD'.
endcase.
at selection-screen on value-request for p_fname.
perform f4_filename.
start-of-selection.
perform upload_exceldata_itab.
if lt_data is not initial.
select * from makt into table @data(lt_makt) for all entries in @lt_data where matnr = @lt_data-matnr.
endif.
* IT_DATA[] = LT_DATA[].
loop at lt_data into wa_data.
it_data-bmsch = wa_data-bmsch.
it_data-matnr = wa_data-matnr.
it_data-werks = wa_data-werks.
it_data-profident = wa_data-profident.
it_data-sttag = wa_data-sttag.
it_data-statu = wa_data-statu.
it_data-verwe = wa_data-verwe.
it_data-losvn = wa_data-losvn.
it_data-losbs = wa_data-losbs.
it_data-plnme = wa_data-plnme.
it_data-meinh = wa_data-meinh.
it_data-vornr = wa_data-vornr.
wa_data2-pvznr = wa_data-pvznr.
wa_data2-phflg = wa_data-phflg.
wa_data2-phseq = wa_data-phseq.
wa_data2-arbpl = wa_data-arbpl.
wa_data2-ktsch = wa_data-ktsch.
wa_data2-ltxa1 = wa_data-ltxa1.
wa_data2-vgw01 = wa_data-vgw01.
wa_data2-vge01 = wa_data-vge01.
wa_data2-lar01 = wa_data-lar01.
wa_data2-vgw02 = wa_data-vgw02.
wa_data2-vge02 = wa_data-vge02.
wa_data2-lar02 = wa_data-lar02.
wa_data2-vgw03 = wa_data-vgw03.
wa_data2-vge03 = wa_data-vge03.
wa_data2-lar03 = wa_data-lar03.
wa_data2-vgw04 = wa_data-vgw04.
wa_data2-vge04 = wa_data-vge04.
wa_data2-lar04 = wa_data-lar04.
wa_data2-vgw05 = wa_data-vgw05.
wa_data2-vge05 = wa_data-vge05.
wa_data2-lar05 = wa_data-lar05.
wa_data2-vgw06 = wa_data-vgw06.
wa_data2-vge06 = wa_data-vge06.
wa_data2-lar06 = wa_data-lar06.
wa_data2-bmsch = wa_data-bmschn.
wa_data2-mic = wa_data-mic.
wa_data2-char = wa_data-char.
at new matnr.
add 1 to flag.
endat.
it_data-flag = flag.
wa_data2-flag = flag.
append wa_data2 to lt_data2.
on change of it_data-matnr.
collect it_data.
endon.
endloop.
loop at it_data .
read table lt_makt into data(ls_makt) with key matnr = it_data-matnr.
*
* WA_DATA2-arbpl.
*pe
perform bdc_dynpro using 'SAPLCPDI' '4000'.
perform bdc_field using 'BDC_CURSOR'
'RC27M-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC271-PLNNR'
' '.
perform bdc_field using 'RC27M-MATNR'
it_data-matnr .
perform bdc_field using 'RC27M-WERKS'
it_data-werks.
perform bdc_field using 'RC271-PROFIDNETZ'
it_data-profident.
perform bdc_field using 'RC271-STTAG'
it_data-sttag.
perform bdc_dynpro using 'SAPLCPDA' '4210'.
perform bdc_field using 'BDC_CURSOR'
'PLKOD-MEINH'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'PLKOD-WERKS'
it_data-werks.
perform bdc_field using 'PLKOD-PLNAL'
'1'.
perform bdc_field using 'PLKOD-KTEXT'
ls_makt-maktx.
perform bdc_field using 'PLKOD-VERWE'
it_data-verwe.
perform bdc_field using 'PLKOD-STATU'
it_data-statu.
perform bdc_field using 'PLKOD-VAGRP'
'1'.
perform bdc_field using 'PLKOD-BMSCH'
it_data-bmsch.
perform bdc_field using 'PLKOD-MEINH'
it_data-meinh.
perform bdc_field using 'PLKOD-LOSBS'
it_data-losbs.
perform bdc_field using 'PLKOD-PLNME'
it_data-plnme.
perform bdc_dynpro using 'SAPLCPDA' '4210'.
perform bdc_field using 'BDC_CURSOR'
'PLKOD-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=VOUE'.
perform bdc_field using 'PLKOD-WERKS'
it_data-werks.
perform bdc_field using 'PLKOD-PLNAL'
'1'.
perform bdc_field using 'PLKOD-KTEXT'
ls_makt-maktx.
perform bdc_field using 'PLKOD-VERWE'
it_data-verwe.
perform bdc_field using 'PLKOD-STATU'
it_data-statu.
perform bdc_field using 'PLKOD-VAGRP'
'1'.
perform bdc_field using 'PLKOD-BMSCH'
it_data-bmsch.
perform bdc_field using 'PLKOD-MEINH'
it_data-meinh.
perform bdc_field using 'PLKOD-LOSBS'
it_data-losbs.
perform bdc_field using 'PLKOD-PLNME'
it_data-plnme.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-STEUS(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
loop at lt_data2 into wa_data2 where flag = it_data-flag.
ind = ind + 1.
concatenate 'PLPOD-PHFLG(' ind ') ' into var1.
condense var1.
concatenate 'PLPOD-PVZNR(' ind') ' into var2.
concatenate 'PLPOD-PHSEQ(' ind ') ' into var3.
concatenate 'PLPOD-ARBPL(' ind ') ' into var4.
* concatenate 'PLPOD-KTSCH(' ind ') ' into var14.
concatenate 'PLPOD-STEUS(' ind ') ' into var5.
concatenate 'PLPOD-LTXA1(' ind ') ' into var6.
* concatenate 'PLPOD-LTXA2(' ind ') ' into var7.
concatenate 'PLPOD-VGW01(' ind ') ' into var8.
concatenate 'PLPOD-VGW02(' ind ') ' into var9.
concatenate 'PLPOD-VGW03(' ind ') ' into var10.
concatenate 'PLPOD-VGW04(' ind ') ' into var11.
concatenate 'PLPOD-VGW05(' ind ') ' into var12.
concatenate 'PLPOD-VGW06(' ind ') ' into var13.
concatenate 'PLPOD-VGE01(' ind ') ' into var14.
concatenate 'PLPOD-VGE02(' ind ') ' into var15.
concatenate 'PLPOD-VGE03(' ind ') ' into var16.
concatenate 'PLPOD-VGE04(' ind ') ' into var17.
concatenate 'PLPOD-VGE05(' ind ') ' into var18.
concatenate 'PLPOD-VGE06(' ind ') ' into var19.
concatenate 'PLPOD-BMSCH(' ind ') ' into var20.
condense: var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19, VAR20.
perform bdc_field using var1
wa_data2-phflg.
condense wa_data-pvznr.
perform bdc_field using var2
wa_data2-pvznr.
perform bdc_field using var3
wa_data2-phseq.
perform bdc_field using var4
wa_data2-arbpl.
* perform bdc_field using var14
* wa_data2-ktsch.
perform bdc_field using var5
wa_data2-ktsch.
*
*
perform bdc_field using var6
wa_data2-ltxa1.
* *************ADDED BY PK18/07
perform bdc_field using var20
wa_data2-bmsch.
* ****************************ADDED
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
* *****************ADDED
* perform bdc_field using var7
* wa_data2-ltxa1.
if wa_data2-phflg eq 'X'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
var8.
* perform bdc_field using 'BDC_CURSOR'
* var8.
condense wa_data2-vgw01.
perform bdc_field using var8
wa_data2-vgw01.
* CONDENSE wa_data2-vgw02.
if wa_data2-vgw02 is not initial.
perform bdc_field using var9
wa_data2-vgw02.
endif.
if wa_data2-vgw03 is not initial.
perform bdc_field using var10
wa_data2-vgw03.
endif.
if wa_data2-vgw04 is not initial.
perform bdc_field using var11
wa_data2-vgw04.
endif.
if wa_data2-vgw05 is not initial.
perform bdc_field using var12 wa_data2-vgw05.
endif.
if wa_data2-vgw06 is not initial.
perform bdc_field using var13
wa_data2-vgw06.
endif.
* *********
if wa_data2-vge01 is not initial.
perform bdc_field using var14
wa_data2-vge01.
endif.
if wa_data2-vge02 is not initial.
perform bdc_field using var15
wa_data2-vge02.
endif.
if wa_data2-vge03 is not initial.
perform bdc_field using var16
wa_data2-vge03.
endif.
if wa_data2-vge04 is not initial.
perform bdc_field using var17
wa_data2-vge04.
endif.
if wa_data2-vge05 is not initial.
perform bdc_field using var18
wa_data2-vge05.
endif.
if wa_data2-vge06 is not initial .
perform bdc_field using var19
wa_data2-vge06.
endif.
endif.
****************mc1 changes
if var8 = 'PLPOD-VGW01(2)'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-VORNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'=QMUE'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
perform bdc_field using 'RC27X-FLG_SEL(02)'
'X'.
perform bdc_field using 'PLPOD-VGW01(02)'
'1.2'.
perform bdc_field using 'PLPOD-VGE01(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW02(02)'
'1'.
perform bdc_field using 'PLPOD-VGE02(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW03(02)'
'1'.
perform bdc_field using 'PLPOD-VGE03(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW04(02)'
'8.99'.
perform bdc_field using 'PLPOD-VGE04(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW05(02)'
'5.57'.
perform bdc_field using 'PLPOD-VGE05(02)'
'ZII'.
perform bdc_field using 'PLPOD-VGW06(02)'
'1.01'.
perform bdc_field using 'PLPOD-VGE06(02)'
'ZII'.
perform bdc_dynpro using 'SAPLQPAA' '0150'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-VERWMERKM(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'PLMKB-VERWMERKM(01)'
wa_data2-mic.
perform bdc_field using 'PLMKB-MKVERSION(01)'
'1'.
perform bdc_field using 'PLMKB-QMTB_WERKS(01)'
''.
perform bdc_dynpro using 'SAPLQPAA' '1501'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-VERWMERKM'.
perform bdc_field using 'PLMKB-VERWMERKM'
wa_data2-mic..
perform bdc_field using 'PLMKB-QPMK_WERKS'
it_data-werks.
perform bdc_field using 'PLMKB-MKVERSION'
'1'.
perform bdc_dynpro using 'SAPLQPAA' '0150'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-STICHPRVER(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RQPAS-ENTRY_ACT'
'1'.
perform bdc_field using 'PLMKB-STICHPRVER(01)'
wa_data2-char.
perform bdc_dynpro using 'SAPLQPAA' '0150'.
perform bdc_field using 'BDC_CURSOR'
'PLMKB-STICHPRVER(01)'.
perform bdc_field using 'BDC_OKCODE'
'=QMBW'.
perform bdc_field using 'RQPAS-ENTRY_ACT'
'1'.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-LTXA1(04)'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
endif.
* *****
* endif.
perform bdc_dynpro using 'SAPLCPDI' '4400'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-VORNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
endloop.
**at END OF matnr.
call transaction 'C201' using it_bdcdata
mode p_mode messages
into it_mess.
*endat.
clear ind.
refresh :it_bdcdata.
endloop.
loop at it_mess into wa_mess.
data : lv_text type string.
call function 'MASS_MESSAGE_GET'
exporting
sprsl = sy-langu
arbgb = wa_mess-msgid
msgnr = wa_mess-msgnr
msgv1 = wa_mess-msgv1
msgv2 = wa_mess-msgv1
msgv3 = wa_mess-msgv1
msgv4 = wa_mess-msgv1
importing
msgtext = lv_text
exceptions
message_not_found = 1
others = 2.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
write :/ lv_text.
* write : / wa_mess-msgnr,
* wa_mess-msgtyp,
* wa_mess-msgv1,
* wa_mess-msgv2,
* wa_mess-msgv3,
* wa_mess-msgv4,
* wa_mess-msg
endloop.
*perform bdc_transaction using 'C201'.
*perform close_group.
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_
*& --> P_
*&---------------------------------------------------------------------*
form bdc_dynpro using value(p_901)
value(p_902).
clear wa_bdcdata.
wa_bdcdata-program = p_901.
wa_bdcdata-dynpro = p_902.
wa_bdcdata-dynbegin = 'X'.
append wa_bdcdata to it_bdcdata.
endform.
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_
*& --> P_
*&---------------------------------------------------------------------*
form bdc_field using value(p_123)
value(p_124).
clear wa_bdcdata.
wa_bdcdata-fnam = p_123.
wa_bdcdata-fval = p_124.
append wa_bdcdata to it_bdcdata.
endform.
*&---------------------------------------------------------------------*
*& Form F4_FILENAME
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
form f4_filename .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FNAME'
importing
file_name = p_fname.
endform.
*&---------------------------------------------------------------------*
*& Form UPLOAD_EXCELDATA_ITAB
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
form upload_exceldata_itab .
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_fname
i_begin_col = '1'
i_begin_row = '6'
i_end_col = '38'
i_end_row = '60000'
tables
intern = it_upload
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc is not initial.
write : / 'File Error'(001).
exit.
endif.
if it_upload[] is initial.
write : / 'No Data Uploaded'(002).
exit.
else.
loop at it_upload into wa_upload .
if wa_upload-row eq w_row.
move wa_upload-col to w_index.
assign component w_index of structure wa_data to <fs>.
if wa_upload-value is initial.
exit.
else.
<fs> = wa_upload-value.
endif.
at end of row.
append wa_data to lt_data.
clear wa_data.
w_row = wa_upload-row + 1 .
endat.
else.
exit.
endif.
endloop.
endif.
endform.
*&---------------------------------------------------------------------*
*& Form EXPORT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_
*&---------------------------------------------------------------------*
form export using p_template_name.
call method cl_gui_frontend_services=>file_save_dialog
exporting
window_title = 'Please Select The Location'
default_extension = 'XLS'
default_file_name = lv_file
*FILE_FILTER = '*.XLS'
changing
filename = lv_filename
path = lv_path
fullpath = lv_fullpath
user_action = lv_action
exceptions
cntl_error = 1
error_no_gui = 2
others = 3.
* types:begin of excel_heading,
* text(20) type c,
* end of excel_heading.
* data:it_heading type standard table of excel_heading initial size 0,
* wa_heading type excel_heading.
*--Generate the heading for excel data
wa_heading-text = 'operation unit'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'operation'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'phase op flag'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'superior Operation'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Control Recipe Destination'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Resources'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Control Key'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Operation Text'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Resources'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base Unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Base unit of measure'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Activity'.
append wa_heading to it_heading.
clear wa_heading.
wa_heading-text = 'Value'.
append wa_heading to it_heading.
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = lv_fullpath
filetype = 'DAT'
* APPEND = ' '
write_field_separator = 'X'
tables
data_tab = it_final[]
fieldnames = it_heading[].
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
endform.