Wednesday, May 2, 2012

BDC upload infotype 0006 from excel and note pad

*&---------------------------------------------------------------------*
*& Report ZHR0006_UPLOAD_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZHR0006_UPLOAD.

tables: PA0006.
TYPE-POOLS: SLIS.
*---Global Data declarations
*include ZHR0006_UPLOAD2_top.

TYPES: BEGIN OF ty_pa0006,
PERNR TYPE PERNR_D,
SUBTY TYPE SUBTY,
OBJPS TYPE OBJPS,
SPRPS TYPE SPRPS,
ENDDA TYPE ENDDA,
BEGDA TYPE BEGDA,
SEQNR TYPE SEQNR,
AEDTM TYPE AEDTM,
UNAME TYPE AENAM,
HISTO TYPE HISTO,
ITXEX TYPE ITXEX,
REFEX TYPE REFEX,
ORDEX TYPE ORDEX,
ITBLD TYPE ITBLD,
PREAS TYPE PREAS,
FLAG1 TYPE NUSED,
FLAG2 TYPE NUSED,
FLAG3 TYPE NUSED,
FLAG4 TYPE NUSED,
RESE1 TYPE NUSED2,
RESE2 TYPE NUSED2,
GRPVL TYPE PCCE_GPVAL,
ANSSA TYPE ANSSA,
NAME2 TYPE PAD_CONAM,
STRAS TYPE PAD_STRAS,
ORT01 TYPE PAD_ORT01,
ORT02 TYPE PAD_ORT02,
PSTLZ TYPE PSTLZ_HR,
LAND1 TYPE LAND1,
TELNR TYPE TELNR,
ENTKM TYPE ENTKM,
WKWNG TYPE WKWNG,
BUSRT TYPE BUSRT,
LOCAT TYPE PAD_LOCAT,
ADR03 TYPE AD_STRSPP1,
ADR04 TYPE AD_STRSPP2,
STATE TYPE REGIO,
HSNMR TYPE PAD_HSNMR,
POSTA TYPE PAD_POSTA,
BLDNG TYPE AD_BLD_10,
FLOOR TYPE AD_FLOOR,
STRDS TYPE STRDS,
ENTK2 TYPE ENTKM,
COM01 TYPE COMKY,
NUM01 TYPE COMNR,
COM02 TYPE COMKY,
NUM02 TYPE COMNR,
COM03 TYPE COMKY,
NUM03 TYPE COMNR,
COM04 TYPE COMKY,
NUM04 TYPE COMNR,
COM05 TYPE COMKY,
NUM05 TYPE COMNR,
COM06 TYPE COMKY,
NUM06 TYPE COMNR,
INDRL TYPE P22J_INDRL,
COUNC TYPE COUNC,
RCTVC TYPE P22J_RCTVC,
OR2KK TYPE P22J_ORKK2,
CONKK TYPE P22J_PCNKK,
OR1KK TYPE P22J_ORKK1,
RAILW TYPE RAILW,
END OF ty_pa0006.


data : wa_pa0006 type ty_pa0006. "pa0006. "ty_pa0006.
data : wa_pa0006_t type p0006.
DATA : it_pa0006 type table of ty_pa0006. "pa0006. " ty_pa0006
*data : wl_pa0006 type ty_pa0006.
data : la_pa0006 type table of ty_pa0006.
data : number type num8.

*-----------ALV FIELD CATLOG----------------------------------
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT TYPE LINE OF SLIS_T_FIELDCAT_ALV.

DATA:IS_LAY TYPE SLIS_LAYOUT_ALV.
*--------------------------------------------------------------
*-------------------store unsucessful records------------------

DATA: lo_gui TYPE REF TO cl_gui_frontend_services,
lv_title TYPE string,
lv_folder TYPE string,
lv_dir TYPE string,
v_filetype TYPE string,
v_filename TYPE string,
lv_filename type string.

DATA : WE_PA0006 TYPE TY_PA0006.
data : er_pa0006 type table of ty_pa0006.

*--------------------SUCESSFULL AND UNSUCESSFUL RECORDS-------------

DATA : SU_RECORDS TYPE i,
UN_RECORDS TYPE i.

SU_RECORDS = 0.
UN_RECORDS = 0.

