KD_GET_FILENAME_ON_F4
how to use this fm KD_GET_FILENAME_ON_F4 ?
Please send me sample code .....
Here's an example of how we use it:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
CHANGING
file_name = p_file.
- April King
Similar Messages
-
Function module: KD_GET_FILENAME_ON_F4
Hi,
I have noticed that function module KD_GET_FILENAME_ON_F4, behaves differently in ECC5.0 and 46C.
Is there any diff? I mean is there any diff in MASK parameter?
Regards,
UmeshHai Umesh
There is no change at 'Mask' parameter
Check the following Code
PARAMETERS: p_entry LIKE rlgrap-filename DEFAULT 'C:\Hai_f4.txt'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_entry.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
field_name = ' '
mask = ',Todos los archivos,'
CHANGING
file_name = p_entry
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc NE 0.
ENDIF.
Thanks & regards
Sreeni -
How to ijntroduce PUSH Button in KD_GET_FILENAME_ON_F4
Dear Experts,
I am new to ABAP.
I know how to use push button in Sel-Screen. But my requirement is:
1)How can I use a push button in "KD_GET_FILENAME_ON_F4" so that on hitting the push button a PopUp screen appears.
2) This Pop up screen should be a file directory screen from which I can select a file.
3) This file on one click should get considered as "file_name" of the call function "KD_GET_FILENAME_ON_F4."
Looking forward for advise from experts.
Regards
Chandan KumarDear Mr Klaus,
Thanks for your reply. The method suggested by you will definitely help the user to directly open a file dialogue box. But I want the code to make it more simpler for the user. After I execute the code The use should get a Push Button. On hitting this push button a POP UP screen should appear. This pop up screen should lear us to the target folder.
In your suggestion it was possible to open a folder path pop up screen. just I want to intriduce a PUSH button there. Also I want multi selection to be possible. In your suggestion above when I wrote the code as:
DATA: file_str1 type string.
data: it_tab TYPE STANDARD TABLE OF file_table,
lw_file LIKE LINE OF it_tab,
gd_subrc TYPE i.
SELECTION-SCREEN begin of block blk with frame title text-100.
SELECTION-SCREEN SKIP 2.
parameters : p_file like rlgrap-filename .
SELECTION-SCREEN end of block blk.
*F4 input file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select only Text File'
default_filename = '.azt'
multiselection = 'X'
CHANGING
file_table = it_tab
rc = gd_subrc.
READ TABLE it_tab INTO lw_file INDEX 1.
p_file = lw_file-FILENAME.
Start-of-Selection.
file_str1 = P_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_str1
* filename = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\test.azt'
tables
data_tab = it_string
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In the above code when I use Multiselection = 'X' then in the folder pop up multiselection is possible but the multiselection deosn't
gets selected for upload.
Looking forward for your suggestions.
That is my requirement.
Regards,
Chandan -
FM KD_GET_FILENAME_ON_F4
Hi,
How can I assign to a textinput field on the dynpro the following Function Module KD_GET_FILENAME_ON_F4.
Thus the user can select conveniently file .
Regards
sasHi,
data:
p_file type RLGRAP-FILENAME.
at selection-screen on value-request for p_file. "-> Parameter name
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
* EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
* STATIC = ' '
* MASK = ' '
CHANGING
file_name = p_file
* EXCEPTIONS
* MASK_TOO_LONG = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
you can use the class which will be a better way
like this
PARAMETERS:
p_file TYPE char25.
DATA:
w_file TYPE filetable,
fs_file LIKE LINE OF w_file,
w_i TYPE i.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
* EXPORTING
* window_title =
* default_extension =
* default_filename =
* file_filter =
* with_encoding =
* initial_directory =
* multiselection =
CHANGING
file_table = w_file
rc = w_i
* user_action =
* file_encoding =
* EXCEPTIONS
* file_open_dialog_failed = 1
* cntl_error = 2
* error_no_gui = 3
* not_supported_by_gui = 4
* others = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT w_file INTO fs_file.
p_file = fs_file-filename.
ENDLOOP.
NOTE: use this in POV
check the link for more information
[http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/content.htm]
regards
sarves -
Hi,
I want to download a file in XLS format.
While using KD_GET_FILENAME_ON_F4 FM .
When i get a pop up window ,i need the default filetype to be shown as XLS file type.I am declaring like this.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
FIELD_NAME = 'rt'
static = 'X'
mask = ',.XLS,*.xls'
CHANGING
file_name = lv_filepath
EXCEPTIONS
mask_too_long = 1
OTHERS = 2. -
GUI_UPLOAD or KD_GET_FILENAME_ON_F4
Hi All,
Could you please tell me which function module is very useful for F4 help.
REgards,
AMARhi,
hi for F4 value for local directory. even you can use 'F4_FILENAME'
at selection-screen on value-request for p_file.
call function 'WS_FILENAME_GET'
exporting
def_filename = space
def_path = p_file "File name
mask = ',*.*.'
mode = 'O'
title = title
importing
filename = p_file ""File name
rc = dummy
exceptions
inv_winsys = 04
no_batch = 08
selection_cancel = 12
selection_error = 16.
if sy-subrc ne 0.
message i872(5g).
endif.
Regards,
Prabhudas -
Open and Close Dataset problem
Hi All,
I am facing a weird problem in transferring data to application server.
I have used Open dataset to write my file in text format to the application server.
Now everything works fine when small amount of data is there.When the number of records increases and when it takes lot of time , the format of the text file is completely distorted.
I have used tab as the delimiter. Please suggest me some solution for this.
Is this due to the time taken?
Regards.Hi
in the above program , when i had created 1st i had same problem
then i had worte the logic likethis
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.</b>
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
with the bold letters above
i had wrote that logic for that
reward if usefull -
Hello ,
While using the BAPI 'BAPI_MATERIAL_SAVEDATA', to extend material from one plant to another my code is throwing an error 'Currency initial v,current amount 6,000.0000 in MOVING_PR was transferred without a currency'
Enter a material number'
I have incorporated mbew-peinh, even then its throwing the same error.
I snd copy of my code.
report zmm_r018 .
*& Prog to copy n create the existing material using bapi .
tables: t001l, "Storage Locations
mara, "General Material Data
makt, "Material Descriptions
mbew, "Material Valuation
marc, "Plant Data for Material
mltx. "Purchase Order Descriptions
**parameters : new_mat like mara-matnr,
desc like makt-maktx,
*data: ref_mat like mara-matnr.
*data: xmara type mara.
**data: wamatnr like mara-matnr.
data: potext type string."Purchase Order Desc
data : ihead_data type bapimathead,
iclient_data type bapi_mara, "Client Data
iclient_datax type bapi_marax,
imakt like bapi_makt, "Mat Description
iplant_data like bapi_marc, "Plant View
iplant_datax like bapi_marcx,
iltxt type table of bapi_mltx with header line, "Pur Order Text
istoragelocationdata type bapi_mard, "Storage Location
istoragelocationdatax type bapi_mardx,
iaccounting_data like bapi_mbew, "Accounting View
iaccounting_datax like bapi_mbewx,
bapiret like bapiret2,
returnm type table of bapi_matreturn2 with header line.
**Internal Table to hold the records in the text file
types:begin of it,
matnr(18), " Material number
mbrsh(1), " Industry sector
mtart(4), " Material type
werks(4), " Plant
lgort_d(4), "Storage Location
maktx(40), " Material description
meins(3), " Base unit of measure
matkl(9) , " Material group
bismt(18), " Old Material number
spart(2), " Division
gewei(3), " Weight Unit
text1(30), " Purchasr Order Text
text2(30),
text3(30),
text4(30),
text5(30),
text6(30),
dzeinr(22), " Document
ekgrp(3), " Purchasing group
ekwsl(4), " Purchase Value Key
webaz(3), " Goods receipt processing time in days
dismm(2), " MRP Type
minbe(13), "Reorder point
dispo(3), " MRP Controller
disls(2), "Lot size (materials planning)
mabst(13), "Maximum stock level
plifz(3), " Planned delivery time in days
webaz1(3), " Goods receipt processing time in days
fhori(3), "Scheduling Margin Key for Floats
eisbe(13), "Safety stock
mtvfp(2), "Checking Group for Availability Check
lgpbe(10), "Storage Bin
qmatauth(6),"Material Authorization Group for Activities in QM
qmpur(1), " QM in Procurement is Active
qsspur(8), "Control Key for Quality Management in Procurement
bklas(4), " Valuation Class
bwtty_d(1), "Valuation Category
vprsv(1), " Price control indicator
verpr_bapi(23), "Moving average price/periodic unit price
peinh(5), "Price Unit
end of it.
data: it_data type table of it,
wa_data like line of it_data.
*Decalraing flag
data: v_flag value ''.
*DECLARING WORK AREAs TO BE PASSED TO THE FUNCTION MODULE.
data: bapi_head like bapimathead,
bapi_clientdata like bapi_mara,
bapi_clientdatax like bapi_marax,
bapi_plantdata like bapi_marc,
bapi_plantdatax like bapi_marcx,
bapi_storagelocationdata like bapi_mard,
bapi_storagelocationdatax like bapi_mardx,
bapi_salesdata like bapi_mvke,
bapi_salesdatax like bapi_mvkex,
bapi_makt like bapi_makt,
bapi_return like bapiret2.
*INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION
data: begin of it_makt occurs 0.
include structure bapi_makt.
data end of it_makt.
data:begin of it_ret occurs 0.
include structure bapiret2.
data end of it_ret.
*INTERNAL TABLE TO HOLD HEADER DATA
data: it_excel type alsmex_tabline occurs 0 with header line.
*SELECTION-SCREEN ELEMENTS
selection-screen begin of block b1 with frame title text-001.
parameter: fname type rlgrap-filename default 'c:\supplies.xls'.
parameters: p_begcol type i default '1' no-display,
p_begrow type i default '2' no-display,
p_endcol type i default '200' no-display,
p_endrow type i default '2500' no-display.
*perform f_get_data.
selection-screen end of block b1.
*DECLARATION OF EXCELAL TABLE
at selection-screen on value-request for fname.
perform f_get_file using fname.
start-of-selection.
perform f_xls_itab using fname
changing it_excel.
perform f_move_data.
perform f_get_data.
perform f_call_bapi.
*& Form F_GET_FILE
text
-->P_FNAME text
<--P_SY_SUBRC text
form f_get_file using p_fname like fname.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
changing
file_name = p_fname
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
if sy-subrc <> 0.
message e006(zhnc).
endif.
endform. " F_GET_FILE
*& Form F_XLS_ITAB
text
-->P_FNAME text
<--P_IT_EXCEL text
form f_xls_itab using p_fname
changing p_it_excel.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = 'c:\supplies.xls'
i_begin_col = p_begcol
i_begin_row = p_begrow
i_end_col = p_endcol
i_end_row = p_endrow
tables
intern = it_excel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " F_XLS_ITAB
*& Form F_MOVE_DATA
text
--> p1 text
<-- p2 text
form f_move_data .
data : lv_index type i.
field-symbols <fs>.
*--- Sorting the internal table
sort it_excel by row col.
clear it_excel.
loop at it_excel.
move it_excel-col to lv_index.
*--- Assigning the each record to an internal table row
assign component lv_index of structure wa_data to <fs>.
*--- Asigning the field value to a field symbol
move it_excel-value to <fs>.
at end of row.
append wa_data to it_data.
clear wa_data.
endat.
endloop.
endform. " F_MOVE_DATA
form f_get_data .
loop at it_data into wa_data.
move-corresponding wa_data to ihead_data.
Header
ihead_data-material = wa_data-matnr.
ihead_data-ind_sector = wa_data-mbrsh.
ihead_data-matl_type = wa_data-mtart.
ihead_data-basic_view = 'X'.
ihead_data-purchase_view = 'X'.
ihead_data-mrp_view = 'X'.
ihead_data-storage_view = 'X'.
ihead_data-quality_view = 'X'.
ihead_data-account_view = 'X'.
move-corresponding wa_data to iclient_data.
Material Description
refresh it_makt.
it_makt-langu = 'EN'.
it_makt-matl_desc = wa_data-maktx.
append it_makt.
Purchase Order Description
clear:iltxt,iltxt[].
concatenate wa_data-text1 wa_data-text2 wa_data-text3 wa_data-text4
wa_data-text5 wa_data-text6 into potext
separated by space.
iltxt-applobject = 'MATERIAL'.
iltxt-text_name = wa_data-matnr.
iltxt-text_id = 'BEST'.
iltxt-langu = sy-langu.
iltxt-langu_iso = 'EN'.
iltxt-format_col = space.
iltxt-text_line = potext.
append iltxt.
Client Data - Basic
iclient_data-matl_group = wa_data-matkl.
iclient_data-old_mat_no = wa_data-bismt.
iclient_data-base_uom = wa_data-meins.
iclient_data-document = wa_data-dzeinr.
iclient_data-unit_of_wt = wa_data-gewei.
iclient_data-division = wa_data-spart.
iclient_data-qm_procmnt = wa_data-qmpur.
iclient_data-pur_valkey = wa_data-ekwsl.
iclient_datax-matl_group = 'X'.
iclient_datax-old_mat_no = 'X'.
iclient_datax-base_uom = 'X'.
iclient_datax-po_unit = 'X'.
iclient_datax-document = 'X'.
iclient_datax-unit_of_wt = 'X'.
iclient_datax-division = 'X'.
iclient_datax-var_ord_un = 'X'.
iclient_data-pur_valkey = 'X'.
move-corresponding wa_data to iplant_data.
Plant - Purchasing
iplant_data-plant = wa_data-werks.
iplant_data-pur_group = wa_data-ekgrp.
iplant_data-gr_pr_time = wa_data-webaz.
iplant_datax-plant = wa_data-werks.
iplant_data-pur_group = 'X'.
iplant_datax-gr_pr_time = 'X'.
*MRP1 View
iplant_data-mrp_type = wa_data-dismm.
iplant_data-reorder_pt = wa_data-minbe.
iplant_data-mrp_ctrler = wa_data-dispo.
iplant_data-lotsizekey = wa_data-disls.
iplant_data-max_stock = wa_data-mabst .
iplant_datax-mrp_type = 'X'.
iplant_datax-reorder_pt = 'X'.
iplant_datax-mrp_ctrler = 'X'.
iplant_datax-lotsizekey = 'X'.
iplant_datax-max_stock = 'X'.
*MRP2 View
iplant_data-plnd_delry = wa_data-plifz.
iplant_data-sm_key = wa_data-fhori.
iplant_data-ctrl_key = wa_data-qsspur.
iplant_data-availcheck = wa_data-mtvfp.
iplant_datax-plnd_delry = 'X'.
iplant_datax-sm_key = 'X'.
iplant_data-ctrl_key = 'X'.
iplant_datax-availcheck = 'X'.
*MRP3 View
iplant_data-safety_stk = wa_data-eisbe.
iplant_data-qm_authgrp = wa_data-qmatauth.
iplant_datax-safety_stk = 'X'.
iplant_data-qm_authgrp = 'X'.
move-corresponding wa_data to istoragelocationdata.
Storage View
istoragelocationdata-plant = wa_data-werks.
istoragelocationdata-stge_loc = wa_data-lgort_d.
istoragelocationdata-stge_bin = wa_data-lgpbe.
istoragelocationdatax-plant = wa_data-werks.
istoragelocationdatax-stge_loc = wa_data-lgort_d.
istoragelocationdatax-stge_bin = 'X'.
Accounting
iaccounting_data-val_area = wa_data-werks.
iaccounting_data-price_ctrl = wa_data-vprsv.
iaccounting_data-moving_pr = wa_data-verpr_bapi.
iaccounting_data-price_unit = wa_data-peinh.
iaccounting_data-val_class = wa_data-bklas.
iaccounting_data-val_cat = wa_data-bwtty_d.
iaccounting_datax-val_area = wa_data-werks.
iaccounting_datax-price_ctrl = 'X'.
iaccounting_datax-moving_pr = 'X'.
iaccounting_datax-price_unit = 'X'.
iaccounting_datax-val_class = 'X'.
iaccounting_datax-val_cat = 'X'.
clear it_ret.
refresh it_ret.
perform f_call_bapi.
read table it_ret with key type = 'S'.
if sy-subrc eq 0.
perform f_bapi_commit.
write:/ 'MATERIAL CREATED OR UPDATED SUCESSFULLY WITH MATERIAL NO',
wa_data-matnr.
else.
*message e000(zhnc) with 'ERROR IN CREATING THE MATERIAL'.
*WRITE: / 'ERROR IN CREATIN MATERIAL',IT_RET-MESSAGE.
*PERFORM F_DOWNLOAD.
endif.
*ENDIF.
endloop.
endform. " F_GET_DATA
*& Form F_CALL_BAPI
text
--> p1 text
<-- p2 text
form f_call_bapi .
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = ihead_data
clientdata = iclient_data
clientdatax = iclient_datax
plantdata = iplant_data
plantdatax = iplant_datax
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
storagelocationdata = istoragelocationdata
storagelocationdatax = istoragelocationdatax
valuationdata = iaccounting_data
valuationdatax = iaccounting_datax
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA = istoragelocationdata
STORAGETYPEDATAX = istoragelocationdatax
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
NO_DEQUEUE = ' '
NO_ROLLBACK_WORK = ' '
importing
return = it_ret
tables
materialdescription = it_makt
UNITSOFMEASURE = it_uom
UNITSOFMEASUREX = it_uomx
INTERNATIONALARTNOS =
materiallongtext = iltxt
TAXCLASSIFICATIONS =
returnmessages = returnm.
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
append it_ret.
write: it_ret-message .
endform. " F_CALL_BAPI
*& Form F_BAPI_COMMIT
text
--> p1 text
<-- p2 text
form f_bapi_commit .
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
endform. " F_BAPI_COMMIT
Plz suggest some solution.
Best Regards,
RaviHi,
Insert Material number in the MAKT(Material Description table).
Also, check if the material number is missing somewhere else...
Regards,
Kunjal -
Hi i have one zprogram, it is written for to get the data from application server ,
now i need to change the code to take the file from local drive.
here iam giving the code ,could any one help me in this.
INCLUDE zppiforecasttop.
INCLUDE zppiforecastf01.
SELECTION SCREEN EVENTS
*Check the splitting rules against source file format
AT SELECTION-SCREEN ON RADIOBUTTON GROUP r4.
IF rb_spmon = 'X' AND rb_week = 'X'.
MESSAGE e005(z1) WITH text-t13.
ENDIF.
IF rb_spday <> 'X' AND rb_daily = 'X'.
MESSAGE e005(z1) WITH text-t14.
ENDIF.
F4 value help on filename field
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR: w_choice, t_filelist.
REFRESH: t_filelist.
w_proc = 'proc'.
w_txt = 'txt'.
get and open logical filename
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = p_lognam
parameter_1 = i_para_1
parameter_2 = i_para_2
parameter_3 = i_para_3
IMPORTING
file_name = w_dir
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE e005(z1) WITH text-t18.
ENDIF.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = w_dir
file_mask = '.'
TABLES
dir_list = t_files
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
*If the return code is not 0 exit from event
IF sy-subrc <> 0.
EXIT.
ELSE.
*Loop at list of files and convert to display format
LOOP AT t_files.
only show processed files with filename 'proc'
SEARCH t_files-name FOR w_proc.
IF sy-subrc = 0.
t_filelist-name = t_files-name.
t_filelist-size = t_files-size.
APPEND t_filelist.
ENDIF.
only show processed files with filename 'txt'
SEARCH t_files-name FOR w_txt.
IF sy-subrc = 0.
t_filelist-name = t_files-name.
t_filelist-size = t_files-size.
APPEND t_filelist.
ENDIF.
ENDLOOP.
IF t_filelist[] IS INITIAL.
EXIT.
ENDIF.
ENDIF.
*Display list of available files in a popup screen
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = '100'
endpos_row = '23'
startpos_col = '10'
startpos_row = '5'
titletext = 'Select File'
IMPORTING
choise = w_choice
TABLES
valuetab = t_filelist
EXCEPTIONS
break_off = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE t_filelist INDEX w_choice.
CONCATENATE w_dir t_filelist-name INTO p_file.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Start of Selection
START-OF-SELECTION.
*Check that the filetype corresponds to the selection
PERFORM check_file.
*Upload the file by resolving logical filename.
PERFORM upload_file.
*Depending on the selection criteria, alter the input data into the
*desired format and store.
PERFORM populate_post_split_table.
*Build the idoc of type SOPGEN01
PERFORM post_idoc.
Rename the file extension from '.txt' to '*.proc_yyyymmdd', if
*reprocessing a file do nothing
SEARCH p_file FOR '*txt'.
IF sy-subrc = 0.
PERFORM rename_file.
ENDIF.
End of Selection
END-OF-SELECTION.
*Output error report
PERFORM error_report.
Top of Page
TOP-OF-PAGE.
PERFORM top_of_page.
◄.........this is the first include........................
◄----
INCLUDE ZPPIFORECASTTOP *
TABLES
TABLES: marc, "Plant Data for Material
marm, "Units of Measure for Material
edidd, "Data record (IDoc)
edidc, "Control Segment
e1lipm0, "General characteristic segment
e1lipv0, "General version segment
e1lipp0. "Performance measure segment
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t01.
PARAMETERS: rb_1000 RADIOBUTTON GROUP r1 DEFAULT 'X',
rb_1005 RADIOBUTTON GROUP r1.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t02.
PARAMETERS: rb_mgx RADIOBUTTON GROUP r2 DEFAULT 'X',
rb_other RADIOBUTTON GROUP r2.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-t03.
PARAMETERS: rb_month RADIOBUTTON GROUP r3 DEFAULT 'X',
rb_week RADIOBUTTON GROUP r3,
rb_daily RADIOBUTTON GROUP r3.
SELECTION-SCREEN END OF BLOCK b4.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-t04.
PARAMETERS: rb_spmon RADIOBUTTON GROUP r4 DEFAULT 'X',
rb_spwk RADIOBUTTON GROUP r4,
rb_spday RADIOBUTTON GROUP r4.
SELECTION-SCREEN END OF BLOCK b5.
SELECT-OPTIONS: so_datum FOR sy-datum, " (Planning time horizon)
so_matnr FOR marc-matnr. " (Material Master)
PARAMETERS: p_lognam LIKE filenameci-fileintern
DEFAULT 'ZPPIFORECAST_FILENAME' NO-DISPLAY,
p_file LIKE rlgrap-filename OBLIGATORY. "(Input file)
SELECTION-SCREEN END OF BLOCK b1.
TYPES
TYPES: BEGIN OF workdate,
datum LIKE sy-datum,
day TYPE p,
workday(1) TYPE c,
END OF workdate.
TYPES: BEGIN OF postsplit.
INCLUDE STRUCTURE zppiforecast.
TYPES: fromdat LIKE sy-datum,
todat LIKE sy-datum,
split_date LIKE sy-datum,
split_value(10) TYPE c,
flg_noscp(1) TYPE c,
END OF postsplit.
TYPES: BEGIN OF exception.
INCLUDE STRUCTURE zppiforecast.
TYPES: docnum TYPE docnum,
message TYPE edi_statx_,
END OF exception.
TYPES: BEGIN OF filelist,
name TYPE epsfilnam,
size(10) TYPE c,
END OF filelist.
DATA
DATA: t_files TYPE TABLE OF epsfili INITIAL SIZE 0 WITH HEADER LINE,
i_file TYPE TABLE OF zppiforecast INITIAL SIZE 0 WITH HEADER LINE,
t_exception TYPE TABLE OF exception INITIAL SIZE 0
WITH HEADER LINE,
i_post_split TYPE TABLE OF postsplit INITIAL SIZE 0
WITH HEADER LINE,
t_workdates TYPE TABLE OF workdate INITIAL SIZE 0
WITH HEADER LINE,
t_filelist TYPE TABLE OF filelist INITIAL SIZE 0 WITH HEADER LINE.
DATA: t_edidc TYPE TABLE OF edidc INITIAL SIZE 0 WITH HEADER LINE,
t_edidd TYPE TABLE OF edidd INITIAL SIZE 0 WITH HEADER LINE,
t_edids TYPE TABLE OF edids INITIAL SIZE 0 WITH HEADER LINE.
DATA: w_choice TYPE sy-tabix, "Index of chosen file
w_line(100), "100 character string
w_dir LIKE epsf-epsdirnam, "Directory path
w_hiper LIKE t445p-hiper, "Forecast lower limit
w_fuper LIKE t445p-fuper, "Forecast upper limit
w_count TYPE i, "Counter
w_total TYPE i, "Total
w_start LIKE sy-datum, "Start date in the range
w_end LIKE sy-datum, "End date in the range
w_date LIKE sy-datum, "Curent Date
w_first LIKE sy-datum, "First working date in range
w_flg_noscp(1) TYPE c, "No SCP UoM flag
w_days TYPE butag, "No of days
w_day TYPE p, "Day of the week indicator
w_value LIKE zppiforecast-value, "Record Value
w_post_split TYPE postsplit, "Work area for post split table line
w_docnum LIKE edidc-docnum, "IDOC number
w_docnum_no_zero LIKE w_docnum, " IDOC number wthout zeros
w_statva LIKE stacust-statva,
w_error(1) TYPE c,
w_matnr TYPE matnr,
w_tabix TYPE sytabix,
w_messg TYPE message,
w_msgln TYPE i,
w_todat LIKE sy-datum,
w_fromdat LIKE sy-datum,
w_lines TYPE i,
w_count_idoc_errors TYPE i,
w_count_recs_uploaded TYPE i,
w_count_idoc_posted TYPE i.
DATA: w_proc(4) TYPE c.
DATA: w_txt(4) TYPE c.
DATA: logsys LIKE tbdls-logsys.
CONSTANTS
CONSTANTS: c_uom LIKE marm-meinh VALUE 'SCP', "Unit of measure
c_delim TYPE x VALUE '09',
c_type LIKE rlgrap-filetype VALUE 'DAT',
c_werks_1000 LIKE marc-werks VALUE '1000',
c_werks_1005 LIKE marc-werks VALUE '1005',
c_pltyp_805 LIKE t445p-sctyp VALUE 'Z_805',
c_pltyp_810 LIKE t445p-sctyp VALUE 'Z_810',
c_mestyp_805 TYPE edi_mestyp VALUE 'LIP805',
c_mestyp_810 TYPE edi_mestyp VALUE 'LIP810',
c_rcvprt TYPE edi_rcvprt VALUE 'LS',
c_sndprn TYPE edi_sndprn VALUE 'WEBM_LS',
c_sndprt TYPE edi_sndprt VALUE 'LS'.
◄..............this is the second include.................
◄----
INCLUDE ZPPIFORECASTF01 *
*& Form upload_file
form upload_file.
data: w_matnr like mara-matnr,
w_datum like sy-datum.
*Open file in read mode
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
clear: t_exception.
*Read line of data into text string variable
read dataset p_file into w_line.
*If successful. append the internal file table
if sy-subrc = 0.
add 1 to w_count_recs_uploaded.
*Split the string at delimiter into internal file table
split w_line at c_delim into i_file-matnr
i_file-datum
i_file-value.
call function 'CONVERSION_EXIT_MATN1_INPUT'
exporting
input = i_file-matnr
importing
output = w_matnr
exceptions
length_error = 1
others = 2.
i_file-index = sy-index.
*Check that the date is in the correct format.
call function 'CONVERT_DATE_TO_INTERN_FORMAT'
exporting
datum = i_file-datum
dtype = 'DATS'
importing
error = w_error
idate = i_file-datum
messg = w_messg
msgln = w_msgln.
*If an error has occurred write entry to error table, otherwise append
*record list
if not w_error is initial.
t_exception = i_file.
t_exception-message = text-006.
append t_exception.
else.
check i_file-datum in so_datum.
append i_file.
endif.
else.
exit.
endif.
enddo.
else.
message w005(z1) with 'File ' p_file ' cannot be opened'.
endif.
*Close the file
close dataset p_file.
endform. " upload_file
*& Form process_monthly
form process_monthly.
data: w_mm type bumon,
w_yyyy type bdatj.
w_mm = i_file-datum+4(2).
w_yyyy = i_file-datum(4).
*Get the number of days in the month
call function 'NUMBER_OF_DAYS_PER_MONTH_GET'
exporting
par_month = w_mm
par_year = w_yyyy
importing
par_days = w_days.
*Set date variable to first day
w_date = i_file-datum.
*Get the first working day in the month
perform get_first_day.
*Set date variable to last day in the month
w_date = i_file-datum + w_days - 1.
*Get the last working day in the month
perform get_last_day.
*Populate the post split table with monthly value
i_post_split-split_value = w_value.
i_post_split-matnr = i_file-matnr.
i_post_split-fromdat = w_fromdat.
i_post_split-todat = w_todat.
i_post_split-datum = i_file-datum.
i_post_split-value = i_file-value.
i_post_split-index = i_file-index.
i_post_split-split_date = i_file-datum.
i_post_split-flg_noscp = w_flg_noscp.
append i_post_split.
endform. " process_monthly
*& Form check_material
form check_material using value(plant) value(pltyp).
*Check that the material plant combination exists
select single matnr from marc into w_matnr
where matnr = i_file-matnr
and werks = plant.
*Check return code, if no record found, write to error table and delete
if sy-subrc <> 0.
w_tabix = sy-tabix.
t_exception = i_file.
t_exception-message = text-001.
append t_exception.
delete i_file index w_tabix.
w_error = 'X'.
exit.
endif.
Start DEVK931385
if plant = c_werks_1000. "DEVK931385
*Check that the material exists in the infotype hierarchy
select single matnr from s805e into w_matnr where ssour = space
and werks = plant
and matnr = i_file-matnr.
else. "DEVK931385
*Check that the material exists in the infotype hierarchy S810e
select single matnr from s810e into w_matnr where ssour = space
and werks = plant
and matnr = i_file-matnr.
endif. "DEVK931385
End DEVK931385
if sy-subrc <> 0.
w_tabix = sy-tabix.
t_exception = i_file.
t_exception-message = text-006.
append t_exception.
delete i_file index w_tabix.
w_error = 'X'.
exit.
endif.
*Get the forcast limits from info structure
select single hiper fuper from t445p into (w_hiper, w_fuper)
where sctyp = pltyp.
*Determine start and end limits for forecasting based on current date
w_start = sy-datum - w_hiper.
Start DEVK931340
w_end = sy-datum + w_fuper. "DEL
w_end = sy-datum + ( ( w_fuper * 7 ) / 5 ).
END DEVK931340
endform. " check_material
12:33:06 PM◄&----
*& Form process_weekly
form process_weekly.
data: w_mm type bumon,
w_yyyy type bdatj.
clear: w_total.
w_date = i_file-datum.
w_mm = i_file-datum+4(2).
w_yyyy = i_file-datum(4).
*If the souce file is in monthly format
if rb_month = 'X'.
*Get the number of days in the current month
call function 'NUMBER_OF_DAYS_PER_MONTH_GET'
exporting
par_month = w_mm
par_year = w_yyyy
importing
par_days = w_days.
*Set date variable to last day in the month
w_date = i_file-datum + w_days - 1.
*Get the last working day in the month
perform get_last_day.
*Set date variable to first day
w_date = i_file-datum.
*Get the first working day in the month
perform get_first_day.
else.
*Otherwise set for days in week
w_days = 7.
endif.
do w_days times.
*Clear the table of workdates
clear: t_workdates.
*Check if the day is a working day
call function 'DATE_CHECK_WORKINGDAY'
exporting
date = w_date
factory_calendar_id = 'GB'
message_type = 'I'
exceptions
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
others = 5.
*If successful, set the workday flag to (Y)es
if sy-subrc = 0.
t_workdates-datum = w_date.
t_workdates-workday = 'Y'.
*Increment the counter for total number of workdays
add 1 to w_total.
else.
*Otherwise (N)o
t_workdates-datum = w_date.
t_workdates-workday = 'N'.
endif.
*Get the day in the week of the current date, (1 = Monday, 7 = Sunday)
call function 'DAY_IN_WEEK'
exporting
datum = w_date
importing
wotnr = t_workdates-day.
append t_workdates.
add 1 to w_date.
enddo.
loop at t_workdates.
*If the day is a workday
if t_workdates-workday = 'Y'.
*If the fromdate is blank, set to current date in loop (first working
*day)
if i_post_split-fromdat is initial.
i_post_split-fromdat = t_workdates-datum.
i_post_split-split_date = t_workdates-datum.
endif.
*Set variable to pick up last working date
i_post_split-todat = t_workdates-datum.
*Increment loop counter
add 1 to w_count.
endif.
*If the day is a Sunday
if ( ( t_workdates-day = 7 or t_workdates-datum+6(2) = w_days )
and w_count <> 0 ).
*Poplulate the post split table
if rb_month = 'X'.
i_post_split-fromdat = w_fromdat.
i_post_split-todat = w_todat.
endif.
i_post_split-matnr = i_file-matnr.
i_post_split-datum = i_file-datum.
i_post_split-value = i_file-value.
i_post_split-index = i_file-index.
i_post_split-split_value = ( ( w_value / w_total ) * w_count ).
i_post_split-flg_noscp = w_flg_noscp.
append i_post_split.
clear: w_count,
i_post_split.
endif.
endloop.
endform. " process_weekly
*& Form get_first_day
form get_first_day.
do w_days times.
call function 'DATE_CHECK_WORKINGDAY'
exporting
date = w_date
factory_calendar_id = 'GB'
message_type = 'I'
exceptions
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
others = 5.
if sy-subrc = 0.
w_fromdat = w_date.
exit.
endif.
add 1 to w_date.
enddo.
endform. " get_first_day
*& Form get_last_day
form get_last_day.
do w_days times.
call function 'DATE_CHECK_WORKINGDAY'
exporting
date = w_date
factory_calendar_id = 'GB'
message_type = 'I'
exceptions
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
others = 5.
if sy-subrc = 0.
w_todat = w_date.
exit.
endif.
subtract 1 from w_date.
enddo.
endform. " get_last_day
12:33:30 PM◄
*& Form process_daily
form process_daily.
data: w_mm type bumon,
w_yyyy type bdatj,
new_w_date like w_date.
clear: w_total.
w_mm = i_file-datum+4(2).
w_yyyy = i_file-datum(4).
w_date = i_file-datum.
if rb_month = 'X'.
*Get the number of days in the current month
call function 'NUMBER_OF_DAYS_PER_MONTH_GET'
exporting
par_month = w_mm
par_year = w_yyyy
importing
par_days = w_days.
*If the source file is in weekly format set to days in week
elseif rb_week = 'X'.
w_days = 7.
else.
*If source file is daily, set to day
w_days = 1.
endif.
do w_days times.
clear: t_workdates.
*Check the current day is a workday
call function 'DATE_CHECK_WORKINGDAY'
exporting
date = w_date
factory_calendar_id = 'GB'
message_type = 'I'
exceptions
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
others = 5.
*If successful, set workday flag to (Y)es and append workday table
if sy-subrc = 0.
t_workdates-datum = w_date.
t_workdates-workday = 'Y'.
append t_workdates.
*Increment total
add 1 to w_total.
START PKA01
else.
Add 1 to w_date and w_days to make it loop again until a the next work
day is found!!!!!
END PKA01
if rb_daily = 'X'.
new_w_date = w_date.
while new_w_date ne ''.
add 1 to new_w_date.
*Check the current day is a workday
call function 'DATE_CHECK_WORKINGDAY'
exporting
date = new_w_date
factory_calendar_id = 'GB'
message_type = 'I'
exceptions
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
others = 5.
if sy-subrc = 0.
t_workdates-datum = new_w_date.
t_workdates-workday = 'Y'.
append t_workdates.
add 1 to w_total.
exit.
endif.
endwhile.
endif.
endif.
*Increment date
add 1 to w_date.
enddo.
*Get the number of workdays in the period
describe table t_workdates lines w_lines.
*Get the first entry in the table
read table t_workdates index 1.
w_fromdat = t_workdates-datum.
*Get the last entry in the table
read table t_workdates index w_lines.
w_todat = t_workdates-datum.
loop at t_workdates.
*Populate the post split table
i_post_split-fromdat = w_fromdat.
i_post_split-todat = w_todat.
i_post_split-split_date = t_workdates-datum.
i_post_split-matnr = i_file-matnr.
i_post_split-datum = i_file-datum.
i_post_split-value = i_file-value.
i_post_split-index = i_file-index.
i_post_split-split_value = w_value / w_total.
i_post_split-flg_noscp = w_flg_noscp.
START PKA01
For daily sorce data which is split daily check that an entry doesnt
already exist in the post split table for this date - only the fromdat
is checked because for daily split fromdat = todat
read table i_post_split into w_post_split
with key matnr = i_file-matnr
fromdat = i_file-datum
split_date = t_workdates-datum.
if sy-subrc = 0.
...an entry exist so add the new value to the existing one and update
the table record
i_post_split-split_value = i_post_split-split_value +
w_post_split-split_value.
append i_post_split.
MODIFY i_post_split from w_post_split index sy-tabix.
else.
END PKA01
append i_post_split.
START PKA01
endif.
END PKA01
endloop.
endform. " process_daily
*& Form check_range
form check_range.
*If file date is not in forcast range discard
if i_file-datum < w_start or i_file-datum > w_end.
w_tabix = sy-tabix.
t_exception = i_file.
t_exception-message = text-002.
append t_exception.
delete i_file index w_tabix.
w_error = 'X'.
endif.
endform. " check_range
*& Form check_uom
form check_uom.
*Get the alternative UoM for Material
select single * from marm where matnr = i_file-matnr
and meinh = c_uom.
if sy-subrc = 0.
w_value = ( i_file-value * ( marm-umren / marm-umrez ) ).
else.
w_value = i_file-value.
w_flg_noscp = 'X'.
endif.
w_flg_noscp = 'X'. "jsa01
endform. " check_uom
*& Form check_first_day
form check_first_day.
*If the date is not the first of the month, copy to error table, delete
*and end current loop process
if i_file-datum+6(2) <> '01'.
w_tabix = sy-tabix.
t_exception = i_file.
t_exception-message = text-003.
append t_exception.
delete i_file index w_tabix.
w_error = 'X'.
endif.
endform. " check_first_day
12:34:00 PM◄&----
*& Form check_monday
form check_monday.
call function 'DAY_IN_WEEK'
exporting
datum = i_file-datum
importing
wotnr = w_day.
*If the day is not a monday, copy to error table, delete
*and end current loop process
if w_day <> 1.
w_tabix = sy-tabix.
t_exception = i_file.
t_exception-message = text-004.
append t_exception.
delete i_file index w_tabix.
w_error = 'X'.
endif.
endform. " check_monday
*& Form populate_post_split_table
form populate_post_split_table.
*Sort the uploaded table by material and date
sort i_file by matnr datum.
loop at i_file.
perform material_internal_format.
*clear loop variables
clear: w_hiper,
w_fuper,
w_count,
w_error,
w_fromdat,
w_todat,
w_flg_noscp,
t_exception.
*Clear the contents of the internal table which holds work days
refresh: t_workdates.
*If plant radiobutton is set
if rb_1000 = 'X'.
*Check the material/plant combination
perform check_material using c_werks_1000 c_pltyp_805.
else.
*Check the material/plant combination
perform check_material using c_werks_1005 c_pltyp_810.
endif.
if w_error = 'X'.
continue.
endif.
*If the uploaded file is in monthly format
if rb_month = 'X'.
*Check that the record is for the first day of the month
perform check_first_day.
if w_error = 'X'.
continue.
endif.
*Check the value is within the range for the infotype
perform check_range.
if w_error = 'X'.
continue.
endif.
*Check that an 'SCP' unit of measure exists and convert value
perform check_uom.
*Otherwise if the file is in weekly format
elseif rb_week = 'X'.
*Check that the record corresponds to a monday
perform check_monday.
if w_error = 'X'.
continue.
endif.
*Check the value is within the range for the infotype
perform check_range.
if w_error = 'X'.
continue.
endif.
*Check that an 'SCP' unit of measure exists and convert value
perform check_uom.
else.
*Check the value is within the range for the infotype
perform check_range.
if w_error = 'X'.
continue.
endif.
*Check that an 'SCP' unit of measure exists and convert value
perform check_uom.
endif.
*If split monthly flag has been chosen
if rb_spmon = 'X'.
*Process value using split monthly process
perform process_monthly.
*Otherwise, if weekly split
elseif rb_spwk = 'X'.
*Process value using split weekly process
perform process_weekly.
*Otherwise daily split
else.
*Process value using split daily process
perform process_daily.
endif.
endloop.
endform. " populate_post_split_table
*& Form build_idoc
Build and submit the idoc for processing
form post_idoc.
*Get the logical system for ALE processing
perform get_ale_data.
check not logsys is initial.
*Populate the IDOC control record
perform build_control_data.
*Sort the data by material, date and value
sort i_post_split by matnr datum value fromdat todat split_date.
*Build idocs and post them
loop at i_post_split.
clear: e1lipp0,
t_exception.
*Move i_post_split header to a work area
w_post_split = i_post_split.
at new datum.
clear: e1lipm0, e1lipv0, t_edidd.
refresh t_edidd.
*Build the general characteristic segment
perform build_e1lipm0_segment.
*Build the general version segment
perform build_e1lipv0_segment.
endat.
*Build the performance measure segment
perform build_e1lipp0_segment.
at end of datum.
*Submit IDOC for inbound processing
perform submit_idoc.
endat.
endloop.
endform. " build_idoc
12:34:22 PM◄&----
*& Form submit_idoc
Start inbound processing of IDOC
form submit_idoc.
clear: w_docnum_no_zero.
call function 'IDOC_WRITE_AND_START_INBOUND'
exporting
i_edidc = edidc
do_commit = 'X'
importing
docnum = w_docnum
tables
i_edidd = t_edidd
exceptions
idoc_not_saved = 1
others = 2.
if sy-subrc = 0.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = w_docnum
importing
output = w_docnum_no_zero.
perform check_idoc_status_records.
else.
t_exception-index = w_post_split-index.
t_exception-matnr = w_post_split-matnr.
t_exception-datum = w_post_split-datum.
t_exception-message = t_edids-statxt.
append t_exception.
w_error = 'X'.
endif.
*If the no SCP UoM flag is set, write an entry to exception table
if w_post_split-flg_noscp = 'X'.
t_exception-index = w_post_split-index.
t_exception-matnr = w_post_split-matnr.
t_exception-datum = w_post_split-datum.
t_exception-value = w_post_split-value.
t_exception-docnum = w_docnum_no_zero.
t_exception-message = text-005.
append t_exception.
endif.
endform. " write_idoc
*& Form build_control_data
*& Build the IDOC control record
form build_control_data.
clear edidc.
edidc-idoctp = 'SOPGEN01'. " Basic type
if rb_1000 = 'X'.
edidc-mestyp = c_mestyp_805. " Message type
else.
edidc-mestyp = c_mestyp_810. " Message type
endif.
edidc-rcvprt = c_rcvprt. " Partner type of receiver
concatenate 'SAP' sy-sysid(3) into edidc-rcvpor. " Receiver port
concatenate sy-sysid(3) 'CLNT' sy-mandt into edidc-rcvprn.
edidc-direct = '2'. " Inbound
concatenate 'SAP' sy-sysid(3) into edidc-sndpor.
edidc-sndprt = c_sndprt. " Partner type of sender
edidc-sndprn = c_sndprn. " Partner number of sender
endform. " get_control_data
*& Form get_ale_data
Get logical system for ALE processing
form get_ale_data.
call function 'OWN_LOGICAL_SYSTEM_GET'
importing
own_logical_system = logsys
exceptions
own_logical_system_not_defined = 1
others = 2.
if sy-subrc <> 0.
clear logsys.
endif.
endform. " get_ale_data
*& Form build_e1lipv0_segment
Create the general version segment
form build_e1lipv0_segment.
e1lipv0-vrsio = 'A00'.
e1lipv0-avrsi = 'X'.
e1lipv0-vetxt = 'Active Version'.
move e1lipv0 to t_edidd-sdata.
move 'E1LIPV0' to t_edidd-segnam.
t_edidd-hlevel = '02'.
append t_edidd.
endform. " send_idoc
*& Form build_e1lipm0_segment
form build_e1lipm0_segment.
e1lipm0-vontg = w_post_split-fromdat.
e1lipm0-bistg = w_post_split-todat.
e1lipm0-perio = '0'.
if rb_1000 = 'X'.
e1lipm0-m01 = c_werks_1000.
else.
e1lipm0-m01 = c_werks_1005.
endif.
e1lipm0-m02 = w_post_split-matnr.
e1lipm0-m03 = 'SCP'.
e1lipm0-m06 = 'T'.
move e1lipm0 to t_edidd-sdata.
move 'E1LIPM0' to t_edidd-segnam.
t_edidd-hlevel = '01'.
append t_edidd.
endform. " build_e1lipm0_segment
*& Form build_e1lipp0_segment
form build_e1lipp0_segment.
e1lipp0-sptag = w_post_split-split_date.
if rb_mgx = 'X'.
e1lipp0-kz02 = w_post_split-split_value.
e1lipp0-kz03 = '/'.
else.
e1lipp0-kz02 = '/'.
e1lipp0-kz03 = w_post_split-split_value.
endif.
move e1lipp0 to t_edidd-sdata.
move 'E1LIPP0' to t_edidd-segnam.
t_edidd-hlevel = '03'.
append t_edidd.
endform. " build_e1lipp0_segment
*& Form check_idoc_status_records
form check_idoc_status_records.
clear: t_edids.
refresh: t_edids.
select * from edids into table t_edids where docnum = w_docnum.
clear: w_error.
loop at t_edids.
clear: w_statva.
select single statva from stacust into w_statva
where status = t_edids-status.
case w_statva.
*When the status group is of type 'E' or 'F'.
when 'E' or 'F'.
t_exception-value = w_post_split-value.
t_exception-index = w_post_split-index.
t_exception-matnr = w_post_split-matnr.
t_exception-datum = w_post_split-datum.
t_exception-docnum = w_docnum_no_zero.
t_exception-message = t_edids-statxt.
append t_exception.
w_error = 'X'.
when others.
endcase.
endloop.
if w_error is initial.
add 1 to w_count_idoc_posted.
else.
add 1 to w_count_idoc_errors.
endif.
endform. " check_idoc_status_records
12:34:35 PM◄&----
*& Form rename_file
Form to rename file
form rename_file.
data: l_filename_new(120), " New filename
l_filename_temp(120), " Temporary filename
l_command(250), " Unix command line
w_extension(14).
move p_file to l_filename_new.
*Replace the file extension of the file to indicate that it has been
*processed
concatenate '.proc_' sy-datum into w_extension.
replace '.txt' with w_extension into l_filename_new.
Create UNIX rename command
concatenate 'mv' p_file l_filename_new
into l_command separated by space.
Create temporary unique file name
concatenate p_file 'TEMP'
into l_filename_temp.
move l_filename_new to p_file.
Open temporary dataset but use the filter command to execute the UNIX
rename command 'mv'.
This method has been used instead of SAP external commands because
of file length limitations. The external command only allows a line of
128 chars which means filenames can only be about 62chars when doing
a move i.e. mv <file1> <file2>
open dataset l_filename_temp for output filter l_command.
if sy-subrc ne 0.
message e005(z1) with text-007.
exit.
endif.
Close the temporary dataset
close dataset l_filename_temp.
if sy-subrc ne 0.
message e005(z1) with text-007.
exit.
endif.
Delete the temporary dataset
delete dataset l_filename_temp.
if sy-subrc ne 0.
message e005(z1) with text-007.
exit.
endif.
endform. " rename_file
*& Form material_internal_format
form material_internal_format.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = i_file-matnr
importing
output = i_file-matnr.
endform. " material_internal_format
*& Form error_report
form error_report.
format color col_normal.
skip.
*Loop at exception table and output contents
loop at t_exception.
write: / t_exception-index,
t_exception-matnr,
24 t_exception-datum,
t_exception-value right-justified,
t_exception-docnum,
t_exception-message.
endloop.hi,
define internal table. e.g. it_data & follow the steps
PARAMETERS: p_rfname LIKE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_rfname.
PERFORM get_desktop_file_help.
Form get_desktop_file_help
FORM get_desktop_file_help.
DATA : v_file LIKE rlgrap-filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'P_RFNAME'
CHANGING
file_name = v_file
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i368(00) WITH 'Enter Correct File'.
STOP.
ELSE.
MOVE : v_file TO p_rfname.
ENDIF.
ENDFORM. " get_desktop_file_help
START-OF-SELECTION.
PERFORM upload_file_from_desktop CHANGING g_error.
Form upload_file_from_desktop
FORM upload_file_from_desktop CHANGING p_error.
IF NOT sy-batch IS INITIAL.
MESSAGE e368(00) WITH 'Files can only be uploaded'
'in foreground'.
ELSE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_rfname
filetype = 'DAT'
TABLES
data_tab = it_data
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 NE 0.
MESSAGE i368(00) WITH 'Error while reading data from file'.
MOVE : 'X' TO p_error.
ENDIF.
ENDIF.
ENDFORM. "upload_file_from_desktop
raj -
Error: 'BP category 1 does not fit the data in category 2'
Hi,
i have written a program to create a contact person and the code for it is pasted below...when i run this program i get nothing but this message in the status bar 'BP category 1 does not fit the data in category 2'...can someone tell me wht the error means and y it is coming.
thanks:)
pushpa
*table for storing the line by line records in the excel file
TYPES: BEGIN OF TTAB,
REC(1000) TYPE C,
END OF TTAB.
DATA ITAB TYPE TABLE OF TTAB WITH HEADER LINE.
*variable for storing the name of the excel file to be uploaded
DATA UP_FILE TYPE STRING.
*data to be uploaded
TYPES: BEGIN OF TDAT,
FLD1 TYPE BAPIBUS1006_CENTRAL_ORGAN-NAME1,
FLD2 TYPE BAPIBUS1006_ADDRESS-STREET,
FLD3 TYPE BAPIBUS1006_ADDRESS-CITY,
FLD4 TYPE BAPIBUS1006_ADDRESS-REGION,
FLD5 TYPE BAPIBUS1006_ADDRESS-POSTL_COD1,
FLD6 TYPE BAPIBUS1006_ADDRESS-COUNTRY,
FLD7 TYPE BAPIBUS1006_CENTRAL-PARTNEREXTERNAL,
END OF TDAT.
DATA IDAT TYPE TABLE OF TDAT WITH HEADER LINE.
DATA: BUSINESSPARTNER TYPE BAPIBUS1006_HEAD-BPARTNER,
CENTRALDATA TYPE BAPIBUS1006_CENTRAL,
ORGANIZATION TYPE BAPIBUS1006_CENTRAL_ORGAN,
ADDRESS TYPE BAPIBUS1006_ADDRESS,
BAPIRETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
PARAMETERS P_FILE TYPE LOCALFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
FILE_NAME = P_FILE.
START-OF-SELECTION.
UP_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = UP_FILE
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
*writing out the contents of the internal table itab
LOOP AT ITAB.
WRITE:/ ITAB-REC.
CLEAR IDAT.
SPLIT ITAB-REC AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO IDAT-FLD1 IDAT-FLD2 IDAT-FLD3 IDAT-FLD4 IDAT-FLD5 IDAT-FLD6 IDAT-FLD7.
APPEND IDAT.
ENDLOOP.
LOOP AT IDAT.
MOVE: IDAT-FLD1 TO ORGANIZATION-NAME1,
IDAT-FLD2 TO ADDRESS-STREET,
IDAT-FLD3 TO ADDRESS-CITY,
IDAT-FLD4 TO ADDRESS-REGION,
IDAT-FLD5 TO ADDRESS-POSTL_COD1,
IDAT-FLD6 TO ADDRESS-COUNTRY,
IDAT-FLD7 TO CENTRALDATA-PARTNEREXTERNAL,
'0001' TO CENTRALDATA-PARTNERTYPE.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
PARTNERCATEGORY = '1'
CENTRALDATA = CENTRALDATA
CENTRALDATAORGANIZATION = ORGANIZATION
ADDRESSDATA = ADDRESS
IMPORTING
BUSINESSPARTNER = BUSINESSPARTNER
TABLES
RETURN = BAPIRETURN.
IF BAPIRETURN IS NOT INITIAL.
READ TABLE BAPIRETURN INDEX 1.
MESSAGE
ID BAPIRETURN-ID
TYPE BAPIRETURN-TYPE
NUMBER BAPIRETURN-NUMBER
WITH BAPIRETURN-MESSAGE_V1
BAPIRETURN-MESSAGE_V2
BAPIRETURN-MESSAGE_V3
BAPIRETURN-MESSAGE_V4.
EXIT.
ENDIF.
REFRESH BAPIRETURN.
CLEAR BAPIRETURN.
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = BUSINESSPARTNER
BUSINESSPARTNERROLE = 'BUP001'
DIFFERENTIATIONTYPEVALUE =
TABLES
RETURN = BAPIRETURN.
IF BAPIRETURN IS NOT INITIAL.
READ TABLE BAPIRETURN INDEX 1.
MESSAGE
ID BAPIRETURN-ID
TYPE BAPIRETURN-TYPE
NUMBER BAPIRETURN-NUMBER
WITH BAPIRETURN-MESSAGE_V1
BAPIRETURN-MESSAGE_V2
BAPIRETURN-MESSAGE_V3
BAPIRETURN-MESSAGE_V4.
EXIT.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE:/ 'Business Partner ID:', BUSINESSPARTNER.
ENDLOOP.Hi Pushpa,
you can use following code to create relationships using BAPI. In this Business partner is organisatin. contact persion paramenter is person. other information related to relationship details
CALL FUNCTION 'BAPI_BUPR_CONTP_CREATE'
EXPORTING
BUSINESSPARTNER = SEARCH_PARTNER
CONTACTPERSON = CONTACT_SAP
VALIDFROMDATE = '00010101'
VALIDUNTILDATE = '99991231'
DEFAULTRELATIONSHIP =
ADDRESSGUID =
CENTRALDATA = WA_CENTRAL_DATA
ADDRESSDATA = WA_ADDR_DATA
TABLES
BAPIADTEL = I_TEL_DATA
BAPIADFAX = I_FAX_DATA
BAPIADTTX =
BAPIADTLX =
BAPIADSMTP = I_EMAIL_DATA
BAPIADRML =
BAPIADX400 =
BAPIADRFC =
BAPIADPRT =
BAPIADSSF =
BAPIADURI =
BAPIADPAG =
BAPIAD_REM =
BAPICOMREM =
RETURN = I_RETURN
hope this will help you
Siva -
Unable to run BDC due to start-of-selection
Hi Experts,
I am running BDC for ROH type.
The data is in the excel file so I am performing the below operation.
In the BDC recording before perform open group there is "START-OF-SELECTION" and I also have a START-OF-SELECTION for excel uploading now how wud both would go together..
My requirement is to select the file through F4 then choose BDC type session or call transaction
and upload the data
Since I have 2 start-of-selection nothing happens after F8.
Help is really appreciated and rewarded.
Selection-screen begin of block b1 with frame title text-001.
parameter: f_name type rlgrap-filename default 'D:\Cost_element_KS06.xls'.
parameter : p_begcol type i default 1 no-display,
p_begrow type i default 2 no-display,
p_endcol type i default 8 no-display,
p_endrow type i default 46 no-display.
selection-screen end of block b1.
at selection-screen on value-request for f_name.
perform f_get_file using f_name.
start-of-selection.
perform f_xls_itab using f_name changing it_excel.
perform f_move_data.
include bdcrecx1.
start-of-selection.
perform open_group.
loop at t_ks06 to wa.
" Here I have the BDC recording recorderd through SHDB for ROH
endloop.
perform close_group.
Ranjith N.Hi Avinash,
I have made the following modification but stil the same.
report ZNRD_BDC_UPD_COSTELEMENT
no standard page heading line-size 255.
* Declaring work area and internal tables
data : begin of t_ks06 occurs 0,
KOKRS type KOKRS, " Controlling area
KSTAR type KSTAR, " Cost element
DATAB type DATAB, " Valid from date
DATBI type DATBI, " Valid to date
KTEXT type KTEXT, " Name
LTEXT type LTEXT, " Description
KATYP type KATYP, " Cost element cat
KOSTL type KOSTL, " Cost center
end of t_ks06.
data : wa like line of t_ks06.
data : it_excel type alsmex_tabline occurs 0 with header line.
*data : flg_mv(1) type n value 0. " Flag to check data Moved.
selection-screen begin of block b1 with frame title text-001.
parameter: f_name type rlgrap-filename default 'C:\Documents and Settings\Administrator\Desktop\Project_data\Cost_element_KS06.xls'.
parameter : p_begcol type i default 1 no-display,
p_begrow type i default 2 no-display,
p_endcol type i default 8 no-display,
p_endrow type i default 46 no-display.
selection-screen end of block b1.
" Iam performing all subroutines under at selection-screen and under start-of-selection Iam calling the bdc
but still nothing happens. please help
at selection-screen on value-request for f_name.
perform f_get_file using f_name.
perform f_xls_itab using f_name changing it_excel.
perform f_move_data.
*perform f_display_data.
start-of-selection.
perform open_group.
loop at t_ks06 to wa.
perform bdc_dynpro using 'SAPLKMA4' '0200'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KOKRS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'CSKBZ-KOKRS'
wa-KOKRS.
perform bdc_field using 'CSKBZ-KSTAR'
wa-KSTAR.
perform bdc_field using 'CSKBZ-DATAB_ANFO'
wa-DATAB.
perform bdc_field using 'CSKBZ-DATBI_ANFO'
wa-DATBI.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-EIGEN'.
perform bdc_field using 'CSKBZ-KTEXT'
wa-KTEXT.
perform bdc_field using 'CSKBZ-LTEXT'
wa-LTEXT.
perform bdc_field using 'CSKBZ-KATYP'
wa-KATYP.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'=VKON'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KTEXT'.
perform bdc_field using 'CSKBZ-KTEXT'
wa-KTEXT.
perform bdc_field using 'CSKBZ-LTEXT'
wa-LTEXT.
perform bdc_field using 'CSKBZ-KATYP'
wa-KATYP.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KOSTL'.
perform bdc_field using 'CSKBZ-KOSTL'
wa-KOSTL.
perform bdc_dynpro using 'SAPLKMA4' '0299'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'CSKBZ-KOSTL'.
perform bdc_field using 'CSKBZ-KOSTL'
wa-KOSTL.
perform bdc_transaction using 'KA06'.
endloop.
perform close_group.
include bdcrecx1.
*& Form f_get_file
* text
* -->P_FILE_NAM text
form f_get_file using p_file_nam.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
* FIELD_NAME = ' '
* STATIC = ' '
* MASK = ' '
changing
file_name = f_name
exceptions
mask_too_long = 1
others = 2.
endform. " f_get_file
*& Form f_xls_itab
* text
* -->P_FILE_NAM text
* <--P_IT_EXCEL text
form f_xls_itab using p_file_nam changing p_it_excel.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = f_name
i_begin_col = p_begcol
i_begin_row = p_begrow
i_end_col = p_endcol
i_end_row = p_endrow
tables
intern = it_excel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
endform. " f_xls_itab
*& Form f_move_data
* text
* --> p1 text
* <-- p2 text
form f_move_data.
data : lv_index type i.
field-symbols <fs>.
* Sorting the internal table
sort it_excel by row col.
clear it_excel.
loop at it_excel.
move it_excel-col to lv_index.
* Assigning each record to the internal table row.
assign component lv_index of structure wa to <fs>.
* Assigning the field value to a field symbol
move it_excel-value to <fs>.
at end of row.
append wa to t_ks06.
* flg_mv = 1.
clear wa.
endat.
endloop.
endform. " f_move_data
*& Form f_display_data
* text
* --> p1 text
* <-- p2 text
form f_display_data.
write:/1 sy-uline(140).
write:/1 sy-vline, 'Cont area', " Controlling area
16 sy-vline, 'Cost ele', " Cost element
31 sy-vline, 'Valid from', " Valid from date
46 sy-vline, 'Valid to ' , " Valid to date
61 sy-vline, 'Name', "Cost element cat
76 sy-vline, 'Description', " Cost center
101 sy-vline, 'Cost ele cat', " Cost element cat
126 sy-vline, 'Cost center', " Cost center
140 sy-vline.
write:/1 sy-uline(140).
skip 1.
clear wa.
loop at t_ks06 into wa.
write:/2 sy-uline(139).
write:/2 sy-vline, wa-KOKRS, " Controlling area
16 sy-vline, wa-KSTAR, " Cost element
31 sy-vline, wa-DATAB, " Valid from date
46 sy-vline, wa-DATBI, " Valid to date
61 sy-vline, wa-KTEXT, " Name
76 sy-vline, wa-LTEXT, " Description
101 sy-vline, wa-KATYP, " Cost element cat
120 sy-vline, wa-KOSTL, " Cost center
140 sy-vline.
endloop.
endform. " f_display_data
Regards,
Ranjith -
Regarding upload from excel to alv.
Hi
here is my code:
TABLES
TABLES: ioheader, " IOC Communication structure
ioitem, " IOC Communication structure
klah, " Class and Class type
ksml, " Characteristic Keys for Class and Type
cabn, " Characteristics
cabnt, " Characteristic Descriptions
vbap, " SAles details
sscrfields.
Includes
INCLUDE rvreuse_global_data. " ALV Types etc
DATA - INTERNAL TABLES AND FIELD LISTS
Types
TYPE-POOLS: ibco2. " Characteristic types
DATA - CONSTANTS
CONSTANTS: c_true(1) TYPE c VALUE 'X',
c_false(1) TYPE c VALUE ' ',
c_zioheader TYPE dd02l-tabname VALUE 'ZIOHEADER',
c_command TYPE slis_formname VALUE 'USER_COMMAND',
c_backhoe(7) TYPE c VALUE 'BACKHOE',
c_300(3) TYPE c VALUE '300',
c_no_data(7) TYPE c VALUE 'No Data',
c_save(1) TYPE c VALUE 'A'.
Internal Tables
Main IO Table
DATA: i_header LIKE zioheader OCCURS 0 WITH HEADER LINE.
Characteristic Values
DATA: i_config TYPE ibco2_instance_tab2.
Characteristics Keys
DATA: BEGIN OF i_imerk OCCURS 0,
imerk LIKE ksml-imerk,
END OF i_imerk.
ALV Grid Control
DATA: i_grid TYPE sd_alv.
Catalogues
DATA: wa_cat LIKE LINE OF i_grid-fieldcat.
Structures
Structure for layout variant
DATA: s_variant LIKE disvariant.
DATA : filename TYPE string.
DATA - WORKING VARIABLES
DATA - FIELD GROUPS
*field-groups:
SELECTION SCREEN
Variant control
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t02.
PARAMETERS: p_var LIKE disvariant-variant.
SELECTION-SCREEN END OF BLOCK b1.
Printer Control
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS: rad1 RADIOBUTTON GROUP rad USER-COMMAND radio,
rad2 RADIOBUTTON GROUP rad,
rad3 RADIOBUTTON GROUP rad.
PARAMETER p_floc(128) DEFAULT '/usr/tmp/testfile.dat'
LOWER CASE.
SELECTION-SCREEN END OF BLOCK b3.
MAIN PROGRAM *************************
INITIALIZATION.
PERFORM initialise. " Set up program defaults
move 'Report Only' to rad1.
move 'Export Sequence List' to s_but2.
move 'Import Sequence List' to S_but3.
Selection Screen Options
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
PERFORM get_variant CHANGING p_var. " ALV Layout
DATA : l_no_of_lines TYPE i,
la_matnr LIKE s_matnr.
DESCRIBE TABLE s_matnr LINES l_no_of_lines.
IF l_no_of_lines > 1.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
READ TABLE s_matnr INTO la_matnr WITH KEY sign = 'I'
option = 'EQ'.
IF sy-subrc NE 0.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
AT SELECTION-SCREEN.
DATA : l_no_of_lines TYPE i,
la_matnr LIKE s_matnr.
DESCRIBE TABLE s_matnr LINES l_no_of_lines.
IF l_no_of_lines > 1.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
READ TABLE s_matnr INTO la_matnr WITH KEY sign = 'I'
option = 'EQ'.
IF sy-subrc NE 0.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_floc.
data : pname type syst-repid.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = pname
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FLOC'
STATIC = ' '
MASK = ' '
CHANGING
FILE_NAME = p_floc
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
START-OF-SELECTION.
PERFORM set_catalogue. " Set up basic headings from Itab
PERFORM get_char_keys. " Get the characteristic keys
PERFORM modify_catalogue_key. " Amend headings for char keys
IOC Logical Database Event
GET ioheader.
PERFORM get_subsequent_data. " Retrieve additional data
END-OF-SELECTION.
PERFORM modify_catalogue_title. " Place correct titles for AVL
PERFORM alv_display. " Display in ALV Grid
if rad1 = 'X' .
PERFORM modify_catalogue_title. " Place correct titles for AVL
PERFORM alv_display. " Display in ALV Grid
elseif rad2 = 'X' .
*if p_floc is initial .
MESSAGE e000(z1) WITH
' Enter the file location'.
*else.
PERFORM download. " Export sequence list to excel
PERFORM modify_catalogue_title. " Place correct titles for AVL
PERFORM alv_display. " Display in ALV Grid
*endif.
elseif rad3 = 'X' .
if p_floc is initial .
MESSAGE e000(z1) WITH
' Enter the file location'.
else .
PERFORM upload.
endif.
endif.
*AT SELECTION-SCREEN OUTPUT.
*TOP-OF-PAGE.
*END-OF-PAGE.
*AT USER-COMMAND.
perform PF_STATUS_SET.
SUBROUTINES *******************************
FORM get_variant *
Retrieve ALV display variant *
--> X_VAR Variant *
FORM get_variant CHANGING x_var.
PERFORM f4_alv_layout(ppio_entry) USING i_grid-program
CHANGING x_var.
ENDFORM.
FORM get_subsequent_data *
Retrieve additional data and place into I_HEADER Itab *
FORM get_subsequent_data.
Prime extended table
i_header = ioheader.
PERFORM get_serial_number. " Get Sales Order Serial No
PERFORM get_char_values. " Get Characteristic Values
PERFORM build_char_entries." Put Char Values into I_HEADER
Add to extended table
APPEND i_header.
ENDFORM.
FORM get_serial_number *
Retrieve the serial number *
FORM get_serial_number.
SELECT SINGLE zuonr submi
INTO (i_header-zuonr,i_header-submi)
FROM vbak
WHERE vbeln EQ i_header-kdauf_aufk.
ENDFORM.
FORM get_char_values *
Retrieve the characteristic values for the production order *
FORM get_char_values.
Get Ready
REFRESH i_config.
Get Object key
SELECT SINGLE cuobj
FROM vbap
INTO vbap-cuobj
WHERE vbeln EQ i_header-kdauf_aufk
AND matnr EQ i_header-plnbez.
Get characteristic config values
CALL FUNCTION 'CUCB_GET_CONFIGURATION'
EXPORTING
instance = vbap-cuobj
IMPORTING
configuration = i_config
EXCEPTIONS
invalid_input = 1
invalid_instance = 2
instance_is_a_classification = 3
OTHERS = 4.
Not found, no config values will be pulled through
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
FORM build_char_entries *
For each character value. Find the relevent "slot" in the *
table by checking the characteristic key against the catalogue*
stored key
FORM build_char_entries.
DATA: la_config LIKE LINE OF i_config, " i_config header line
li_values TYPE ibvalue0 OCCURS 0, " Charact'ic Values Itab
la_values LIKE LINE OF li_values, " li_values header line
l_atwrt LIKE la_values-atwrt, " Characteristic Value
l_atinn LIKE la_values-atinn, " Characteristic Key
l_key(20), " Working built key
l_entry(20), " FieldName to be updated
l_len LIKE sy-tabix, " Length of string
l_tabix LIKE sy-tabix. " Index position of Itab
FIELD-SYMBOLS: <f_field>. " This will be the field to update
Loop on characteristics
LOOP AT i_config INTO la_config.
Extract the characteristic values imbedded table
MOVE la_config-values TO li_values.
Loop on the characteristics values
LOOP AT li_values INTO la_values.
We now have the charecteristic key la_values-atinn
and the value in la_values-atwrt. However, there may be
Multiple values for key la_values-atinn
So if they are the same append to one long string.
Is it a new value
IF la_values-atinn EQ l_atinn.
CONCATENATE l_atwrt '|' la_values-atwrt INTO l_atwrt.
CONTINUE.
ENDIF.
New Value (and not first pass) so save built values
IF NOT l_atinn IS INITIAL.
Find the correct field to place the value in.
This is done by finding the Itab field description in the AVL display
field Catalogue called "No Data|nnnnnn" where nnnn is the
characteristic Key
Build the key
CONCATENATE c_no_data '|' l_atinn INTO l_key.
Loop till we find it. This gives us the field name
LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l = l_key.
Set up the field name to be amended
CONCATENATE wa_cat-tabname '-' wa_cat-fieldname INTO l_entry.
ASSIGN (l_entry) TO <f_field>.
Update field with the Char value
MOVE l_atwrt TO <f_field>.
No need to continue this loop
EXIT.
ENDLOOP.
ENDIF.
Prime for next value
l_atinn = la_values-atinn.
l_atwrt = la_values-atwrt.
ENDLOOP.
ENDLOOP.
ENDFORM.
FORM alv_display *
Display data in ALV grid *
FORM alv_display.
Set up Variant
i_grid-variant-variant = p_var. " Variant
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = i_grid-program
I_CALLBACK_PF_STATUS_SET = i_grid-pf_status_set
i_callback_user_command = i_grid-user_command
i_structure_name = i_grid-structure
is_layout = i_grid-layout
it_fieldcat = i_grid-fieldcat
IT_EXCLUDING = i_grid-excluding
IT_SPECIAL_GROUPS = i_grid-special_groups
IT_SORT = i_grid-sort
IT_FILTER = i_grid-filter
IS_SEL_HIDE = i_grid-sel_hide
I_DEFAULT = i_grid-default
i_save = I_grid-save
is_variant = i_grid-variant
IT_EVENTS = i_grid-events
IT_EVENT_EXIT = i_grid-event_exit
IS_PRINT = i_grid-print
IS_REPREP_ID =
I_SCREEN_START_COLUMN = i_grid-start_column
I_SCREEN_START_LINE = i_grid-start_line
I_SCREEN_END_COLUMN = i_grid-end_column
I_SCREEN_END_LINE = i_grid-end_line
IMPORTING
E_EXIT_CAUSED_BY_CALLER = i_grid-exit
ES_EXIT_CAUSED_BY_USER = i_grid-user_exit
TABLES
t_outtab = i_header
EXCEPTIONS
program_error = 1
OTHERS = 2.
ALV Failed.
IF sy-subrc <> 0.
WRITE: / 'Failed with',sy-subrc.
ENDIF.
ENDFORM.
FORM initialise *
Set up basic report details *
FORM initialise.
ALV controls
i_grid-program = sy-repid. " Program Name
i_grid-user_command = c_command. " ALV user FORM
i_grid-save = c_save. " Save Options
ALV Variant Details for saved report layouts
i_grid-variant-report = i_grid-program.
i_grid-variant-username = sy-uname.
ENDFORM.
FORM user_command *
Routine called by ALV *
--> X_UCOMM Function selected *
--> X_SELFIELD Selection field Itab *
FORM user_command USING x_ucomm LIKE sy-ucomm
x_selfield TYPE slis_selfield.
DATA: l_answer(1). " Answer returned from popup box
Only allow drill down on Order number
CHECK x_selfield-fieldname = 'AUFNR'.
Get option for display or modify
CALL FUNCTION 'POPUP_TO_DECIDE'
EXPORTING
textline1 = 'Please Choose'
text_option1 = 'Display'
text_option2 = 'Modify'
titel = 'Production Order'
IMPORTING
answer = l_answer.
Did they cancel
CHECK l_answer NE 'A'.
Set up parameters.
SET PARAMETER ID 'ANR' FIELD x_selfield-value.
Display
IF l_answer = '1'.
CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.
Modify
ELSEIF l_answer = '2'.
CALL TRANSACTION 'CO02' AND SKIP FIRST SCREEN.
ENDIF.
*IF rad2 = 'X'.
If sy-ucomm ='%PC'.
IF sy-subrc <> 0.
WRITE: / 'Failed with',sy-subrc.
else.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = 'File Transfer Status'
TXT1 = 'File transfered to location:'
TXT2 = filename
TXT3 = ' '
TXT4 = ' '
ENDIF.
endif.
ENDFORM.
FORM set_catalogue *
Retrieve the title and field information from the *
Data Dictionary. This will then be amended to the correct *
Characteristic titles during the end-of-selection event *
FORM set_catalogue.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_grid-program
i_internal_tabname = 'I_HEADER'
i_structure_name = c_zioheader
i_client_never_display = 'X'
CHANGING
ct_fieldcat = i_grid-fieldcat.
ENDFORM.
FORM get_char_keys *
Retrieve the list of characteristic keys *
template of BACKHOE class 300 *
FORM get_char_keys.
DATA : la_inob TYPE inob.
SELECT SINGLE * FROM inob INTO la_inob
WHERE objek = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE e000(z1) WITH
' Could not get INOB table for ' s_matnr-low.
ENDIF.
Get Major Object key
SELECT SINGLE clint
FROM klah
INTO klah-clint
WHERE klart = la_inob-klart
AND class = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE e001(z296) WITH c_backhoe c_300.
ENDIF.
Use Major key to retrieve Characteristics keys
This is the template for the headings
SELECT imerk
FROM ksml
INTO TABLE i_imerk
WHERE clint EQ klah-clint " Objct Key
AND lkenz EQ space " Delete Indicator
AND datuv LE sy-datum. " Validity to
IF sy-subrc NE 0.
MESSAGE e002(z296) WITH klah-clint.
ENDIF.
ENDFORM.
FORM modify_catalogue_key *
Change the default "No Data" titles with the characteristic *
key values in the form "No Data|nnnnnnn" where nnnnnn is *
the characteristic key. This is used as a method of allocating*
characteristic values to the I_HEADER Itab positions *
CHAR_001 to CHAR_100 *
FORM modify_catalogue_key.
DATA: l_index LIKE sy-tabix, " Table Index for Read
l_tabix LIKE sy-tabix, " Table Index Position
l_seltext_l LIKE dd03p-scrtext_l. " Heading Text
Get into Key Sequence
SORT i_imerk.
Loop on catalogue for dummy titles
LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l(7) = c_no_data.
l_tabix = sy-tabix.
Get the next characteristic
l_index = l_index + 1.
READ TABLE i_imerk INDEX l_index.
No Characteristic, No display
IF sy-subrc NE 0.
wa_cat-no_out = c_true.
wa_cat-tech = c_true.
MODIFY i_grid-fieldcat FROM wa_cat INDEX l_tabix.
CONTINUE.
ENDIF.
Place the char key against the "No Data" title
so that later we know what values to place against the keys
the title will become "No Data:nnnnnnnnnn" (nnn = Key)
CONCATENATE c_no_data '|' i_imerk-imerk INTO wa_cat-seltext_l.
MODIFY i_grid-fieldcat FROM wa_cat INDEX l_tabix.
ENDLOOP.
ENDFORM.
FORM modify_catalogue_title *
At this stage the catalogue titles for the characteristics *
are in the form "No Data|nnnnn" Where nnnn is the *
characteristic key. Using the Key, replace this text with *
the real characteristic title
FORM modify_catalogue_title.
DATA: l_key(20), " Characteristic Key in Alpha form
l_len LIKE sy-tabix. " Length of string
Loop on the characteristic keys
LOOP AT i_imerk.
Get the real title
SELECT SINGLE atbez
FROM cabnt
INTO cabnt-atbez
WHERE atinn EQ i_imerk-imerk.
Not found, leave alone
CHECK sy-subrc EQ 0.
Place key into char form for comparison in loop
l_key = i_imerk-imerk.
Now loop on the catalogue to get the key
LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l+8 = l_key.
Place the title into the catalogue
wa_cat-seltext_l = cabnt-atbez.
wa_cat-seltext_m = cabnt-atbez.
wa_cat-seltext_s = cabnt-atbez.
wa_cat-reptext_ddic = cabnt-atbez.
And update
MODIFY i_grid-fieldcat FROM wa_cat.
ENDLOOP.
ENDLOOP.
IF rad2 = 'X'.
LOOP AT i_grid-fieldcat INTO wa_cat.
*IF wa_cat-fieldname = 'AUFNR'.
*wa_cat-col_pos = '10'.
*endif.
case wa_cat-fieldname.
when 'AUFNR'.
wa_cat-fix_column = 'X'.
when 'CY_SEQNR'.
wa_cat-fix_column = 'X'.
when 'ZOUNR'.
wa_cat-fix_column = 'X'.
when 'GLTRP'.
wa_cat-fix_column = 'X'.
when 'SUBMI'.
wa_cat-fix_column = 'X'.
endcase.
modify i_grid-fieldcat FROM wa_cat.
endloop.
endif.
ENDFORM.
*SELECT z099seqno z099heading
INTO table i_header
FROM z099 join z100 ON
z099seqno = z100seqno WHERE
z100~product = s_matnr.
*& Form download
Download file to excel
*FORM download.
*filename = p_floc .
*CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = filename
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = ','
HEADER = 'l_seltext_l'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = i_header
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
WRITE: / 'Failed with',sy-subrc.
else.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = 'File Transfer Status'
TXT1 = 'File transfered to location:'
TXT2 = filename
TXT3 = ' '
TXT4 = ' '
ENDIF.
*ENDFORM. " download
*& Form upload
text
--> p1 text
<-- p2 text
FORM upload.
*DATA : i_upload TYPE STANDARD TABLE OF alsmex_tabline.
**data : i_upload like zioheader occurs 0 with header line.
data file like RLGRAP-FILENAME.
file = p_floc .
DATA: BEGIN OF i_upload OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF i_upload.
DATA: BEGIN OF i_upload1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF i_upload1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
DATA: tind(4) TYPE n.
FIELD-SYMBOLS: <fs1>.
DATA: zwfeld(19).
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = file
I_BEGIN_COL = '1'
I_BEGIN_ROW = '1'
I_END_COL = '200'
I_END_ROW = '6500'
TABLES
INTERN = i_upload.
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
LOOP AT i_upload.
i_upload1 = i_upload.
CLEAR i_upload1-row.
APPEND i_upload1.
ENDLOOP.
SORT i_upload1 BY col.
LOOP AT i_upload1.
AT NEW col.
t_col-col = i_upload1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( i_upload1-value ).
READ TABLE t_col WITH KEY col = i_upload1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT i_upload BY row col.
IF kzheader = 'X'.
LOOP AT i_upload.
fieldnames-title = i_upload-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT i_upload BY row col.
LOOP AT i_upload.
IF kzheader = 'X'
i_upload-row = 1.
CONTINUE.
ENDIF.
tind = i_upload-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = i_upload-value.
AT END OF row.
APPEND i_upload.
CLEAR i_upload.
ENDAT.
ENDLOOP.
if sy-subrc = 0.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = i_grid-program
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = i_grid-fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = i_save
IS_VARIANT = i_grid-variant
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_upload.
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
when i execute the program i am getting a short dump
GETWA_NOT_ASSIGNED
what might be the problem.
this is a very urgent question.
pls suggest me the clear way to over come this problem.HI
use this code for uploading the excel file to internal table....
data: begin of itab_string occurs 0,
record type char255,
end of itab_string.
data: L_FILETABLE TYPE FILETABLE,
L_FILETAB_H TYPE FILETABLE WITH HEADER LINE.
data: p_file1 type string.
selection screen .
PARAMETERS: P_FILE TYPE LOCALFILE.
initialization.
at selection-screen on value-request for P_FILE.
IF THE USER SELECT EXTENTION BUTTON IT WILL OPEN THE LOCAL DIRECTORY FOR SELECTING THE FILE LOCATION.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION = 'CSV'
DEFAULT_FILENAME = 'C:\Documents and Settings\196093\Desktop\STATUS.csv'
FILE_FILTER =
INITIAL_DIRECTORY = 'C:\Documents and Settings\196093\Desktop\'
MULTISELECTION =
WITH_ENCODING =
CHANGING
FILE_TABLE = L_FILETABLE
RC = RC
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
IF SY-SUBRC <> 0.
ELSE.
LOOP AT l_filetable INTO L_FILETAB_H.
P_FILE = L_FILETAB_H-FILENAME.
move p_file to p_file1.
EXIT.
ENDLOOP.
ENDIF.
passing the selected file name to gui_upload for loading the data
into internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = p_file1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = itab_string
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'PLEASE PROVIDE CORRECT FILE NAME'.
ENDIF.
reward points to all helpful answers
kiran.M -
Call transaction error handling
how to maintain the log i.e sucess/failures like below.
Line No. Success/ Failure Document No Error Details
1 S Doc 740000001
2 S Doc 740000002
3 F Co- code does not exist
4 F GL Account does not exist
I'm getting only one last document no: but i need all the documents to be displayed i.e either success/failures.
below is my code.
TYPES: BEGIN OF ty_filedata,
bukrs TYPE bukrs, "Company code
blart TYPE blart, "Document type
bldat TYPE char10, "Document Date
budat TYPE char10, "Posting date
xblnr TYPE xblnr, "Reference
bktxt TYPE bktxt, "Document Header text
waers TYPE waers, "Currency
newbs TYPE bschl, "Posting Key for the next line item
wrbtr TYPE char10, "Amount
zuonr LIKE bsik-zuonr, "Assignment
sgtxt TYPE sgtxt, "Text
newko TYPE hkont, "Account for the next line item
END OF ty_filedata.
TYPES: BEGIN OF ty_detail_log,
item_no TYPE i, " Item line no.
status(1) TYPE c, " Status - success/failure
doc_no TYPE bkpf-belnr," Document No.
message TYPE string, " Message
END OF ty_detail_log.
*& DATA declaration of internal tables
Internal Table declaration for excel data
DATA: it_itab TYPE STANDARD TABLE OF alsmex_tabline INITIAL SIZE 0,
Internal Table declaration for upload data
it_upload TYPE STANDARD TABLE OF ty_filedata INITIAL SIZE 0,
Internal Table Declaration for BDCDATA
it_bdcdata TYPE STANDARD TABLE OF bdcdata,
Internal Table Declaration for BDCMSGCOLL
it_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll,
Internal Table Declaration for FILENMAE
lf_fname TYPE rlgrap-filename.
t_err_log TYPE STANDARD TABLE OF ty_err
INITIAL SIZE 0, " table for validation error log
t_DETAIL_LOG TYPE STANDARD TABLE OF TY_DETAIL_LOG.
C_MSGNO TYPE BDC_MNR VALUE '312',
*& DATA declaration of work area
Work Area declaration for Excel Data
DATA: w_itab TYPE alsmex_tabline,
Work Area declaration for upload data
w_upload TYPE ty_filedata,
Work Area declaration for upload data
w_upload_n TYPE ty_filedata,
Work Area declaration for upload data
w_bdcdata TYPE bdcdata,
Work Area declaration for upload data
w_bdcmsgcoll TYPE bdcmsgcoll,
w_detail_log TYPE ty_detail_log.
*& SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
PARAMETERS:p_file TYPE rlgrap-filename. " MODIF ID G1.
SELECTION-SCREEN: END OF BLOCK bk1.
*& AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
dynpro_number = syst-dynnr
CHANGING
file_name = p_file
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*& START-OF-SELECTION
START-OF-SELECTION.
DATA: lw_itab TYPE alsmex_tabline.
lf_fname = p_file.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = lf_fname
i_begin_col = '1'
i_begin_row = '6'
i_end_col = '12'
i_end_row = '999'
TABLES
intern = it_itab[]
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
*MESSAGE S205(ZF_COMMON_MSGS_FIN1) DISPLAY LIKE C_E.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
IF it_itab IS NOT INITIAL.
SORT it_itab BY row col.
DELETE it_itab WHERE row LT 6.
LOOP AT it_itab INTO lw_itab.
w_itab = lw_itab.
AT NEW row.
CLEAR: w_upload.
ENDAT.
CASE w_itab-col.
WHEN '0001'.
w_upload-bukrs = w_itab-value.
WHEN '0002'.
w_upload-blart = w_itab-value.
WHEN '0003'.
w_upload-bldat = w_itab-value.
WHEN '0004'.
w_upload-budat = w_itab-value.
WHEN '0005'.
w_upload-xblnr = w_itab-value.
WHEN '0006'.
w_upload-bktxt = w_itab-value.
WHEN '0007'.
w_upload-waers = w_itab-value.
WHEN '0008'.
w_upload-newbs = w_itab-value.
WHEN '0009'.
w_upload-wrbtr = w_itab-value.
WHEN '0010'..
w_upload-zuonr = w_itab-value.
WHEN '0011'.
w_upload-sgtxt = w_itab-value.
WHEN '0012'.
w_upload-newko = w_itab-value.
ENDCASE.
AT END OF row.
APPEND w_upload TO it_upload.
CLEAR: w_upload.
ENDAT.
ENDLOOP.
*endif.
ENDIF.
DATA: lw_upload TYPE ty_filedata,
lv_lines TYPE sy-tabix,
lv_index TYPE sy-tabix.
DESCRIBE TABLE it_upload LINES lv_lines.
LOOP AT it_upload INTO lw_upload.
lv_index = sy-tabix.
w_upload = lw_upload.
IF NOT w_upload-bukrs IS INITIAL.
IF lv_index GT 1.
CALL TRANSACTION 'FB01' USING it_bdcdata
MODE 'N' UPDATE 'S' MESSAGES INTO it_bdcmsgcoll.
PERFORM fr_format_message_text.
REFRESH: it_bdcdata.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMF05A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BKPF-XBLNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BKPF-BLDAT'
w_upload-bldat.
PERFORM bdc_field USING 'BKPF-BLART'
w_upload-blart.
PERFORM bdc_field USING 'BKPF-BUKRS'
w_upload-bukrs.
PERFORM bdc_field USING 'BKPF-BUDAT'
w_upload-budat.
PERFORM bdc_field USING 'BKPF-WAERS'
w_upload-waers.
PERFORM bdc_field USING 'BKPF-XBLNR'
w_upload-xblnr.
*perform bdc_field using 'FS006-DOCID'
PERFORM bdc_field USING 'RF05A-NEWBS'
w_upload-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
w_upload-newko.
ENDIF.
IF lv_index NE lv_lines.
lv_index = lv_index + 1.
READ TABLE it_upload INTO w_upload_n INDEX lv_index.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-WRBTR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
w_upload-wrbtr.
PERFORM bdc_field USING 'RF05A-NEWBS'
w_upload_n-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
w_upload_n-newko.
ELSE.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-WRBTR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING 'BSEG-WRBTR'
w_upload-wrbtr.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-ANLN1'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDLOOP.
CALL TRANSACTION 'FB01' USING it_bdcdata
MODE 'N' UPDATE 'S' MESSAGES INTO it_bdcmsgcoll.
PERFORM fr_format_message_text .
REFRESH: it_bdcdata.
*& Form BDC_DYNPRO
FORM bdc_dynpro USING program dynpro.
CLEAR w_bdcdata.
w_bdcdata-program = program.
w_bdcdata-dynpro = dynpro.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO it_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF fval <> space.
CLEAR w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
APPEND w_bdcdata TO it_bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form fr_format_message_text
FORM fr_format_message_text.
DATA: lf_msg TYPE string.
WRITE:/ sy-uline(125).
FORMAT COLOR 1 INTENSIFIED ON.
WRITE : /1 sy-vline,
2 text-041 , "'record Number',
16 sy-vline,
17 text-042 , " 'success/failure',
35 sy-vline,
36 text-043, " 'document no',
55 sy-vline,
56 text-044, "'Error details',
125 sy-vline.
WRITE:/ sy-uline(125).
LOOP AT it_bdcmsgcoll INTO w_bdcmsgcoll.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = w_bdcmsgcoll-msgid
lang = sy-langu
no = w_bdcmsgcoll-msgnr
v1 = w_bdcmsgcoll-msgv1
v2 = w_bdcmsgcoll-msgv2
v3 = w_bdcmsgcoll-msgv3
v4 = w_bdcmsgcoll-msgv4
IMPORTING
msg = lf_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc EQ 0.
WRITE:/01 sy-vline,
02 sy-tabix,
16 sy-vline,
17 w_bdcmsgcoll-msgtyp,
35 sy-vline,
36 w_bdcmsgcoll-msgv1,
55 sy-vline,
56 lf_msg,
125 sy-vline.
WRITE:/ sy-uline(125).
ENDIF.
ENDLOOP.
ENDFORM. "fr_format_message_text
Thanks in advance.Hi Neelima,
Just put the following code within that LOOP...ENDLOOP statement.
LOOP AT it_upload INTO lw_upload.
CALL TRANSACTION 'FB01' USING it_bdcdata
MODE 'N' UPDATE 'S' MESSAGES INTO it_bdcmsgcoll.
PERFORM fr_format_message_text .
REFRESH: it_bdcdata.
ENDLOOP.
Regards,
R.Nagarajan.
We can - -
when i run my program for electronic bank statement i am getting an error when posting. the error requires me to populate the business area field and i have no idea on were i can populate the business area field. please help.
below is the source code of bank statement program
Report zum Einlesen und Verarbeiten des Elektronischen *
Kontoauszugs *
Erzeugung von Testdateien mit RFEBKAt0 und RFEBKAt1 *
051198ak reorganized export of print / archive parameters to *
insure correct setup for all modes (online/batch/print&exec)*
changed variable names in EXPORT statement to insure correct*
functioning of IMPORT statement *
mo271101 included changes for Web GUI compatibility (section 508) *
mo260105 included MT942 handling (setting dunning blocks *
REPORT RFEBKA00 MESSAGE-ID FB
LINE-SIZE 132
NO STANDARD PAGE HEADING.
Include Common Data *
INCLUDE ZFEBKA03.
*INCLUDE RFEBKA03.
INCLUDE ZFEBFR03.
*INCLUDE RFEBFR03. " Data France
TABLES: RFSDO,
SSCRFIELDS.
data: lt_statements type standard table of fieb_kukey,
l_statement type fieb_kukey.
*Daten fu00FCr die Mahnsperre "mo260105
TYPES: BEGIN OF S_KUKEY_MANSP,
SIGN(1),
OPTION(2),
LOW TYPE KUKEY_EB,
HIGH TYPE KUKEY_EB,
MANSP TYPE MANSP,
ANZTG TYPE ANZTG,
BUKRS TYPE BUKRS,
END OF S_KUKEY_MANSP.
DATA: LT_KUKEY TYPE STANDARD TABLE OF S_KUKEY_MANSP,
L_KUKEY LIKE LINE OF LT_KUKEY,
L_GJAHR TYPE GJAHR,
L_MANSP TYPE MANSP,
L_KUNNR TYPE KUNNR,
L_LIFNR TYPE LIFNR.
FIELD-SYMBOLS: <MANSP> LIKE LINE OF GT_MANSP.
*Ende der Daten fu00FCr die Mahnsperre "mo260105
C5053392 Code Begins
Parameters *
*------- Dateiangaben -
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-165.
PARAMETERS: EINLESEN LIKE RFPDO1-FEBEINLES,
FORMAT LIKE RFPDO1-FEBFORMAT DEFAULT 'M',
FILE LIKE RFPDO1-FEBAUSZF default
'c:\TESTEBS2.txt',
STMTNO(5),
AUSZFILE LIKE RFPDO1-FEBAUSZF default
'c:\bank\auszug.txt',
UMSFILE LIKE RFPDO1-FEBUMSF default
'c:\bank\umsatz.txt',
UMSFILE LIKE RFPDO1-FEBUMSF,
PCUPLOAD LIKE RFPDO1-FEBPCUPLD DEFAULT 'X'.
data : file1 type string.
*PARAMETERS: INTRADAY TYPE C DEFAULT SPACE NO-DISPLAY.
*PARAMETERS: INTRADAY TYPE C AS CHECKBOX DEFAULT SPACE.
SELECTION-SCREEN END OF BLOCK 1.
*------- Buchungsparameter -
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-160.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: PA_XCALL LIKE FEBPDO-XCALL RADIOBUTTON GROUP 1.
SELECTION-SCREEN
COMMENT 03(29) TEXT-161 FOR FIELD PA_XCALL.
PARAMETERS: PA_XBKBU LIKE FEBPDO-XBKBU.
SELECTION-SCREEN
COMMENT 35(16) TEXT-171 FOR FIELD PA_XBKBU.
PARAMETERS: PA_MODE LIKE RFPDO-ALLGAZMD NO-DISPLAY.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: PA_XBDC LIKE FEBPDO-XBINPT RADIOBUTTON GROUP 1.
SELECTION-SCREEN
COMMENT 03(29) TEXT-163 FOR FIELD PA_XBDC.
SELECTION-SCREEN
COMMENT 35(15) TEXT-164 FOR FIELD MREGEL.
PARAMETERS: MREGEL LIKE RFPDO1-FEBMREGEL DEFAULT '1'.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: PA_TEST LIKE RFPDO1-FEBTESTL RADIOBUTTON GROUP 1.
SELECTION-SCREEN
COMMENT 03(29) TEXT-168 FOR FIELD PA_TEST.
SELECTION-SCREEN: END OF LINE.
PARAMETERS: VALUT_ON LIKE RFPDO2-FEBVALUT DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK 2.
*------- Finanzdisposition -
SELECTION-SCREEN BEGIN OF BLOCK 5 WITH FRAME TITLE TEXT-172.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: PA_XDISP LIKE FEBPDO-XDISP.
SELECTION-SCREEN
COMMENT 03(29) TEXT-170 FOR FIELD PA_XDISP.
PARAMETERS: PA_VERD LIKE RFFFPDO1-FFDISXVERD.
SELECTION-SCREEN
COMMENT 34(15) TEXT-174 FOR FIELD PA_VERD.
SELECTION-SCREEN
COMMENT 55(15) TEXT-173 FOR FIELD PA_DSART.
PARAMETERS: PA_DSART LIKE FDES-DSART.
SELECTION-SCREEN: END OF LINE.
PARAMETERS: INTRADAY LIKE RFPDO1_EN-AKINTRADAY AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK 5.
*------- Interpretationsparameter -
SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE TEXT-166.
DATA: NUM10(10) TYPE N.
DATA: CHR16(16) TYPE C.
SELECT-OPTIONS: S_FILTER FOR FEBPDO-FEBFILTER1.
SELECT-OPTIONS: T_FILTER FOR FEBPDO-FEBFILTER2.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN
COMMENT 01(31) TEXT-176 FOR FIELD PA_BDART.
PARAMETERS: PA_BDART LIKE FEBPDO-BDART.
SELECTION-SCREEN
COMMENT 36(21) TEXT-177 FOR FIELD PA_BDANZ.
PARAMETERS: PA_BDANZ LIKE FEBPDO-BDANZ.
data : bankfile1 type string,
umsfile1 type string,
ausfile1 type string.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN END OF BLOCK 3.
*------- Ausgabeparameter -
SELECTION-SCREEN BEGIN OF BLOCK 4 WITH FRAME TITLE TEXT-167.
PARAMETERS: BATCH LIKE RFPDO2-FEBBATCH,
P_KOAUSZ LIKE RFPDO1-FEBPAUSZ, " Kontoauszug drucken
P_BUPRO LIKE RFPDO2-FEBBUPRO,
P_STATIK LIKE RFPDO2-FEBSTAT,
PA_LSEPA LIKE FEBPDO-LSEPA.
SELECTION-SCREEN END OF BLOCK 4.
*eject
AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
MASK = ',Multicash,*.txt'
STATIC = 'X'
CHANGING
FILE_NAME = FILE.
DATA: L_FILES TYPE FILETABLE, "mo271101
H_FILES TYPE FILE_TABLE, "mo271101
L_RC LIKE SY-SUBRC. "mo271101
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG "mo271101
CHANGING "mo271101
FILE_TABLE = L_FILES "mo271101
RC = L_RC "mo271101
EXCEPTIONS "mo271101
FILE_OPEN_DIALOG_FAILED = 1 "mo271101
CNTL_ERROR = 2 "mo271101
ERROR_NO_GUI = 3 "mo271101
NOT_SUPPORTED_BY_GUI = 4 "mo271101
OTHERS = 5. "mo271101
IF SY-SUBRC <> 0 OR L_RC < 0. "mo271101
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO "mo271101
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. "mo271101
ENDIF. "mo271101
READ TABLE L_FILES INDEX 1 INTO H_FILES. "mo271101
UMSFILE = H_FILES-FILENAME. "mo271101
AT SELECTION-SCREEN ON VALUE-REQUEST FOR UMSFILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
MASK = ',Multicash,*.txt'
STATIC = 'X'
CHANGING
FILE_NAME = UMSFILE.
**AT SELECTION-SCREEN ON VALUE-REQUEST FOR AUSZFILE. "mo271101
DATA: L_FILES TYPE FILETABLE, "mo271101
H_FILES TYPE FILE_TABLE, "mo271101
L_RC LIKE SY-SUBRC. "mo271101
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG "mo271101
CHANGING "mo271101
FILE_TABLE = L_FILES "mo271101
RC = L_RC "mo271101
EXCEPTIONS "mo271101
FILE_OPEN_DIALOG_FAILED = 1 "mo271101
CNTL_ERROR = 2 "mo271101
ERROR_NO_GUI = 3 "mo271101
NOT_SUPPORTED_BY_GUI = 4 "mo271101
OTHERS = 5. "mo271101
IF SY-SUBRC <> 0 OR L_RC < 0. "mo271101
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO "mo271101
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. "mo271101
ELSE. "mo271101
READ TABLE L_FILES INDEX 1 INTO H_FILES. "mo271101
AUSZFILE = H_FILES-FILENAME. "mo271101
ENDIF. "mo271101
AT SELECTION-SCREEN ON VALUE-REQUEST FOR AUSZFILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
MASK = ',Multicash,*.txt'
STATIC = 'X'
CHANGING
FILE_NAME = AUSZFILE.
*------- Dateiangaben -
AT SELECTION-SCREEN ON BLOCK 1.
IF SSCRFIELDS-UCOMM = 'ONLI' OR
SSCRFIELDS-UCOMM = 'PRIN' OR
SSCRFIELDS-UCOMM = 'SJOB'.
IF EINLESEN IS INITIAL.
MESSAGE I660(FV).
SUBMIT RFEBKA30 VIA SELECTION-SCREEN.
ENDIF.
MOVE AUSZFILE TO AUSZUG-FILE.
MOVE UMSFILE TO UMSATZ-FILE.
IF NOT UMSFILE IS INITIAL AND FORMAT NE 'M'.
SET CURSOR FIELD 'UMSFILE'.
MESSAGE E621(FV).
ENDIF.
IF UMSFILE IS INITIAL AND FORMAT EQ 'M'.
SET CURSOR FIELD 'UMSFILE'.
MESSAGE E659(FV).
ENDIF.
ENDIF.
*------- Buchungsparameter -
AT SELECTION-SCREEN ON BLOCK 2.
IF NOT PA_XBDC IS INITIAL.
Batch Input erzeugen
IF MREGEL IS INITIAL.
SET CURSOR FIELD 'MREGEL'.
MESSAGE E619(FV).
ENDIF.
IF NOT PA_XBKBU IS INITIAL.
SET CURSOR FIELD 'PA_XBKBU'.
MESSAGE E611(FV).
ENDIF.
ENDIF.
*------- Algorithmen -
AT SELECTION-SCREEN ON BLOCK 3.
CLEAR T_FILTER.
LOOP AT T_FILTER.
SHIFT T_FILTER-LOW RIGHT DELETING TRAILING ' '.
SHIFT T_FILTER-HIGH RIGHT DELETING TRAILING ' '.
MODIFY T_FILTER.
ENDLOOP.
CASE PA_BDART.
WHEN 1.
IF NOT PA_BDANZ IS INITIAL.
SET CURSOR FIELD 'PA_BDANZ'.
MESSAGE E618(FV).
ENDIF.
WHEN 2.
IF PA_BDANZ IS INITIAL.
SET CURSOR FIELD 'PA_BDANZ'.
MESSAGE E615(FV).
ENDIF.
ENDCASE.
EXPORT PA_BDART PA_BDANZ TO MEMORY ID 'RFEBKA00_SEL'. "note 410904
*---- Ausgabesteuerung
AT SELECTION-SCREEN ON BLOCK 4.
IF SY-BATCH = 'X'.
IF BATCH NE 'X'.
BATCH = 'X'.
ENDIF.
ENDIF.
*---- Program started with EXEC+PRINT online
IF BATCH NE 'X'.
IF P_BUPRO = 'X' OR P_STATIK = 'X'.
IF SSCRFIELDS-UCOMM = 'PRIN'.
EXECPRI = 'X'.
ENDIF.
ENDIF.
ENDIF.
*------- Finanzdisposition -
AT SELECTION-SCREEN ON BLOCK 5.
IF NOT PA_XDISP IS INITIAL.
Call Transaktion
IF NOT PA_XCALL IS INITIAL.
SET CURSOR FIELD 'PA_XDISP'.
MESSAGE E610(FV).
ENDIF.
IF PA_DSART IS INITIAL.
SET CURSOR FIELD 'PA_DSART'.
MESSAGE E612(FV).
ENDIF.
ENDIF.
IF NOT INTRADAY IS INITIAL.
IF NOT format CA 'AS'. "mo260105
SET CURSOR FIELD 'INTRADAY'.
CLEAR ADVICE_X.
MESSAGE E003(FTCM).
ELSE.
ADVICE_X = '4'.
ENDIF.
ENDIF.
*eject
START-OF-SELECTION *
START-OF-SELECTION.
read print parameters (user defaults) for list-output *
required for list-output to spool (i.e. batch or exec&print) *
IF ( BATCH = 'X' ) OR ( EXECPRI = 'X' ).
PERFORM GET_PRINT_PARAMETERS USING PRI_PARAM ARC_PARAM.
ENDIF.
PERFORM INITIALIZATION.
VGEXT_OK = TRUE.
Einlesen im richtigen Format *
IF EINLESEN = 'X'.
CASE FORMAT.
WHEN 'M'.
Format: MultiCash (AUSZUG.TXT und UMSAT.TXT)
perform gmbimport.
PERFORM MULTICASH(RFEKA200).
WHEN 'S'.
Format: SWIFT MT940 (mit Strukturiertem Feld 86)
PERFORM SWIFT_MT940(RFEKA400).
WHEN 'I'.
Format: SWIFT MT940 (unstrukturiertes Feld 86)
PERFORM SWIFT_MT940(RFEKA400).
WHEN 'D'.
Format: DTAUS im Diskettenformat
PERFORM DTAUS_DISK(RFEKA100).
WHEN 'E'.
Format: ETEBAC-Format Frankreich
PERFORM FORMAT_FRANKREICH(RFEBFR20).
WHEN 'F'.
Format: TITO-Format Finnland.
PERFORM FORMAT_TITO(RFEBFI20).
WHEN 'C'.
Format: CSB43-Format Spanien
PERFORM FORMAT_CSB43(RFEBES20).
WHEN 'R'.
Format: CSB43-Format Spanien: Referenzfelder zusammen
PERFORM FORMAT_CSB43_R(RFEBES20).
WHEN 'B'.
Format: Brazil, Banco Itau
PERFORM FORMAT_ITAU(J_1BBR20).
WHEN '1'.
Format: Brazil, Banco Bradesco
PERFORM FORMAT_BRADESCO(J_1BBR30).
WHEN 'A'.
Format: Americas/Austrailia BAI
PERFORM BAI_STMT_HANDLING(RFEKA700).
WHEN OTHERS.
ENDCASE.
begin process returns:
loop at s_kukey.
l_statement-kukey = s_kukey-low.
append l_statement to lt_statements.
endloop.
call function 'FIEB_RETURNS'
TABLES
t_statements = lt_statements
t_return_charges = g_return_charges.
end returns
ENDIF.
Kontoauszug drucken *
o printout works for statements only that were newly read in *
IF P_KOAUSZ = 'X' AND EINLESEN = 'X'.
die zu druckenden Kontoauszuege sind in Range S_KUKEY (Global Data)
DESCRIBE TABLE S_KUKEY LINES TFILL_S_KUKEY.
IF TFILL_S_KUKEY > 0 AND VGEXT_OK = TRUE.
IF BATCH = 'X'. " set up print to spool
NEW-PAGE PRINT ON PARAMETERS PRI_PARAM
ARCHIVE PARAMETERS ARC_PARAM NO DIALOG.
ENDIF.
PERFORM DRUCK_KONTOAUSZUG.
IF BATCH = 'X'.
NEW-PAGE PRINT OFF.
MESSAGE S640(FV) WITH SY-SPONO.
ENDIF.
ENDIF.
ENDIF.
Finanzdispo Avise erzeugen *
IF PA_XDISP = 'X'.
PERFORM FINANZDISPO_AVISE_ERZEUGEN.
ENDIF.
Export Print Parameters to Memory *
o at least ONE of the variables EXECPRI / BATCH is ALWAYS *
initial here (or both) *
o import takes place in RFEBBU00 if EXECPRI = 'X' *
o import takes place in RFEBBU01 if BATCH (<->JOBNAME) = 'X'*
o WATCH OUT HERE: variablenames for EXPORT / IMPORT must be *
identical otherwise IMPORT will not return the *
contents of the variables while SY-SUBRC EQ 0 (!!) *
IF ( EXECPRI = 'X' ) OR ( BATCH = 'X' ).
PERFORM EXPORT_PRI_PARAMS.
ENDIF.
Verbuchung aufrufen *
IF PA_XDISP = 'X'
AND PA_TEST = 'X'.
falls FINANZDISPOAVISE und NICHT BUCHEN Verbuchung nicht aufrufen
ELSE.
IF ANWND = '0004'. "Intraday
create dunning blocks if customized in T028B*************"mo260105
REFRESH R_KUKEY.
LOOP AT S_KUKEY.
READ TABLE GT_MANSP ASSIGNING <MANSP>
WITH KEY KUKEY = S_KUKEY-LOW.
*gt_mansp is filled by the format specific programs (RFEKA400)
IF SY-SUBRC = 0.
IF NOT <MANSP>-MANSP IS INITIAL
AND NOT <MANSP>-BUKRS IS INITIAL.
MOVE-CORRESPONDING S_KUKEY TO L_KUKEY.
MOVE <MANSP>-MANSP TO L_KUKEY-MANSP.
MOVE <MANSP>-BUKRS TO L_KUKEY-BUKRS.
MOVE <MANSP>-ANZTG TO L_KUKEY-ANZTG.
APPEND L_KUKEY TO LT_KUKEY.
ENDIF.
ENDIF.
ENDLOOP.
IF LINES( LT_KUKEY ) > 0.
PERFORM SET_GLOBAL_RKUKEY(RFEBBU10) USING LT_KUKEY.
PERFORM SET_GLOBAL_FILTER(RFEBBU10) USING S_FILTER[] T_FILTER[].
PERFORM EINZELPOSTEN_AUSWERTEN(RFEBBU10) USING 'X'.
LOOP AT LT_KUKEY INTO L_KUKEY.
SELECT * FROM FEBCL
WHERE KUKEY = L_KUKEY-LOW
AND ( KOART = 'K' OR KOART = 'D' )
AND AGKON <> SPACE
AND SELFD = 'BELNR'
AND SELVON <> SPACE.
IF FEBCL-SELVON+10(4) <> SPACE.
L_GJAHR = FEBCL-SELVON+10(4).
ELSE.
L_GJAHR = FEBKO-AZDAT(4).
ENDIF.
IF FEBCL-KOART = 'D'.
L_KUNNR = FEBCL-AGKON.
L_LIFNR = SPACE.
ELSE.
L_KUNNR = SPACE.
L_LIFNR = FEBCL-AGKON.
ENDIF.
CALL FUNCTION 'FIEB_SET_DUNNING_BLOCK'
EXPORTING
I_KUKEY = FEBCL-KUKEY
I_ESNUM = FEBCL-ESNUM
I_BUKRS = L_KUKEY-BUKRS
I_BELNR = FEBCL-SELVON(10)
I_GJAHR = L_GJAHR
I_KUNNR = L_KUNNR
I_LIFNR = L_LIFNR
I_MANSP = L_KUKEY-MANSP
I_ANZTG = L_KUKEY-ANZTG
IMPORTING
E_MANSP = L_MANSP
EXCEPTIONS
ALREADY_EXISTING = 1
NOT_POSSIBLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0 OR L_MANSP <> L_KUKEY-MANSP.
*should be entered in the protocol
ELSE.
*should also be entered in the protocol
ENDIF.
ENDSELECT.
UPDATE FEBEP SET VB1OK = 'X' VB2OK = 'X'
BELNR = '' NBBLN = ''
WHERE KUKEY = L_KUKEY-LOW.
UPDATE FEBKO SET VB1OK = 'X' VB2OK = 'X'
ASTAT = '8'
WHERE KUKEY = L_KUKEY-LOW.
ENDLOOP.
ENDIF.
end of dunning block enhancement*************************"mo260105
PERFORM CREATE_MEMO_RECORDS.
ELSE.
Verbuchung aufrufen, falls externe Vorgu00E4nge in T028G
IF VGEXT_OK = TRUE.
PERFORM VERBUCHUNG_AUFRUFEN.
DESCRIBE TABLE NOTT028G LINES TFILL_S_KUKEY. "Unallocated
IF TFILL_S_KUKEY > 0. "is OK
perform set_print_parameters using batch pri_param.
perform write_wrong_t028g. "no data yet
perform druck_kontoauszug. "put in nott
perform close_print_parameters using batch. "yet
perform delete_statement.
PERFORM WRITE_WRONG_T028G. "hw397778
ENDIF.
ELSE.
DESCRIBE TABLE S_KUKEY LINES TFILL_S_KUKEY.
IF TFILL_S_KUKEY > 0.
IF BATCH = 'X'. " set up print to spool
NEW-PAGE PRINT ON PARAMETERS PRI_PARAM
ARCHIVE PARAMETERS ARC_PARAM NO DIALOG.
ENDIF.
PERFORM WRITE_WRONG_T028G.
PERFORM DRUCK_KONTOAUSZUG.
IF BATCH = 'X'.
NEW-PAGE PRINT OFF.
MESSAGE S640(FV) WITH SY-SPONO.
ENDIF.
PERFORM DELETE_STATEMENT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*eject
Seitenanfangsverarbeitung *
TOP-OF-PAGE.
--Batch-Heading-Routine aufrufen--
PERFORM BATCH-HEADING(RSBTCHH0).
WRITE: /01 SY-VLINE, 02 SY-ULINE(130), 132 SY-VLINE.
IF PRINTFLAG = 'A'.
PERFORM DRUCK_BANKUEBERSCHRIFT.
ENDIF.
*eject
Form-Routinen *
FORM VERBUCHUNG_AUFRUFEN. *
FORM VERBUCHUNG_AUFRUFEN.
Wenn Range leer und Einlesen angeXt, dann gab es keine zu verbuchenden
Kontoauszu00FCge. Z.B. wenn alle Ktoauszu00FCge schon eingelesen wurden.
DESCRIBE TABLE S_KUKEY LINES TFILL_S_KUKEY.
IF TFILL_S_KUKEY = 0 AND EINLESEN = 'X'.
EXIT.
ENDIF.
Felder fu00FCr Reportaufruf fu00FCllen.
IF BATCH = 'X'.
JOBNAME(8) = SY-REPID.
JOBNAME+8(1) = '-'.
JOBNAME+9(14) = TEXT-002.
EXPORTID(8) = SY-REPID.
EXPORTID+8(8) = SY-DATUM.
EXPORTID+16(6) = SY-UZEIT.
LOOP AT S_KUKEY.
EXPORTID+23(8) = S_KUKEY-LOW.
EXIT.
ENDLOOP.
ENDIF.
IF SPOOL = 'X'. " QHA GB
CLEAR PRI_PARAM. " QHA GB
PRI_PARAM = %_PRINT. " QHA GB
EXPORT PRI_PARAM TO MEMORY. " QHA GB
IF SY-SUBRC NE 0. " QHA GB
SPOOL = ' '. " QHA GB
ENDIF. " QHA GB
ENDIF. " QHA GB
Verbuchungsreport aufrufen falls Buchungen erzeugt werden sollen.
IF BUBER NE SPACE.
SUBMIT RFEBBU01 AND RETURN
WITH ANWND = ANWND
WITH S_KUKEY IN S_KUKEY
WITH JOBNAME = JOBNAME
WITH EXPORTID = EXPORTID
WITH BUBER = BUBER
WITH USEREXIT = USEREXIT "30D
WITH SELFD = SELFD
WITH SELFDLEN = SELFDLEN
WITH S_FILTER IN S_FILTER
WITH T_FILTER IN T_FILTER
WITH PA_BDART = PA_BDART
WITH PA_BDANZ = PA_BDANZ
WITH FUNCTION = FUNCTION
WITH MODE = MODE
WITH MREGEL = MREGEL
WITH PA_EFART = EFART
WITH P_BUPRO = P_BUPRO
WITH SPOOL = SPOOL
WITH P_STATIK = P_STATIK
WITH VALUT_ON = VALUT_ON
WITH TESTL = PA_TEST
WITH EXECPRI = EXECPRI.
Jobcount importieren
IMPORT JOBCOUNT FROM MEMORY ID EXPORTID.
WRITE: / 'Jobcount = ', JOBCOUNT.
ENDIF.
ENDFORM. "VERBUCHUNG_AUFRUFEN
*eject
*& Form FINANZDISPO_AVISE_ERZEUGEN
text *
FORM FINANZDISPO_AVISE_ERZEUGEN.
LOOP AT S_KUKEY.
SELECT * FROM FEBKO WHERE KUKEY = S_KUKEY-LOW.
ENDSELECT.
IF SY-SUBRC = 0.
SUBMIT RFEBFD00 AND RETURN
WITH P_BUKRS = FEBKO-BUKRS
WITH P_HBKID = FEBKO-HBKID
WITH P_HKTID = FEBKO-HKTID
WITH P_ANWND = FEBKO-ANWND "40a
WITH R_AZNUM = FEBKO-AZNUM
WITH R_AZDAT = FEBKO-AZDAT
WITH BI-NAME = SY-REPID
WITH BI-PROC = ADVICE_X "46b
WITH BI-DSART = PA_DSART
WITH P_VERD = PA_VERD.
ENDIF.
ENDLOOP.
ENDFORM. " FINANZDISPO_AVISE_ERZEUGEN
*eject
*& Form INITIALIZATION
Felder initialisieren *
FORM INITIALIZATION.
DATA: l_job LIKE tbtcjob-jobcount, "mo260105
ls_param LIKE btcselect, "mo260105
lt_joblist TYPE STANDARD TABLE OF tbtcjob. "mo260105
UPLOAD = PCUPLOAD.
EB_FORMAT = FORMAT.
IF NOT PA_XCALL IS INITIAL.
FUNCTION = 'C'.
ENDIF.
IF NOT PA_XBDC IS INITIAL.
FUNCTION = 'B'.
ENDIF.
MODE = PA_MODE.
IF PA_XCALL = 'X'
AND PA_XBKBU = 'X'.
BUBER = '1'.
ELSE.
BUBER = 'A'.
ENDIF.
IF INTRADAY = 'X'.
ANWND = '0004'. "Intraday Stmt
*begin of MT942 intraday enhancement "mo260105
SELECT SINGLE * FROM t028b WHERE mansp <> space.
IF sy-subrc = 0.
ls_param-jobname = 'RFEBKA20'.
ls_param-username = '*'.
CALL FUNCTION 'BP_JOB_SELECT'
EXPORTING
jobselect_dialog = 'N'
jobsel_param_in = ls_param
enddate = sy-datum
TABLES
jobselect_joblist = lt_joblist
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0 OR LINES( lt_joblist ) = 0.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = 'RFEBKA20'
IMPORTING
jobcount = l_job
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
SUBMIT rfebka20 VIA JOB 'RFEBKA20' NUMBER l_job AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_job
jobname = 'RFEBKA20'
strtimmed = 'X'
EXCEPTIONS
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*end of MT942 intraday enhancement "mo260105
ELSE.
ANWND = '0001'. "Anwendung Zwischenspeicher
ENDIF.
EFART = 'E'. "Electronischer Kontoauszug
IF SY-PDEST NE SPACE. " QHA
SPOOL = 'X'. " QHA
ENDIF. " QHA
*-- Avoid initial BUKRS - field: Defaults to page-header for company
*-- 0000. Fill instead with non-existing value - leads to printout of
*-- header-text for client.
BHDGD-BUKRS = '----'. "ak101199
ENDFORM. " INITIALIZATION
*eject
*& Form WRITE_WRONG_T028G
Ausgabe der fehlenden Eintru00E4ge in T028G *
FORM WRITE_WRONG_T028G.
DATA: FIRST(1) TYPE C. "HP
DATA: x_noposting(1) TYPE c.
PRINTFLAG = SPACE.
clear x_noposting.
LOOP AT NOTT028G WHERE VGDEF = SPACE.
x_noposting = 'X'.
exit.
ENDLOOP.
NEW-PAGE.
Druck der ext. Vorgu00E4nge, die nicht in T028G enhalten sind.
WRITE: /01 SY-VLINE, TEXT-010, 132 SY-VLINE.
WRITE: /01 SY-VLINE, TEXT-011, 132 SY-VLINE.
WRITE: /01 SY-VLINE, TEXT-012, 132 SY-VLINE.
WRITE: /01 SY-VLINE, TEXT-013, 132 SY-VLINE.
WRITE: /01 SY-VLINE, TEXT-014, 132 SY-VLINE.
WRITE: /01 SY-VLINE, TEXT-015, 132 SY-VLINE.
IF X_NOPOSTING EQ 'X'.
WRITE: /01 sy-vline, text-017, 132 sy-vline.
ENDIF.
WRITE: /01 SY-VLINE, TEXT-018, 132 SY-VLINE. "MP
WRITE: /01 SY-VLINE, TEXT-019, 132 SY-VLINE. "MP
WRITE: /01 SY-VLINE, TEXT-020, 132 SY-VLINE. "MP
FIRST = 'X'. "HP
LOOP AT NOTT028G WHERE VOZPM = '*'. "HP
IF FIRST = 'X'. "HP
WRITE: /01 SY-VLINE, TEXT-010, 132 SY-VLINE. "HP
WRITE: /01 SY-VLINE, TEXT-040, 132 SY-VLINE. "HP
WRITE: /01 SY-VLINE, TEXT-041, 132 SY-VLINE. "HP
WRITE: /01 SY-VLINE, TEXT-042, 132 SY-VLINE. "HP
WRITE: /01 SY-VLINE, TEXT-031, 132 SY-VLINE. "HP
"HP
WRITE: /01 SY-VLINE, 02 SY-ULINE(130), 132 SY-VLINE. "HP
CLEAR FIRST. "HP
ENDIF. "HP
WRITE: /01 SY-VLINE, "HP
03(08) NOTT028G-VGTYP, "HP
12(27) NOTT028G-VGEXT, "HP
40(03) '+/-', "HP
44(20) TEXT-032, "HP
65(15) NOTT028G-BANKL, "HP
81(18) NOTT028G-KTONR, "HP
100(05) NOTT028G-AZNUM, "HP
106(08) NOTT028G-KUKEY, "HP
115(05) NOTT028G-ESNUM, "HP
132 SY-VLINE. "HP
DELETE NOTT028G. "HP
ENDLOOP. "HP
SORT NOTT028G. "HP
LOOP AT NOTT028G. "HP
AT FIRST. "HP
WRITE: /01 SY-VLINE, TEXT-010, 132 SY-VLINE.
WRITE: /01 SY-VLINE, TEXT-030, 132 SY-VLINE.
WRITE: /01 SY-VLINE, TEXT-031, 132 SY-VLINE.
WRITE: /01 SY-VLINE, 02 SY-ULINE(130), 132 SY-VLINE.
ENDAT. "HP
LOOP AT nott028g. "HP
WRITE: /01 SY-VLINE,
03(08) NOTT028G-VGTYP,
12(27) NOTT028G-VGEXT,
40(01) NOTT028G-VOZPM,
44(20) TEXT-032,
65(15) NOTT028G-BANKL,
81(18) NOTT028G-KTONR,
100(05) NOTT028G-AZNUM,
106(08) NOTT028G-KUKEY,
115(05) nott028g-esnum.
if nott028g-vgdef = 'X'.
write 121(07) G_VGEXT.
endif.
write 132 sy-vline.
ENDLOOP.
WRITE: /01 SY-VLINE, 02 SY-ULINE(130), 132 SY-VLINE.
if x_noposting = 'X'.
MESSAGE s773.
endif.
ENDFORM. " WRITE_WRONG_T028G
*eject
Include der Form-Routinen fu00FCr Ausdruck des Kontoauszuges *
INCLUDE ZFEKAP00.
Form DELETE_STATEMENT
FORM DELETE_STATEMENT.
SELECT * FROM FEBKO WHERE KUKEY IN S_KUKEY AND ANWND = '0001'.
DELETE FROM FEBRE WHERE KUKEY = FEBKO-KUKEY.
DELETE FROM FEBEP WHERE KUKEY = FEBKO-KUKEY.
MOVE-CORRESPONDING FEBKO TO FEBVW.
DELETE FEBVW.
DELETE FEBKO.
ENDSELECT.
ENDFORM. " DELETE_STATEMENT
Form GET_PRINT_PARAMETERS *
FORM GET_PRINT_PARAMETERS USING P_PRI_PARAM LIKE PRI_PARAMS
P_ARC_PARAM LIKE ARC_PARAMS.
DATA: LIST_NAME LIKE PRI_PARAMS-PLIST.
LIST_NAME = SY-REPID.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
NO_DIALOG = 'X'
LIST_NAME = LIST_NAME
MODE = 'CURRENT'
LAYOUT = 'X_65_132'
IMPORTING
OUT_ARCHIVE_PARAMETERS = P_ARC_PARAM
OUT_PARAMETERS = P_PRI_PARAM.
P_PRI_PARAM-LINSZ = '132'. "workaround
ENDFORM. "GET_PRINT_PARAMETERS
Form EXPORT_PRI_PARAMS *
Export print and archive parameters for later import in reports *
RFEBBU00 or RFEBBU01 (depending on parameters EXECPRI and JOBNAME)*
Variablenames for IMPORT / EXPORT must be the same, so we better *
don't use local variables here. *
FORM EXPORT_PRI_PARAMS.
CLEAR PRI_KEY.
PRI_KEY-REPID = 'RFEBBU00'.
LOOP AT S_KUKEY.
PRI_KEY-KUKEY = S_KUKEY-LOW.
EXIT.
ENDLOOP.
EXPORT PRI_PARAM ARC_PARAM TO MEMORY ID PRI_KEY.
ENDFORM. " EXPORT_PRI_PARAMS
---- T H E E N D -
*& Form CREATE_MEMO_RECORDS
text
--> p1 text
<-- p2 text
FORM CREATE_MEMO_RECORDS.
DATA: XFEBKO LIKE FEBKO OCCURS 2 WITH HEADER LINE.
DATA: XFEBPI LIKE FEBPI OCCURS 2 WITH HEADER LINE.
DATA: HEADER_LINE(130) TYPE C.
DATA: POMSG LIKE BALMT.
DATA: BEGIN OF ITAB_FDES OCCURS 10.
INCLUDE STRUCTURE FDES.
DATA: END OF ITAB_FDES.
PRINTFLAG = SPACE.
LOOP AT S_KUKEY.
AT FIRST.
IF P_BUPRO = 'X'.
NEW-PAGE.
WRITE: /01 SY-VLINE,
TEXT-170,
132 SY-VLINE.
WRITE: /01 SY-VLINE, 02 SY-ULINE(130), 132 SY-VLINE.
HEADER_LINE = TEXT-031.
SHIFT HEADER_LINE BY 62 PLACES.
WRITE: /01 SY-VLINE,
HEADER_LINE(35),
132 SY-VLINE.
WRITE: /01 SY-VLINE, 02 SY-ULINE(130), 132 SY-VLINE.
ENDIF.
ENDAT.
SELECT * FROM FEBKO WHERE KUKEY = S_KUKEY-LOW.
ENDSELECT.
IF SY-SUBRC = 0.
REFRESH XFEBKO.
CLEAR XFEBKO.
XFEBKO = FEBKO.
APPEND XFEBKO.
REFRESH XFEBPI.
CLEAR XFEBPI.
SELECT SINGLE * FROM FEBPI INTO XFEBPI
WHERE KUKEY = XFEBKO-KUKEY
AND ESNUM = 0.
IF SY-SUBRC = 0.
APPEND XFEBPI.
CALL FUNCTION 'POST_MEMO_ENTRIES_POLLING_DIR'
TABLES
T_FEBKO = XFEBKO
T_FEBEP =
T_FEBPI = XFEBPI
EXCEPTIONS
STATEMENT_NOT_PROCESSED = 1
DISTINCT_FDES_NOT_FOUND = 1
OTHER_CUSTOMIZATION = 1
NOTHING_TO_POST = 2
OTHERS = 1.
IF SY-SUBRC = 0.
CLEAR POMSG.
*-- update bdb --
LOOP AT XFEBKO.
UPDATE FEBKO
SET ASTAT = XFEBKO-ASTAT
VB1OK = XFEBKO-VB1OK
VB2OK = XFEBKO-VB2OK
XFDIS = XFEBKO-XFDIS
WHERE ANWND = XFEBKO-ANWND
AND ABSND = XFEBKO-ABSND
AND AZIDT = XFEBKO-AZIDT
AND EMKEY = XFEBKO-EMKEY.
ENDLOOP.
LOOP AT XFEBPI.
UPDATE FEBPI
SET IDENR = XFEBPI-IDENR
DATM1 = XFEBPI-DATM1
TIME1 = XFEBPI-TIME1
WHERE KUKEY = XFEBPI-KUKEY
More than 90% of this time it's due to a misunderstanding (in-apps, subscription renewals, etc.), or accidental due to family members (other accunts)...
At least you can check what's purchased on your own account:
Tunes Store & Mac App Store: Seeing your purchase history and order numbers
http://support.apple.com/kb/HT2727
If the purchases do not show up there, then it's coming from another iTS account. You may wish to contact iTS...
iTunes Store Support
http://www.apple.com/emea/support/itunes/contact.html
They could disable the other account if it turns out not to be accidental, etc. -
Upload data from Excel to Internal table
Hi,
I am facing a peculiar problem in uploading the data in excel sheet to internal table.
The excel file contains material number and product hierarchy number. The product hierarchy number for some material is downloaded as 5.73101E17 for the value 573100910115782000. Though I expand the sheet the display is the same 5.73101E17. When i upload the sheet using the f'n module "ALSM_EXCEL_TO_INTERNAL_TABLE" the value is taken as it is (5.73101E+17) into the internal table which is wrong. I tried to change the data type to type n. Then the value is uploaded as 5731011700000000.
Please propose a solution to this without having to change the format of the column from general to "number without decimals"
Regards,
SamHI
see this example code which EXCEL TO INTERNAL TABLE AND THEN TO APPLICATION
*& Report ZSD_EXCEL_INT_APP
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
Maybe you are looking for
-
My new iPod touch won't sync?
I got a brand new iPod touch today for Christmas, and got it all set up and everything was working perfectly. About an hour ago though I went to add more photos to the album I have synced to my iPod. When I plugged the iPod in it said "Waiting for sy
-
Hi, when trying to export or publish a movie using QT format- keep getting an error dialog stating that the installed version of QT does not have a handler for this type of Macromedia flash movie. Am using QT Pro 7.1.5, on a Mac system. Have Flash MX
-
Best practice when writing multi window gtkmm application?
Hello Anyone here who knows gtkmm? I'm in the progress of learning it, and now I'm stuck. I can't really find a good, clean and _working_ way to add more windows. For example I want to create a "New project" window where the user have to enter some i
-
My Itune is default 1712 I can't open my Itune in my macBookPro
I can't upload itune it keep give me a error message it read itune in default what is wrong I use all the time and now it open.
-
Problem with ORACLE JDBC OCI-8 Driver
Hi All, I'm still having problems with this driver. JDev is aware of my Oracle home, so I assume it's throwing the oraclehome/bin directory which contains the ocijdbc8.dll file into the path when it runs the connection manager. I tried running my tes