Changing An Idoc's Status With An Excel Upload: Main Program
Changing An Idoc's Status With An Excel Upload: Main Program
upload
Author: Kevin Wilson
http://www.sapgenie.com
Main program
*&---------------------------------------------------------------------*
*& Report Z_IDOC_STATUS_CHANGE
*
*&---------------------------------------------------------------------*
*& AUTHOR: Kevin Wilson
*
*& DESCRIPTION: Reset Idoc statuses by uploading spreadsheet of IDocs *
*&---------------------------------------------------------------------*
report z_idoc_status_change message-id zedi.
*--- INCLUDES ---------------------------------------------------------*
include z_idoc_status_change_data.
include z_idoc_status_change_forms.
*--- SELECTION OPTIONS ------------------------------------------------*
selection-screen begin of block b1 with frame title text-001.
parameters: filename like sapb-sappfad.
selection-screen skip.
selection-screen begin of block b2 with frame title text-002.
parameters: status like edidc-status default '52',
msgty like edids-statyp default 'I',
msgid like edids-stamid default 'ZEDI',
msgno like edids-stamno default '029',
msgv1 like edids-stapa1 default sy-uname,
msgv2 like edids-stapa2 default sy-datum,
msgv3 like edids-stapa3,
msgv4 like edids-stapa4.
selection-screen end of block b2.
selection-screen end of block b1.
else. "Cancel
format color col_negative.
write: /5 'Choose to cancel. No records changed'.
format color off.
endif.
endif.
endif.
endif.
*--- AT SELECTION SCREEN ACTION ---------------------------------------*
at selection-screen on value-request for filename.
call function 'AL_POPUP_FOR_LOCAL_PATH'
importing
filereturn = filename
exceptions
others
= 1.
Include Z_IDOC_STATUS_CHANGE_DATA
*----------------------------------------------------------------------*
***INCLUDE Z_IDOC_STATUS_CHANGE_DATA .
*----------------------------------------------------------------------*
*--- TABLES DEFINITIONS ----------------------------------------------*
tables: edidc.
*--- STRUCTURE DEFINITIONS -------------------------------------------*
types: begin of itab_idoc_structure,
docnum like edidc-docnum.
types: end of itab_idoc_structure.
*--- INTERNAL TABLE AND WORK AREA DEFINITIONS -------------------------*
data: itab_idocs type standard table of itab_idoc_structure,
wa_idocs type itab_idoc_structure.
*--- VARIABLES --------------------------------------------------------*
data: return like sy-subrc,
t_answer.
Include Z_IDOC_STATUS_CHANGE_FORMS
*----------------------------------------------------------------------*
***INCLUDE Z_IDOC_STATUS_CHANGE_FORMS .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&
Form upload_excel
*&---------------------------------------------------------------------*
* Only handles Excel file upload - Column A has a list of IDoc numbers
* Maximum 2000 IDocs passed
*&---------------------------------------------------------------------*
form upload_excel tables p_itab_idoc like itab_idocs
using p_filename
changing p_return.
data: file_name like rlgrap-filename,
file_type like rlgrap-filetype,
itab_excel like alsmex_tabline occurs 0 with header line.
bdidocstat-docnum = wa_idocs-docnum.
"IDoc number
bdidocstat-status = p_status.
"IDoc status
bdidocstat-msgty = p_msgty.
"Message type
bdidocstat-msgid = p_msgid.
"Message ID
bdidocstat-msgno = p_msgno.
"Message number
bdidocstat-msgv1 = p_msgv1.
"Message variable
bdidocstat-msgv2 = p_msgv2.
"Message variable
bdidocstat-msgv3 = p_msgv3.
"Message variable
bdidocstat-msgv4 = p_msgv4.
"Message variable
append bdidocstat.
1
2
3
4
" process_idocs