DATA : OUT_PUT TYPE CHAR7.

*-------------------------------------------------------------------

*-----------------IT_EVENTS-----------------------------------------
types: begin of TY_eventS,
name(30),
form(30),
end of TY_eventS.

DATA : WA_EVENTS TYPE TY_EVENTS,
IT_EVENTS TYPE TABLE OF TY_EVENTS.



*-----------------------------------------------------------

DATA: P_RETURN TYPE BAPIRETURN1.






DATA: d_ucomm LIKE sy-ucomm.
data : g_file type ibipparms-path.
data : g_file1 type ibipparms-path.
selection-screen begin of block b1 with frame title text-999.
PARAMETERS: p_TXT RADIOBUTTON GROUP rad1 USER-COMMAND ACT DEFAULT 'X',
p_XLS RADIOBUTTON GROUP rad1.
selection-SCREEN end of block b1.


selection-screen begin of block b2 with frame title text-998.
PARAMETERS: p_file type string MODIF ID A, "Text file
p_file1 type RLGRAP-FILENAME MODIF ID a,
p1_file type RLGRAP-FILENAME MODIF ID b, "Xls/Csv file
p_file2 type RLGRAP-FILENAME MODIF ID b.
selection-SCREEN end of block b2.


AT SELECTION-SCREEN.
d_ucomm = sy-ucomm.

AT SELECTION-SCREEN OUTPUT.
LOOP AT screen.
IF p_TXT = 'X'.
IF screen-group1 = 'B'.
screen-active = 0.
ENDIF.
ELSEIF p_XLS = 'X'.
IF screen-group1 = 'A'.
screen-active = 0.
ENDIF.
ENDIF.
MODIFY screen.
ENDLOOP.



at SELECTION-SCREEN on VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'p_file'
IMPORTING
FILE_NAME = g_file.
p_file = g_file.


at SELECTION-SCREEN on VALUE-REQUEST FOR p1_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'p1_file'
IMPORTING
FILE_NAME = g_file.
p1_file = g_file.

if p_txt = 'X'.
p_file = g_file.
endif.

if p_xls = 'X'.
p1_file = g_file.

endif.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
PERFORM f_browse CHANGING p_file1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
PERFORM f_browse CHANGING p_file2.

* at SELECTION-SCREEN on VALUE-REQUEST FOR p_file1.
* CALL FUNCTION 'F4_FILENAME'
* EXPORTING
* PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = 'p_file'
* IMPORTING
* FILE_NAME = g_file1.
*p_file1 = g_file1.

START-OF-SELECTION.

*-----------------------CODE FOR TEXT UPLOAD--------------------------

if p_txt = 'X'.

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = P_FILE
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = IT_pa0006
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.

IF p_XLS = 'X'.

*------This logic is for executing Excel and csv file------------

data : l_intern type alsmex_tabline occurs 0 with header line.
data : l_index type i.
data : l_start_col type i value '1',
l_start_row type i value '1',
l_end_col type i value '256',
l_end_row type i value '65536'.

if p1_file is not initial.
field-symbols : .
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p1_file
i_begin_col = l_start_col
i_begin_row = l_start_row
i_end_col = l_end_col
i_end_row = l_end_row
TABLES
intern = l_intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.

if l_intern[] is initial.
* message i010(z1).
exit.
else.
sort l_intern by row col.
loop at l_intern.
move l_intern-col to l_index.
assign component l_index of structure wa_pa0006 to .
if sy-subrc = 0. " Incase there are more xls columns than fields
move l_intern-value to .
endif.
at end of row.
append wa_pa0006 to it_pa0006.
clear wa_pa0006.
endat.
endloop.
endif.

endif.
endif.
LOOP AT IT_pa0006 INTO WA_pa0006.
MOVE-CORRESPONDING wa_pa0006 to wa_pa0006_t.
*----------------------------------------------------------

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = WA_pa0006-PERNR
IMPORTING
RETURN = P_RETURN
LOCKING_USER = SY-UNAME.

*------------------------------------------------------------

