‎2008 Nov 01 6:54 AM
Hi Experts,
I am using following code to upload a flat file from my local PC to SAP
The code is NOT inserting records in zassum, /bic/pzassum and /bic/tzassum. zassum is SAP BW infoobject. I have run debugger and found that data is getting populated correctly for ztable_data and ztable_text.
The program is getting compiled / activated successfully. I am even getting message " ZASSUM got updated successfully ". However the issue persists.
I am new for ABAP. I might have committed some mistake any where in the code.
Also pls let me know whether statement "PERFORM update_alv_grid_display" is really needed.
Thanks
Smith
FORM upload_batches.
DATA : wf_title TYPE string,
lt_filetab TYPE filetable,
l_separator TYPE char01,
l_action TYPE i,
l_count TYPE i,
ls_filetab TYPE file_table,
wf_delemt TYPE rollname,
wa_fieldcat TYPE lvc_s_fcat,
tb_fieldcat TYPE lvc_t_fcat,
rows_read TYPE i,
p_error TYPE char01,
l_file TYPE string.
TYPES : BEGIN OF test_struc,
/bic/zassum TYPE /bic/oizassum,
txtmd TYPE rstxtmd,
END OF test_struc.
DATA : test_upload TYPE STANDARD TABLE OF test_struc.
DATA : wa_test_upload TYPE test_struc,
ztable_data TYPE TABLE OF /bic/pzassum,
ztable_text TYPE TABLE OF /bic/tzassum,
wa_upld_text TYPE /bic/tzassum,
wa_upld_data TYPE /bic/pzassum,
wa_actbatch TYPE /bic/pzassum.
wf_title = text-026.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = wf_title
default_extension = 'txt'
file_filter = 'Tab delimited Text Files (*.txt)'
CHANGING
file_table = lt_filetab
rc = l_count
user_action = l_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
OTHERS = 3. "#EC NOTEXT
IF sy-subrc <> 0.
EXIT.
ENDIF.
LOOP AT lt_filetab INTO ls_filetab.
l_file = ls_filetab.
ENDLOOP.
CHECK l_action = 0.
IF l_file IS INITIAL.
EXIT.
ENDIF.
l_separator = 'X'.
wa_fieldcat-fieldname = 'test'.
wa_fieldcat-dd_roll = wf_delemt.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_test_upload.
Upload file from front-end (PC)
File format is tab-delimited ASCII
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
has_field_separator = l_separator
TABLES
data_tab = i_mara
data_tab = test_upload
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.
EXIT.
ELSE.
LOOP AT test_upload INTO wa_test_upload.
CLEAR : p_error.
DESCRIBE TABLE test_upload LINES rows_read.
IF wa_test_upload-/bic/zassum IS INITIAL.
p_error = 'X'.
MESSAGE s153 WITH wa_test_upload-/bic/zassum sy-tabix.
CONTINUE.
ELSE.
IF sy-subrc = 0.
ENDIF.
ENDIF.
wa_upld_text-txtmd = wa_test_upload-txtmd.
wa_upld_text-txtsh = wa_test_upload-txtmd.
wa_upld_text-langu = sy-langu.
wa_upld_data-/bic/zassum = '11'.
wa_upld_data-chrt_accts = 'abc'.
wa_upld_data-co_area = '1234'.
wa_upld_data-/bic/zbhpbcsg = 'uv'.
wa_upld_data-objvers = 'A'.
wa_upld_data-/bic/zass_mdl = 'pqr'.
wa_upld_data-/bic/zass_typ = 'I'.
wa_upld_data-/bic/zdriver = 'defg'.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_data.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_text.
APPEND wa_upld_data TO ztable_data.
APPEND wa_upld_text TO ztable_text.
ENDLOOP.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
IF ztable_data IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'ZASSUM'
i_tabclass = 'M'
TABLES
i_t_table = ztable_data
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
COMMIT WORK.
IF sy-subrc <> 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'Zmy_prg'
msgty = 'E'
txtnr = '054'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = sy-msgid
msgty = sy-msgty
txtnr = sy-msgno
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
EXCEPTIONS
OTHERS = 3.
MESSAGE e054(z_myprg) WITH 'ZASSUM'.
ELSE.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'Z_BM_BPS'
msgty = 'S'
txtnr = '053'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
MESSAGE s053(z_myprg).
IF ztable_text[] IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'ZASSUM'
i_tabclass = 'T'
TABLES
i_t_table = ztable_text
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'Z_myprg'
msgty = 'E'
txtnr = '055'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = sy-msgid
msgty = sy-msgty
txtnr = sy-msgno
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
EXCEPTIONS
OTHERS = 3.
ENDIF.
ENDIF.
ENDIF.
COMMIT WORK.
ENDIF.
ENDIF.
CALL FUNCTION 'RSDG_IOBJ_DEQUEUE'
EXPORTING
i_objnm = 'ZASSUM'
i_scope = '1'.
PERFORM update_alv_grid_display.
CALL FUNCTION 'MESSAGES_SHOW'.
ENDFORM. " upload_batches
‎2008 Nov 10 4:51 PM