*------------------------------------------------------------
if WA_pa0006-SUBTY LT 4 and WA_pa0006-SUBTY <> 0.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0006'
number = WA_pa0006-PERNR
SUBTYPE = WA_pa0006-SUBTY
OBJECTID = WA_pa0006-OBJPS
LOCKINDICATOR = WA_pa0006-SPRPS
VALIDITYEND = WA_pa0006-ENDDA
VALIDITYBEGIN = WA_pa0006-BEGDA
RECORDNUMBER = WA_pa0006-SEQNR
record = WA_pa0006_t
* operation = insert
operation = 'INS'
* TCLAS = 'A'
DIALOG_MODE = '0'
* NOCOMMIT = 'X'
* VIEW_IDENTIFIER =
* SECONDARY_RECORD =
IMPORTING
RETURN = P_RETURN
* KEY =
.

IF SY-SUBRC eq 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
message s000(zms) with 'database updated'.

IF P_RETURN-TYPE EQ 'E'." and wa_pa0006_t-pernr eq 0 .
UN_RECORDS = UN_RECORDS + 1.
APPEND WA_PA0006 TO er_pa0006.
ENDIF.
IF P_RETURN-TYPE <> 'E'." and wa_pa0006_t-pernr <> 0.
SU_RECORDS = SU_RECORDS + 1.
APPEND WA_PA0006 TO la_pa0006.
ENDIF.


ENDIF.
else.
APPEND WA_PA0006 TO er_pa0006.
endif.

*----------------------------------------------------------

CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = WA_pa0006-PERNR
* IMPORTING
* RETURN =
.
*------------------------------------------------------------
clear wa_pa0006.
endloop.

*ENDIF.

*------------END OF HR INFOTYPE OPERATIONS---------------------

*-------------DOWNLOADED ERROR FILE-----------------------------

IF ER_PA0006[] IS NOT INITIAL.

"This part of code to add column name in the downloaded file.

data : begin of int_head occurs 0,
Filed1(20) type c, " Header Data
end of int_head.

PERFORM INT_HEADS.


v_filetype = '.xls'. "I just manipulate the file name using XLS file type.

if p_txt = 'X'.
v_filename = p_file1.
CONCATENATE p_file1 v_filetype INTO lv_filename.
endif.

if p_xls = 'X'.
v_filename = p_file2.
CONCATENATE p_file2 v_filetype INTO lv_filename.
endif.

* v_filename = u_file.
* CONCATENATE u_file v_filetype INTO lv_filename.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_filename
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = ER_PA0006
FIELDNAMES = int_head
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.

ENDIF.

ENDIF.

*-------------END OF DOWNLOADED ERROR FILE-----------------------------


*--------------DISPLAY THE REPORT IN THE ALV FORMAT---------------------

IF LA_PA0006[] IS NOT INITIAL.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
* I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'P0006'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = IT_FCAT
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 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.


PERFORM FILL_EVENTS.
DATA WA_PRINT TYPE SLIS_PRINT_ALV.
WA_PRINT-reserve_lines = 2.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = IS_LAY
IT_FIELDCAT = IT_FCAT
IT_EVENTS = IT_EVENTS
IS_PRINT = WA_PRINT
TABLES
t_outtab = LA_PA0006
* 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.



*--------------END OF DISPLAY THE REPORT IN THE ALV FORMAT--------------

*&---------------------------------------------------------------------*
*& Form FILL_EVENTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FILL_EVENTS .

* TOP_OF_PAGE

CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'PRINT_DATA'.
APPEND WA_EVENTS TO IT_EVENTS.

ENDFORM. " FILL_EVENTS

*&---------------------------------------------------------------------*
*& Form PRINT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PRINT_DATA.

types: begin of TY_LIST,
typ(1) type c, " H = Header, S = Selection, A = Action
key(20) type c,
info(60) TYPE C,
end of TY_LIST.

DATA : WA_LIST TYPE TY_LIST,
IT_LIST TYPE TABLE OF TY_LIST.

data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.

ld_lines = su_records.
*-----------------------------ALV TOP-OF-PAGE-------------------

* Title
wa_header-typ = 'H'.

wa_header-info = 'ALV REPORT'.
append wa_header to It_LIST.
clear wa_header.

*1ST LINE
CLEAR WA_LIST.
clear ld_lines.
* Total No. of Records Selected
describe table LA_PA0006 lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Sucessfull Records: ' ld_linesc
into t_line separated by space.

wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND WA_HEADER TO IT_LIST.

*2ND LINE

CLEAR WA_LIST.
clear ld_lines.
clear ld_linesc.

describe table er_pa0006 lines ld_lines.
ld_linesc = ld_lines.
ld_lines = UN_RECORDS.
concatenate 'Total No. of UnSucessfull Records: ' ld_linesc
into t_line separated by space.

wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND WA_HEADER TO IT_LIST.

* ---------------------------------------------------------------

call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
IT_LIST_COMMENTARY = IT_LIST
* I_LOGO = 'EXXOVA'
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.

ENDFORM. "PRINT_DATA

*&---------------------------------------------------------------------
*
*& Form f_browse
*&---------------------------------------------------------------------

form f_browse CHANGING fc_file.
DATA: lo_gui TYPE REF TO cl_gui_frontend_services,
lv_title TYPE string,
lv_folder TYPE string,
lv_dir TYPE string.

CREATE OBJECT lo_gui.
lv_title = 'Define download location'.
lv_folder = 'C:'.
CALL METHOD lo_gui->directory_browse
EXPORTING
window_title = lv_title
initial_folder = lv_folder
CHANGING
selected_folder = lv_dir.
fc_file = lv_dir.

endform. "f_browse


*&---------------------------------------------------------------------*
*& Form INT_HEADS
*&---------------------------------------------------------------------*

FORM INT_HEADS .
int_head-Filed1 = 'PERNR'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'SUBTY'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'OBJPS'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'SPRPS'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ENDDA'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'BEGDA'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'SEQNR'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'AEDTM'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'UNAME'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'HISTO'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ITXEX'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'REFEX'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ORDEX'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ITBLD'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'PREAS'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'FLAG1'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'FLAG2'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'FLAG3'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'FLAG4'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'RESE1'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'RESE2'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'GRPVL'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ANSSA'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'NAME2'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'STRAS'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ORT01'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ORT02'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'PSTLZ'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'LAND1'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'TELNR'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ENTKM'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'WKWNG'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'BUSRT'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'LOCAT'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ADR03'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ADR04'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'STATE'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'HSNMR'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'POSTA'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'BLDNG'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'FLOOR'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'STRDS'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'ENTK2'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'COM01'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'NUM01'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'COM02'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'NUM02'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'COM03'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'NUM03'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'COM04'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'NUM04'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'COM05'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'NUM05'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'COM06'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'NUM06'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'INDRL'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'COUNC'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'RCTVC'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'OR2KK'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'CONKK'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'OR1KK'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'RAILW'.
APPEND int_head.
CLEAR int_head.

ENDFORM. " INT_HEADS

Tuesday, April 24, 2012

WORKFLOW 1st day


Business Process Automation TOOL.
Workflow is a chain (flow chat) at transactions.
Using WF, we represent the business process in a graphical format.
Benefits of Workflow :
Every Transaction can be Monitored.
            Sending Reminders to start Transactions.
            Sending Reminders to Complete Transactions.
Every Transaction done on transaction can be Documented.
è Inputs
è Comments
è Attachments.
Next Transaction to be executed is automatically identified.
Person responsible for next transaction is automatically identified.
Required data for next transaction is also passed automatically.
Support Multiple Languages.
Workflow can be used for error handling in ALV/IDOCS.

Triggering Transactions :- Source Transactions
Create PO, So, Invoice, Travel forms, Payment Run.
Change PO, So, Invoice, Travel forms, Payment Run.
Delete PO, So, Invoice, Travel forms, Payment Run.
Triggering Techniques : BADI, User Exits, Infotype, Change Document, Business Transaction, CRM Actions, Z Programs, Other Workflow, Test Tool and Utility.
Triggering Events : Used to Start Workflow.
Terminating Events : Used to  Complete the Workflow.
Step: There is Two type of steps .
1.      Foreground Step
2.      Background Step.

Foreground Step : Foreground Step  are executed by the agent.
Background Step : System could execute this step.
Standard Task and Customer task (similar to Data element) :  It Contains What is
1.      Background object
2.      Method
3.      Background
4.      Email Subject
5.      Email Body text.
Customer task is Client Dependent (800,300, 500…..).
Standard task is Client Independent (800).

There are Two Types of Workflow
1.      Workflow Template – Client Independent.
2.      Workflow Task         _ Client Dependent.

Tuesday, January 24, 2012

Day 1

BO is a 30 years old French company. BO have the following kind of tools.

1. EIM (Enterprise Information Management) : In this space BO have 2 tools.

i) BODI (Business objects data Integrator)

ii) BODS (Business objects data services) : It is a combination of BODI, Quality Services.

2. EPM (Enterprise performance Management): In this space BO have a tool called as BPC (Business objects planning & Consolidation).

3. GRC (Governance & Risk & Control ): This tool is used to generate reports for scent lies calculations.

4. BI (Business Intelligence) : This space BO have the following BI tools.

i) Web I (Web intelligence)

ii) Crystal Reports

iii) Xcelsius

iv) BI widgets

v) Voyager

BI Stands for Business Intelligence. It is an approach to collect Business Data from different data sources, Integrating into big Data source ( Data warehouse) and generate reports to simplify decision making.

R/3 => BW => BEx

Data source Integration(Data warehouse) Reporting

Non-SAP => BODI => BO


Company Name

ETL Tool

DB Tool

Reporting Tool

SAP

BW/BODS

R/3, ECC

BEx/BOBI

Oracle

ODI(Oracle Data Integrator)

ODW

SQL, PL/SQL

SIBEL Analytics

IBM

Data Stage

DB2

Cognos

Microsoft

SSIS

SQL Server

SSRS/SSAS

Available ETL Tools in the Market

1. Informatica => Informatioca Corporation

2. BW/BODS => SAP

3. Data Stage => IBM

4. JCM => Apple

5. Abentio => Abentio Corporation

6. ODW => Oracle

7. SSIS => Microsoft

Available DB tools

1. SQL/PLSQL => Oracle

2. My SQL => Apache

3. SQL Server => Microsoft

4. Sy Base => Sy Base IQ

5. Tera Data => NCR Corporation

6. NETEZZA => NETEZZA Corporation

7. DB2 => IBM


Available Reporting tools

1. JASPER => Apache

2. BOBI => SAP BO

3. Cognos => IBM

4. Micro Strategy => Micro Strategy Corporation

5. JERKING => JETKING

6. SSRS => Microsoft

7. Sieble Analytics => Oracle

Hardware & Software Requirements

1. Non-SAP BO Installation:

HDD : Minimum 5 GB Space

RAM : 512 MB

Processor : Any Processor (Celron, Pentium, ……)

OS : ALL O.S ( XP, W7,Vista, Unix,…………..)

2. SAP BI BO (Without ECC)

HDD : 20 GB

RAM : 2GB/3GB

Processor : Dualcore and Above

OS : All O.S


=> Explain me what software the developer required in their load system to create SAP BIBO Reports and what software the End-user required to access ?

In the Developer machine they need the below software

a. SAP GUI

b. Business Object (BO) Client

c. Integration Kit Between SAP BI & BO

MDX SQL

d. Crystal Reports (online) (OLTP)

e. Xcelsius (For Dash Boards)

f. Voyager

g. Widgets (For mobile Reporting)

End user need not to install any S/W, in their load system, They can access all the reports through the web by using the Infoview portal.

è Comparison between SAP & Business Objects

Report Type

SAP Tool (.BEx)

BO – Tool

Ad Hoc (Drill – Down)

BEx Analyzer

WEBi

OLTP(Transactional Reports/online)

Report Designer

Crystal Reports

Dash Boards

WAD (Web Application Designer)

Xcelsius

Portal

EP (Enterprise Portal)

Info view

ETL Tool

BW

BODS (New Version)

BODI – Older Version


Friday, December 16, 2011

Delete PM Notifications

To delete the PM Notifications, first we need to set the PM notifications to status "Complete". We can achieve the same by following steps:

  • Go to Transaction "IW28".
  • Provide the necessary information on the initial screen
  • A list of PM notifications based on the data provided earlier is displayed.
  • Select the list of PM notifications which needs to be deleted and hit the button "Complete" (Flag with Black & White check mark) or CTRL+F9.

After setting the status as complete, now we would set the deletion flag for the same. This can be achieved using the transaction "IW27".

To delete the notifications, use the archiving transaction "SARA" and the object to be used is "PM_QMEL".

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

goodsites