Append two tables data into one in MSAccess
Hi All,
I have huge data which is imported through excel sheet in to MS Access database in 2 separate tables.I want to append the 2nd tables data to the first one...how can i do that...thanks in advance
hey....i got the solution for this problem....i followed the same procedure of getting external data to MS ACCESS.After migrating all teh 6 sheets data into 6 different tables,I used the same technique to append the data into 1 single table..it worked....Thank you......
Similar Messages
-
How can i add two table data into third internal table see below
hi i insert diffferent table data into different internal table i did try to insert two different internal table data into third internal table by using move
but only single data is coming please help me
i want this two internal table data inot third internal table.
sELECT * FROM J_1IEXCHDR INTO CORRESPONDING FIELDS OF ITAB1 WHERE STATUS = 'P'.
SELECT * FROM J_1IEXCDTL INTO CORRESPONDING FIELDS OF ITAB2 WHERE LIFNR = J_1IEXCHDR-LIFNR.
AND DOCYR = J_1IEXCHDR-DOCYR,
AND DOCNO = J_1IEXCHDR-DOCNO.
WRITE: / ITAB1-LIFNR,
ITAB1-DOCNO,
ITAB1-EXYEAR,
ITAB1-BUDAT,
ITAB2-EXBED,
ITAB2-RDOC,
ITAB2-ECS.
ENDSELECT.
ENDSELECT.
thank you .hi
Two add two internal tables data. first we need to create third internal table with all the fields of first two internal tables.
later u move the two internal tables data to third internal table
by looping the internal table which have more records or depending on the requirement and move the corresponding fields of first internal table to the third internal table and use the read statement with condition based on primary key of first itab and get the corresponding data of 2table into 3table.
i am sending the sample code to u.
check it out. i think u will understand how to move.
select vbeln waerk netwr erdat audat kunnr
into table it_vbeln
from vbak
where vbeln in s_vbeln
and erdat in s_erdat.
if not it_vbeln[] is initial.
select kunnr name1
into table it_kunnr
from kna1
for all entries in it_vbeln
where kunnr = it_vbeln-kunnr.
endif.
loop at it_vbeln.
clear it_final.
it_final-vbeln = it_vbeln-vbeln.
it_final-waerk = it_vbeln-waerk.
it_final-netwr = it_vbeln-netwr.
it_final-erdat = it_vbeln-erdat.
it_final-audat = it_vbeln-audat.
read table it_kunnr with key kunnr = it_vbeln-kunnr.
it_final-name1 = it_kunnr-name1.
append it_final.
endloop. -
Download the KTOPL field data and GLT0 table data into one Internal table
Hi,
I have downloaded GLT0 table fields data to PC file . But i need to download KTOPL(Chart Of Accounts) data also. in GLT0 table there is no KTOPL field.
But in SKA1 table have KTOPL field. Then what is the issue is GLT0 data & KTOPL field data needs to download into one Internal Table.
anybody could you please solve this problem. immediately need to solve this.
Below is the code.
REPORT ZFXXEABL_1 NO STANDARD PAGE HEADING
LINE-SIZE 200.
Tables Declaration
TABLES : GLT0.
Data Declaration
DATA : FP(8) TYPE C,
YEAR LIKE GLT0-RYEAR,
PERIOD(3) TYPE C,
DBALANCE LIKE VBAP-NETWR VALUE 0 ,
CBALANCE LIKE VBAP-NETWR VALUE 0.
*Internal table for for final data..
DATA : BEGIN OF REC1 OCCURS 0,
BAL LIKE GLT0-TSLVT value 0,
COAREA LIKE GLT0-RBUSA,
CA(4) TYPE C,
KTOPL LIKE ska1-ktopl,
CCODE LIKE GLT0-BUKRS,
CREDIT LIKE VBAP-NETWR,
CURRENCY LIKE GLT0-RTCUR,
CURTYPE(2) TYPE N,
DEBIT LIKE VBAP-NETWR,
YEAR(8) TYPE C,
FY(2) TYPE C,
ACCOUNT LIKE GLT0-RACCT,
VER LIKE GLT0-RVERS,
VTYPE(2) TYPE N,
CLNT LIKE SY-MANDT,
S_SYS(3) TYPE C,
INDICATOR LIKE GLT0-DRCRK,
END OF REC1.
DATA : C(2) TYPE N,
D(2) TYPE N.
DATA REC1_H LIKE REC1.
Variable declarations
DATA :
W_FILES(4) TYPE N,
W_DEBIT LIKE GLT0-TSLVT,
W_CREDIT LIKE GLT0-TSLVT,
W_PCFILE LIKE RLGRAP-FILENAME ,
W_UNIXFILE LIKE RLGRAP-FILENAME,
W_PCFILE1 LIKE RLGRAP-FILENAME,
W_UNIXFIL1 LIKE RLGRAP-FILENAME,
W_EXT(3) TYPE C,
W_UEXT(3) TYPE C,
W_PATH LIKE RLGRAP-FILENAME,
W_UPATH LIKE RLGRAP-FILENAME,
W_FIRST(1) TYPE C VALUE 'Y',
W_CFIRST(1) TYPE C VALUE 'Y',
W_PCFIL LIKE RLGRAP-FILENAME.
DATA: "REC LIKE GLT0 OCCURS 0 WITH HEADER LINE,
T_TEMP LIKE GLT0 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF REC3 OCCURS 0.
INCLUDE STRUCTURE GLT0.
DATA: KTOPL LIKE SKA1-KTOPL,
END OF REC3.
DATA: BEGIN OF T_KTOPL OCCURS 0,
KTOPL LIKE SKA1-KTOPL,
SAKNR LIKE SKA1-SAKNR,
END OF T_KTOPL.
Download data.
DATA: BEGIN OF I_REC2 OCCURS 0,
BAL(17), " like GLT0-TSLVT value 0,
COAREA(4), " like glt0-rbusa,
CA(4), " chart of accounts
CCODE(4), " like glt0-bukrs,
CREDIT(17), " like vbap-netwr,
CURRENCY(5), " like glt0-rtcur,
CURTYPE(2), " type n,
DEBIT(17), " like vbap-netwr,
YEAR(8), " type c,
FY(2), " type c, fiscal yr variant
ACCOUNT(10), " like glt0-racct,
VER(3), " like glt0-rvers,
VTYPE(3), " type n,
CLNT(3), "like sy-mandt,
S_SYS(3), "like sy-sysid,
INDICATOR(1), " like glt0-drcrk,
END OF I_REC2.
Selection screen. *
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1.
SELECT-OPTIONS : COMPCODE FOR GLT0-BUKRS,
GLACC FOR GLT0-RACCT,
FISYEAR FOR GLT0-RYEAR,
no intervals no-extension, "- BG6661-070212
FISCPER FOR GLT0-RPMAX,
busarea for glt0-rbusa,
CURRENCY FOR GLT0-RTCUR.
SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-BL2.
PARAMETERS:
P_UNIX AS CHECKBOX, "Check box for Unix Option
P_UNFIL LIKE RLGRAP-FILENAME, " Unix file Dnload file name
default '/var/opt/arch/extract/GLT0.ASC', "- BG6661-070212
P_PCFILE AS CHECKBOX, "Check box for Local PC download.
P_PCFIL LIKE RLGRAP-FILENAME " PC file Dnload file name
default 'C:\GLT0.ASC'. "- BG6661-070212
DEFAULT 'C:\glt0_gl_balance_all.asc'. "+ BG6661-070212
SELECTION-SCREEN END OF BLOCK BL2.
*eject
Initialization. *
INITIALIZATION.
Try to default download filename
p_pcfil = c_pcfile.
p_unfil = c_unixfile.
if sy-sysid eq c_n01.
p_unfil = c_unixfile.
endif.
if sy-sysid eq c_g21.
p_unfil = c_g21_unixfile.
endif.
if sy-sysid eq c_g9d.
p_unfil = c_g9d_unixfile.
endif.
Default for download filename
*{ Begin of BG6661-070212
CONCATENATE C_UNIXFILE
SY-SYSID C_FSLASH C_CHRON C_FILENAME INTO P_UNFIL.
*} End of BG6661-070212
AT SELECTION-SCREEN OUTPUT.
loop at screen.
if screen-name = 'P_PCFIL'. "PC FILE
screen-input = '0'.
modify screen.
endif.
if screen-name = 'P_UNFIL'. "UN FILE
screen-input = '0'.
modify screen.
endif.
endloop.
if w_first = 'Y'.
perform path_file.
w_first = 'N'.
endif.
if w_cfirst = 'Y'.
perform cpath_file.
w_cfirst = 'N'.
endif.
Start-of-Selection. *
START-OF-SELECTION.
*COLLECT DATA
PERFORM COLLECT_DATA.
*BUILD FILENAMES
PERFORM BUILD_FILES.
*LOCAL
IF P_PCFILE = C_YES.
PERFORM LOCAL_DOWNLOAD.
ENDIF.
*UNIX
IF P_UNIX = C_YES.
PERFORM UNIX_DOWNLOAD.
ENDIF.
IF P_PCFILE IS INITIAL AND P_UNIX IS INITIAL.
MESSAGE I000(ZL) WITH 'Down load flags both are unchecked'.
ENDIF.
END-OF-SELECTION.
IF P_PCFILE = C_YES.
WRITE :/ 'PC File' , C_UNDER, P_PCFIL.
ENDIF.
*& Form DOWNLOAD
Download *
FORM DOWNLOAD.
P_PCFIL = W_PATH.
DATA LIN TYPE I.
DESCRIBE TABLE I_REC2 LINES LIN.
WRITE:/ 'No of Records downloaded = ',LIN.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = P_PCFIL
FILETYPE = C_ASC "c_dat "dat
TABLES
DATA_TAB = I_REC2 " t_str
fieldnames = t_strhd
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
ENDIF.
ENDFORM.
*& Form WRITE_TO_SERVER
text *
--> p1 text
<-- p2 text
FORM WRITE_TO_SERVER.
DATA : L_MSG(100) TYPE C,
L_LINE(5000) TYPE C.
P_UNFIL = W_UPATH.
DATA LIN TYPE I.
DESCRIBE TABLE I_REC2 LINES LIN.
WRITE:/ 'No of Records downloaded = ',LIN.
OPEN DATASET P_UNFIL FOR OUTPUT IN TEXT MODE. " message l_msg.
IF SY-SUBRC <> 0.
WRITE: / L_MSG.
ENDIF.
perform header_text1.
LOOP AT I_REC2.
TRANSFER I_REC2 TO P_UNFIL.
ENDLOOP.
CLOSE DATASET P_UNFIL.
WRITE : / C_TEXT , W_UPATH.
SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
CLEAR W_UPATH.
IF NOT W_UEXT IS INITIAL.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ELSE.
W_UEXT = C_ASC. " c_csv.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ENDIF.
ENDFORM. " WRITE_TO_SERVER
*& Form BUILD_FILES
FORM BUILD_FILES.
IF P_PCFILE = C_YES.
W_PCFILE = P_PCFIL.
***Split path at dot**
SPLIT W_PCFILE AT C_DOT INTO W_PCFILE1 W_EXT.
IF NOT W_EXT IS INITIAL.
CONCATENATE W_PCFILE1 C_DOT W_EXT INTO W_PATH.
ELSE.
W_PATH = W_PCFILE1.
ENDIF.
ENDIF.
IF P_UNIX = C_YES.
W_UNIXFILE = P_UNFIL.
SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
IF NOT W_UEXT IS INITIAL.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ELSE.
W_UPATH = W_UNIXFIL1.
ENDIF.
ENDIF.
ENDFORM.
FORM CPATH_FILE.
CLEAR P_PCFIL.
CONCATENATE C_PCFILE
C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
C_DOT C_ASC INTO P_PCFIL.
ENDFORM. " CPATH_FILE
FORM PATH_FILE.
CLEAR P_UNFIL.
if sy-sysid eq c_n01.
CONCATENATE C_UNIXFILE
C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
C_DOT C_ASC INTO P_UNFIL.
endif.
if sy-sysid eq c_g21.
concatenate c_g21_unixfile
c_comfile sy-sysid c_under sy-datum sy-uzeit
c_dot c_asc into p_unfil.
endif.
if sy-sysid eq c_g9d.
concatenate c_g9d_unixfile
c_comfile sy-sysid c_under sy-datum sy-uzeit
c_dot c_asc into p_unfil.
endif.
ENDFORM. " PATH_FILE
Local_Download *
Local *
FORM LOCAL_DOWNLOAD.
perform header_text.
LOOP AT REC1.
REC1-CLNT = SY-MANDT.
REC1-S_SYS = SY-SYSID.
MOVE: REC1-BAL TO I_REC2-BAL,
REC1-COAREA TO I_REC2-COAREA,
REC1-CA TO I_REC2-CA,
REC1-KTOPL TO I_REC2-CA,
REC1-CCODE TO I_REC2-CCODE,
REC1-CREDIT TO I_REC2-CREDIT,
REC1-CURRENCY TO I_REC2-CURRENCY,
REC1-CURTYPE TO I_REC2-CURTYPE,
REC1-DEBIT TO I_REC2-DEBIT,
REC1-YEAR TO I_REC2-YEAR,
REC1-FY TO I_REC2-FY,
REC1-ACCOUNT TO I_REC2-ACCOUNT,
REC1-VER TO I_REC2-VER,
REC1-VTYPE TO I_REC2-VTYPE,
REC1-CLNT TO I_REC2-CLNT,
REC1-S_SYS TO I_REC2-S_SYS,
REC1-INDICATOR TO I_REC2-INDICATOR.
APPEND I_REC2.
CLEAR I_REC2.
ENDLOOP.
IF NOT I_REC2[] IS INITIAL.
PERFORM DOWNLOAD .
CLEAR I_REC2.
REFRESH I_REC2.
ELSE.
WRITE : / ' no record exist due to unavailability of data'.
ENDIF.
ENDFORM. " LOCAL_DOWNLOAD
*& Form UNIX_DOWNLOAD
FORM UNIX_DOWNLOAD.
LOOP AT REC1.
REC1-CLNT = SY-MANDT.
REC1-S_SYS = SY-SYSID.
MOVE: REC1-BAL TO I_REC2-BAL,
REC1-COAREA TO I_REC2-COAREA,
REC1-CA TO I_REC2-CA,
REC1-KTOPL TO I_REC2-CA,
REC1-CCODE TO I_REC2-CCODE,
REC1-CREDIT TO I_REC2-CREDIT,
REC1-CURRENCY TO I_REC2-CURRENCY,
REC1-CURTYPE TO I_REC2-CURTYPE,
REC1-DEBIT TO I_REC2-DEBIT,
REC1-YEAR TO I_REC2-YEAR,
REC1-FY TO I_REC2-FY,
REC1-ACCOUNT TO I_REC2-ACCOUNT,
REC1-VER TO I_REC2-VER,
REC1-VTYPE TO I_REC2-VTYPE,
SY-MANDT TO I_REC2-CLNT,
SY-SYSID TO I_REC2-S_SYS,
REC1-INDICATOR TO I_REC2-INDICATOR.
APPEND I_REC2.
CLEAR I_REC2.
ENDLOOP.
IF NOT I_REC2[] IS INITIAL.
PERFORM WRITE_TO_SERVER.
CLEAR I_REC2.
REFRESH I_REC2.
ELSE.
WRITE : / ' no record exist due to unavailability of data'.
ENDIF.
ENDFORM. " UNIX_DOWNLOAD
*& Form HEADER_TEXT
text *
--> p1 text
<-- p2 text
*form header_text.
concatenate c_bal c_ba c_ca c_cc c_credit c_currency c_curtype
c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
into t_strhd
separated by c_comma.
append t_strhd.
*endform. " HEADER_TEXT
*& Form HEADER_TEXT1
text *
*form header_text1.
concatenate c_bal c_ba c_ca c_cc c_credit c_currency c_curtype
c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
into t_strhd1
separated by c_comma.
append t_strhd1.
transfer t_strhd1 to p_unfil.
*endform. " HEADER_TEXT1
*& Form COLLECT_DATA
Collect Data *
FORM COLLECT_DATA.
SELECT * FROM GLT0 INTO TABLE REC3
WHERE BUKRS IN COMPCODE
AND RYEAR IN FISYEAR
AND RPMAX IN FISCPER
AND RACCT IN GLACC
AND RTCUR IN CURRENCY.
SELECT KTOPL FROM SKA1
INTO TABLE T_KTOPL
FOR ALL ENTRIES IN REC3
WHERE SAKNR = REC3-RACCT.
LOOP AT REC3 .
select *
from glt0
into table t_temp
where rldnr = rec-rldnr
and rrcty = rec-rrcty
and rvers = rec-rvers
and bukrs = rec-bukrs
and ryear = rec-ryear
and racct = rec-racct
and rbusa = rec-rbusa
and rtcur <> 'ZAR'
and rpmax = rec-rpmax.
if sy-subrc = 0.
rec1-bal = '0.00'.
else.
rec1-bal = rec-hslvt.
endif.
*READ TABLE T_KTOPL WITH KEY SAKNR = REC-RACCT BINARY SEARCH.
MOVE T_KTOPL-KTOPL TO REC3-KTOPL.
CLEAR: CBALANCE, DBALANCE.
REC1-BAL = REC3-HSLVT.
IF REC3-DRCRK = 'S'.
IF REC3-HSLVT NE C_ZERO.
YEAR = REC-RYEAR.
PERIOD = '000'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC-DRCRK.
REC1-DEBIT = C_ZERO.
REC1-CREDIT = C_ZERO.
REC1-CCODE = REC-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC-RTCUR.
REC1-ACCOUNT = REC-RACCT.
rec1-bal = rec-hslvt.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC-RBUSA.
REC1-VER = REC-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART.
APPEND REC1.
C = 0.
PERFORM D.
ENDIF.
IF REC3-HSL01 NE C_ZERO.
YEAR = REC3-RYEAR.
PERIOD = '001'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL01 .
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl01 + dbalance.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART.
REC1-KTOPL = REC3-KTOPL.
APPEND REC1.
C = 1.
PERFORM D.
ENDIF.
IF REC3-HSL02 NE C_ZERO.
REC1-DEBIT = REC3-HSL02.
YEAR = REC3-RYEAR.
PERIOD = '002'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL02.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl02 + dbalance.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
C = 2.
PERFORM D.
ENDIF.
IF REC3-HSL03 NE C_ZERO.
YEAR = REC3-RYEAR.
PERIOD = '003'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL03.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl03 + dbalance .
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
C = 3.
PERFORM D.
ENDIF.
IF REC3-HSL04 NE C_ZERO.
REC1-DEBIT = REC3-HSL04.
YEAR = REC3-RYEAR.
PERIOD = '004'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL04.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl04 + dbalance .
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
dbalance = rec1-bal.
C = 4.
PERFORM D.
ENDIF.
Thanks and Regards,
Ramuse logical database SDF, nodes ska1 and skc1c
A. -
Two internal tables data into one
Hello Gurus,
I have data in two internal tables. One table IT_A contains the fields -
MATNR - SALES ORG - DCHANNEL - STATUS - DESCRIPTION
The other table IT_B contains the fields -
CUSTOMER - SALES ORG.
I need to display the result of all the fields when the sales org of both the tables are equal. i.e IT_A-VKORG = IT_B-VTORG.
MATNR - SALES ORG - DCHANNEL - STATUS - DESCRIPTION.
Please help me out with the code to be written.
Regards,
BaluTABLES : MVKE, CAUFVD, TVMST.
TYPES : BEGIN OF T_MVKE,
MATNR TYPE MVKE-MATNR,
VKORG TYPE MVKE-VKORG,
VTWEG TYPE MVKE-VTWEG,
VMSTA TYPE MVKE-VMSTA,
VMSTB TYPE TVMST-VMSTB,
END OF T_MVKE.
DATA : LT_MVKE TYPE STANDARD TABLE OF T_MVKE WITH HEADER LINE,
LS_MVKE TYPE T_MVKE.
DATA : LT1_MVKE TYPE STANDARD TABLE OF T_MVKE WITH HEADER LINE,
LS1_MVKE TYPE T_MVKE.
DATA : LT2_MVKE TYPE STANDARD TABLE OF T_MVKE WITH HEADER LINE,
LS2_MVKE TYPE T_MVKE.
TYPES : BEGIN OF T_KNVP,
KUNNR TYPE KNVP-KUNNR,
VKORG TYPE KNVP-VKORG,
END OF T_KNVP.
DATA : LT_KNVP TYPE STANDARD TABLE OF T_KNVP WITH HEADER LINE,
LS_KNVP TYPE T_KNVP.
SELECT-OPTIONS S_MATNR FOR MVKE-MATNR.
PARAMETER : P_KUNNR TYPE KNVP-KUNNR .
START-OF-SELECTION.
SELECT MATNR VKORG VTWEG VMSTA FROM MVKE INTO TABLE LT_MVKE WHERE MATNR IN S_MATNR .
IF SY-SUBRC = 0.
APPEND LT_MVKE.
ELSE.
EXIT.
ENDIF.
SELECT DISTINCT KUNNR VKORG FROM KNVP INTO TABLE LT_KNVP WHERE KUNNR = P_KUNNR.
IF SY-SUBRC = 0.
APPEND LT_KNVP.
ELSE.
EXIT.
ENDIF.
LOOP AT LT_MVKE.
LT1_MVKE-MATNR = LT_MVKE-MATNR.
LT1_MVKE-VKORG = LT_MVKE-VKORG.
LT1_MVKE-VTWEG = LT_MVKE-VTWEG.
LT1_MVKE-VMSTA = LT_MVKE-VMSTA.
SELECT SINGLE VMSTB FROM TVMST INTO LT1_MVKE-VMSTB WHERE VMSTA = LT_MVKE-VMSTA AND SPRAS = SYST-LANGU.
APPEND LT1_MVKE.
CLEAR LT1_MVKE.
ENDLOOP.
LOOP AT LT1_MVKE.
IF NOT LT_KNVP[] is INITIAL.
READ TABLE LT_KNVP WITH KEY VKORG = LT1_MVKE-VKORG BINARY SEARCH TRANSPORTING NO FIELDS.
IF SY-SUBRC = 0.
APPEND LT1_MVKE TO LT2_MVKE.
ELSE.
APPEND LT1_MVKE TO LT2_MVKE.
MESSAGE S003.
ENDIF.
CLEAR LT1_MVKE.
ELSE. "IF LT_KNVP[] IS INITIAL.
APPEND LT1_MVKE TO LT2_MVKE.
ENDIF.
ENDLOOP.
WRITE: /1 'MATERIAL NUMBER', 20 'SALES ORG', 35 'DISTRIBUTION CHANNEL', 65 'MATERIAL STATUS', 85 'STATUS DESCRIPTION'.
LOOP AT LT2_MVKE.
FORMAT HOTSPOT ON.
WRITE: /1 LT2_MVKE-MATNR, 20 LT2_MVKE-VKORG, 35 LT2_MVKE-VTWEG, 65 LT2_MVKE-VMSTA, 85 LT2_MVKE-VMSTB.
HIDE: LT2_MVKE-MATNR, LT2_MVKE-VKORG, LT2_MVKE-VTWEG, LT2_MVKE-VMSTA, LT2_MVKE-VMSTB.
CLEAR LT2_MVKE.
FORMAT HOTSPOT OFF.
ENDLOOP.
AT LINE-SELECTION.
IF LT2_MVKE-VMSTA = ' '.
MESSAGE E002.
ELSE.
SET PARAMETER ID 'MAT' FIELD LT2_MVKE-MATNR.
CALL TRANSACTION 'CO09'.
DATA WERKS(4) TYPE C VALUE '1200'.
SET PARAMETER ID 'WRK' FIELD WERKS.
DATA RULE(2) TYPE C VALUE 'ZB'.
SET PARAMETER ID 'PRR' FIELD RULE.
SET PARAMETER ID 'X' FIELD CAUFVD-PRMBD.
ENDIF.
Hello gurus,
The above code is working fine when I give both Material and customer in the select options. But it is not doing anything when I enter only the material.
Please help.
Regards,
Balu -
Loading data from two flat files into one table
Hi All,
I want to load few fields from one file and few fields from another file and load the data into one table in the database.
For Ex: I have two flat files file1.csv and file2.csv and file1.csv containes 25 columns and file2.csv containes 12 columns, i want to load 20 columns from file1.csv and 7 columns from file2.csv into the table
how to combine the columns from both the files and load them into one table at a time?
Any help is appriciated
Thanks
R.GUse external tables.
If using Oracle9 or higher connect both your csv with database as separate external tables and load the requited fields in new/requited table. -
How to insert one table data into multiple tables by using procedure?
How to insert one table data into multiple tables by using procedure?
Below is the simple procedure. Try the below
CREATE OR REPLACE PROCEDURE test_proc
AS
BEGIN
INSERT ALL
INTO emp_test1
INTO emp_test2
SELECT * FROM emp;
END;
If you want more examples you can refer below link
multi-table inserts in oracle 9i
Message was edited by: 000000 -
Load Table Data into Excel Specific range
Hi,
I am working with Excel Destination in SSIS, where i have to insert table data into multiple excel sheets with specific range, sheet name same as table name and i should load each table into that particular sheet name in excel.
So Sheet name will decide at run time and i have created one variable to pass complete sheet name (like [DimAge$A16:R1000]) in excel destination, but it is throwing error Here i am facing two complexities
1)Getting error while passing excel sheet name as variable
2) How to insert into excel in specific range of values shown as above.
Ur help in solving this would be appreciatedHi Naveen,
Based on my research, a worksheet or range is the equivalent of a table or view in Excel. The lists of available tables in the Excel Source and Destination editors display only existing worksheets (identified by the $ sign appended to the worksheet name,
such as Sheet1$) and named ranges (identified by the absence of the $ sign, such as MyRange).
So when you use a variable with [DimAge$A16:R1000] or [Select * from DimAge!A$16:R$1000] value in the Excel Destination, the value acts as a worksheet or range name. But there is no such worksheet or range in the excel file, so the error message occurs.
To fix this issue, please select the cell range in your excel sheet, then right-click the range to define a name for the range to create some ranges with the specific ranges in excel file, then in the "Name of the Excel Sheet" drop down box of
"Excel Destination Editor" you can see that Named range. Then simply select the range from the drop-down list or use a variable with the range name as the Excel Destination.
For more information about how to import data to Excel sheet's specific region, please refer to the following blog:
http://getsetsql.blogspot.in/2012/01/using-ssis-load-data-to-excel-sheet-at.html
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support -
Problem in converting table data into CSV file
Hi All,
In my Process i need to convert my error table data into csv file,my data is converted as csv file by using OdisqlUnload function,but the column headers are not converted,i use another procedure for converting column headers but iam getting below error ...
com.sunopsis.sql.SnpsMissingParametersException: Missing parameter string.find, string.find
SQL: import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+') myStmt = sourceConnection.createStatement() my_query = "select * FROM E$_LOCAL_F0911Z1" my_query=my_query.upper() if string.find(my_query, '*') > 0: myRs = myStmt.executeQuery(my_query) md=myRs.getMetaData() collect=[] i=1 while (i <= md.getColumnCount()): collect.append(md.getColumnName(i)) i += 1 header=','.join(map(string.strip, collect)) elif string.find(my_query,'||') > 0: header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',') else: header = my_query[7:string.find(my_query, 'FROM')] print header old=output_write.read() output_write.seek(0) output_write.write (header+'\n'+old) sourceConnection.close() output_write.close()
And i used below code for converting.......
import string
import java.sql as sql
import java.lang as lang
import re
sourceConnection = odiRef.getJDBCConnection("SRC")
output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+')
myStmt = sourceConnection.createStatement()
my_query = "select FROM E$_COMPANY"*
*my_query=my_query.upper()*
*if string.find(my_query, '*') > 0:*
*myRs = myStmt.executeQuery(my_query)*
*md=myRs.getMetaData()*
*collect=[]*
*i=1*
*while (i <= md.getColumnCount()):*
*collect.append(md.getColumnName(i))*
*i += 1*
*header=','.join(map(string.strip, collect))*
*elif string.find(my_query,'||') > 0:*
*header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')*
*else:*
*header = my_query[7:string.find(my_query, 'FROM')]*
*print header*
*old=output_write.read()*
*output_write.seek(0)*
*output_write.write (header+'\n'+old)*
*sourceConnection.close()*
*output_write.close()*
Any one can you help regarding this
Edited by: 30021986 on Oct 1, 2012 6:04 PMThis may not be an option for you but in pinch you may want to consider outputing your data to an MS Spreadsheet, then saving it as a CSV. It's somewhat of a cumbersome process, but it will get you by for now.
You will need to change your content type to application/vnd.ms-excel.
<% response.setContentType("application/vnd.ms-excel"); %> -
Reg: Combining two display lists into one list
Dear All,
i want to combine two display lists into one display list. Please give the idea for this one issue.
*****************dispaly list 1 starting here*********************
*& Form F_006_DISPLAY_LIST
* text
* --> p1 text
* <-- p2 text
FORM F_006_DISPLAY_LIST.
* TABLES : LFA1 .
DATA : V_DEBIT_TOTAL TYPE P DECIMALS 2 ,
V_CREDIT_TOTAL TYPE P DECIMALS 2 ,
V_CLOSE_BAL TYPE P DECIMALS 2 .
DATA : V_CNT TYPE I .
SORT ITAB_OPG BY LIFNR.
LOOP AT ITAB_OPG.
NEW-PAGE.
* Displaying Vendor Name
SELECT SINGLE NAME1 FROM LFA1 INTO LFA1-NAME1 WHERE
LIFNR EQ ITAB_OPG-LIFNR .
FORMAT COLOR COL_POSITIVE INTENSIFIED ON.
WRITE:/2 'Vendor Code:' ,
ITAB_OPG-LIFNR ,
40 LFA1-NAME1 .
CLEAR : LFA1 .
WRITE :/(190) SY-ULINE .
* Displaying Opening Balance
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .
READ TABLE ITAB_OPG WITH KEY LIFNR = ITAB_OPG-LIFNR .
IF ITAB_OPG-BAL LE 0 .
WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
171(18) ITAB_OPG-BAL .
ELSE.
WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
151(18) ITAB_OPG-BAL .
ENDIF.
WRITE :/(190) SY-ULINE .
* Displaying Line Items
LOOP AT ITAB_DISPLAY WHERE LIFNR EQ ITAB_OPG-LIFNR.
V_CNT = SY-TABIX MOD 2.
IF V_CNT EQ 0.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ELSE.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
ENDIF.
* Selecting Bank Name and Cheque Number
SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)
FROM PAYR WHERE
ZBUKR EQ P_BUKRS AND
VBLNR EQ ITAB_DISPLAY-BELNR AND
LIFNR EQ ITAB_DISPLAY-LIFNR .
SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM
T012 WHERE BUKRS EQ P_BUKRS AND
HBKID EQ PAYR-HBKID.
SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE
BANKS EQ T012-BANKS AND
BANKL EQ T012-BANKL .
WRITE :/2 ITAB_DISPLAY-BUDAT ,
14 ITAB_DISPLAY-BELNR ,
26 ITAB_DISPLAY-BLDAT ,
40 ITAB_DISPLAY-XBLNR ,
58(16) PAYR-CHECT ,
75 BNKA-BANKA ,
105(40) ITAB_DISPLAY-SGTXT ,
146(4) ITAB_DISPLAY-BLART .
* Determinig Debit or Credit
IF ITAB_DISPLAY-SHKZG EQ 'S'.
V_DEBIT_TOTAL = V_DEBIT_TOTAL + ITAB_DISPLAY-DMBTR.
WRITE:151(18) ITAB_DISPLAY-DMBTR ,
171(18) SPACE .
ELSEIF ITAB_DISPLAY-SHKZG EQ 'H'.
V_CREDIT_TOTAL = V_CREDIT_TOTAL + ITAB_DISPLAY-DMBTR.
WRITE:151(18) SPACE ,
171(18) ITAB_DISPLAY-DMBTR .
ENDIF.
CLEAR : T012 , BNKA , PAYR .
ENDLOOP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/(190) SY-ULINE.
* Displaying Debit and Credit Totals
WRITE:/125 TEXT-001 ,
151(18) V_DEBIT_TOTAL ,
171(18) V_CREDIT_TOTAL .
WRITE:/(190) SY-ULINE.
* Displaying the Closing Balance
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
V_CLOSE_BAL = ITAB_OPG-BAL + V_DEBIT_TOTAL - V_CREDIT_TOTAL .
IF V_CLOSE_BAL GT 0.
WRITE:/122 TEXT-002 ,
151(18) V_CLOSE_BAL NO-SIGN. " D00K909674
ELSEIF V_CLOSE_BAL LE 0.
WRITE:/122 TEXT-002 ,
171(18) V_CLOSE_BAL NO-SIGN. " D00K909674
ENDIF.
CLEAR : V_CLOSE_BAL.
ENDLOOP.
ENDFORM. " F_006_DISPLAY_LIST
*****************dispaly list 1 ending here*********************
*****************dispaly list 2 starting here*********************
*& Form F_006_DISPLAY_LIST1
* text
* --> p1 text
* <-- p2 text
FORM F_006_DISPLAY_LIST1 .
TABLES : KNA1 .
DATA : V_DEBIT_TOTAL1 TYPE P DECIMALS 2 ,
V_CREDIT_TOTAL1 TYPE P DECIMALS 2 ,
V_CLOSE_BAL1 TYPE P DECIMALS 2 .
DATA : V_CNT1 TYPE I .
SORT ITAB_OPG1 BY KUNNR.
LOOP AT ITAB_OPG1.
NEW-PAGE.
* Displaying Vendor Name
SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1 WHERE
KUNNR EQ ITAB_OPG1-KUNNR .
FORMAT COLOR COL_POSITIVE INTENSIFIED ON.
WRITE:/2 'Customer Code:' ,
ITAB_OPG1-KUNNR ,
40 KNA1-NAME1 .
CLEAR : KNA1 .
WRITE :/(190) SY-ULINE .
* Displaying Opening Balance
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .
READ TABLE ITAB_OPG1 WITH KEY KUNNR = ITAB_OPG1-KUNNR .
IF ITAB_OPG1-BAL1 LE 0 .
WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
171(18) ITAB_OPG1-BAL1 .
ELSE.
WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
151(18) ITAB_OPG1-BAL1 .
ENDIF.
WRITE :/(190) SY-ULINE .
* Displaying Line Items
LOOP AT ITAB_DISPLAY1 WHERE KUNNR EQ ITAB_OPG1-KUNNR.
V_CNT1 = SY-TABIX MOD 2.
IF V_CNT1 EQ 0.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ELSE.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
ENDIF.
* Selecting Bank Name and Cheque Number
SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)
FROM PAYR WHERE
ZBUKR EQ P_BUKRS AND
VBLNR EQ ITAB_DISPLAY1-BELNR AND
KUNNR EQ ITAB_DISPLAY1-KUNNR .
SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM
T012 WHERE BUKRS EQ P_BUKRS AND
HBKID EQ PAYR-HBKID.
SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE
BANKS EQ T012-BANKS AND
BANKL EQ T012-BANKL .
WRITE :/2 ITAB_DISPLAY1-BUDAT ,
14 ITAB_DISPLAY1-BELNR ,
26 ITAB_DISPLAY1-BLDAT ,
40 ITAB_DISPLAY1-XBLNR ,
58(16) PAYR-CHECT ,
75 BNKA-BANKA ,
105(40) ITAB_DISPLAY1-SGTXT ,
146(4) ITAB_DISPLAY1-BLART .
* Determinig Debit or Credit
IF ITAB_DISPLAY1-SHKZG EQ 'S'.
V_DEBIT_TOTAL1 = V_DEBIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.
WRITE:151(18) ITAB_DISPLAY1-DMBTR ,
171(18) SPACE .
ELSEIF ITAB_DISPLAY1-SHKZG EQ 'H'.
V_CREDIT_TOTAL1 = V_CREDIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.
WRITE:151(18) SPACE ,
171(18) ITAB_DISPLAY1-DMBTR .
ENDIF.
CLEAR : T012 , BNKA , PAYR .
ENDLOOP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/(190) SY-ULINE.
* Displaying Debit and Credit Totals
WRITE:/125 TEXT-001 ,
151(18) V_DEBIT_TOTAL1,
171(18) V_CREDIT_TOTAL1 .
WRITE:/(190) SY-ULINE.
* Displaying the Closing Balance
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
V_CLOSE_BAL1 = ITAB_OPG1-BAL1 + V_DEBIT_TOTAL1 - V_CREDIT_TOTAL1 .
IF V_CLOSE_BAL1 GT 0.
WRITE:/122 TEXT-002 ,
151(18) V_CLOSE_BAL1 NO-SIGN. " D00K909674
ELSEIF V_CLOSE_BAL1 LE 0.
WRITE:/122 TEXT-002 ,
171(18) V_CLOSE_BAL1 NO-SIGN. " D00K909674
ENDIF.
CLEAR : V_CLOSE_BAL1.
ENDLOOP.
ENDFORM. " F_006_DISPLAY_LIST1
*****************dispaly list 2 ending here*********************
Thanks,
Sankar MHi,
Can you post it as two halves ?
Regards,
Swarna Munukoti -
How to comapare two tables data difference
Hi all,
Can any one tell me how to compare two tables data of two different data bases .
Table names are same in both databases.
Thanks You
Regards,
P Prakash833560 wrote:
I don't have privilege to create data base link ,If the database has no link so that you can query the the data, you have two options.
Find someone with the privilege to create the link and write a query like this
Re: Efficient way to comapre two tables.
Which as I mention may not be quick,
Kindly tell me some other way .But will be quicker than your other option which is to dump the data into two spreadsheets and start reading. -
How to add the records of 2 internal table records into one file
hello experts,
My scenario is...
I am retrieving the data for the for the credit, debit and trailer records of the customer into 3 different internal tables and finally i have to append all those records into one file first debit records then credit records finally the trailer record.... how to do that can anyone give some idea plzzzzzzzzz..
Plz its bit urgent..
Thanks a lot for your anticipation
SRIHello,
Do like this.
" Assume u have three itab.
"Itab1 - debit
"Itab2 - credit
"Itab3 - Credit.
REPORT ZV_TEST_SERVER .
*PARAMETERS: P_FILE TYPE STRING."RLGRAP-FILENAME.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB1
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB2 " Check here
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB3 " Check here
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
If useful reward.
Vasanth -
Writing a stored procedure to import SQL Server table data into a Oracle table
Hello,
As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
I started to write it based on what I have but I know this is not correct :/
# Here is the select statement for the data source in SQL Server...
SELECT COMPANY
,CUSTOMER
,TRANS_TYPE
,INVOICE
,TRANS_DATE
,STATUS
,TRAN_AMT
,CREDIT_AMT
,APPLD_AMT
,ADJ_AMT
,TRANS_USER1
,PROCESS_LEVEL
,DESCRIPTION
,DUE_DATE
,OUR_DATE
,OUR_TIME
,PROCESS_FLAG
,ERROR_DESCRIPTION
FROM data_source_table_name
#It loads data into the table in Oracle....
Insert into oracle_destination_table_name (
COMPANY,
CUSTOMER,
TRANS_TYPE,
INVOICE,
TRANS_DATE,
STATUS,
TRANS_AMT,
CREDIT_AMT,
APPLD_AMT,
ADJ_AMT,
TRANS_USER1,
PROCESS_LEVEL,
DESCRIPTION,
DUE_DATE,
OUR_DATE,
OUR_TIME,
PROCESS_FLAG,
ERROR_DESCRIPTION)
END;CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
DATABASE LINK
Personally, I'd just load the data over a database link:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_table@mssql_db_link
As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
(most likely you'll need to use an ODBC driver)
EXTERNAL TABLE
If the data from MS-SQL is in a CSV file, just use and external table.
same concept:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_external_table
MK -
How to get the plsql table data into output cursor
Hi,
Could anybody please help me.
Below is an example of the scenario..
CREATE OR REPLACE PACKAGE chck IS
PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR);
TYPE get_rec is record (ename varchar2(20),
eno number(12));
TYPE t_recs IS TABLE OF get_rec INDEX BY BINARY_INTEGER;
emp_tab t_recs;
END chck;
CREATE OR REPLACE PACKAGE BODY chck AS
PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR)
is
BEGIN
select ename, eno
bulk collect into emp_tab
from emp;
open oc_result_cursor for select * from table(emp_tab); -- I believe something is wrong here ....
END;
END chck;
the above package is giving me an error:
LINE/COL ERROR
10/29 PL/SQL: SQL Statement ignored
10/43 PL/SQL: ORA-22905: cannot access rows from a non-nested table
item
let me know what needs to be changed
Thanks
Manjumanjukn wrote:
once i get the data into a plsql table, how to get this plsql table data into the cursor?There is no such thing as a PL/SQL table - it is an array.
It is nothing at all like a table. It cannot be indexed, partitioned, cluster, etc. It does not exist in the SQL engine as an object that can be referenced. It resides in expensive PGA memory and needs to be copied (lock, stock and barrel) to the SQL engine as a bind variable.
It is an extremely primitive structure - and should never be confused as being just like a table.
Its use in SQL statements is also an exception to the rule. Sound and valid technical reasons need to justify why one want to push a PL/SQL array to the SQL engine to run SELECT 's against it. -
How to Append two word documents into single using java
How to Append two word documents into single using java
we tried this but it's not append the one word document to other
source code:public class AppendTwoWordFiles {
public static void main(String []arg)throws IOException
FileInputStream fi=null;
FileOutputStream fo=null;
try {
System.out.println("Enter the source file name u want to append");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
File f1=new File(br.readLine().toString());
System.out.println("Enter the Destination file name ");
File f2=new File(br.readLine().toString());
fi = new FileInputStream(f1);
fo = new FileOutputStream(f2,true);
byte b[]=new byte[2];
while((fi.read(b))!=-1);
fo.write(b);
System.out.println("Successfully append the file");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
finally{
fi.close();
fo.close();
plz reply me quickly ,,,what can i followUse this code ..
and give the path of the both file like this.....
source file ---- C:/workspace/Practice/src/com/moksha/ws/test/practice.text
destination file ---- C:/workspace/City/src/com/moksha/ws/test/practice1.text
import java.io.*;
public class AppendTwoWordFiles {
public static void main(String[] arg) throws IOException {
FileInputStream fi = null;
FileOutputStream fo = null;
try {
System.out.println("Enter the source file name u want to append");
BufferedReader br = new BufferedReader(new InputStreamReader(
System.in));
File f1 = new File(br.readLine().toString());
System.out.println("Enter the Destination file name ");
File f2 = new File(br.readLine().toString());
fi = new FileInputStream(f1);
fo = new FileOutputStream(f2, true);
byte b[] = new byte[2];
int len = 0;
while ((len = fi.read(b)) > 0) {
fo.write(b, 0, len);
System.out.println("Successfully append the file");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
fi.close();
fo.close();
} -
How to merge two storage drives into one partition-help
THis is on an iPad-Please excuse for any typos
I Am working on a project of restoring a macbook pro from old parts that I found. It works!!! But the HDD that i salvadged is ancient and gets about .15 MBPS. Not good. Its an apple certified and apple branded toshiba HDD-500G at 5400RPM. Yeah. *****
I am considering buying a new hard drive as a 480GB SSD, and using OWC's Data doubler, adding a second HDD, for all the photos and vids i will be collecting through my work in video and photo. I am considering getting an SSHD (SSD+HDD in an SSD form factor) and using this as the second drive. its not much more expensive (like 10$ more) and itgetsme semi-SSD like performance on a mass scale of storage.
HOw can I combine these two drives into ONE partition? 480GB will take awhile to fill up, but this is a future proof wall to use.
I Will eventually invest in an external storage option (2-3 HDDS in one caddy for backups and storing 1080p video all under one roof. depends if the board im using actually has thunderbolt or usb that is fast enough-because of the crappy hdd i cant get it to boot into an OS or go through usb recovery without it freezing. I ahve tried re-applying thermal paste, still doesnt help)
HOw can i easily partition these two drives into one?
also, my friend needs a new HDD because bootup times in his macbook pro are at like 2 mins+ and hes running Core 2 Duo, with 8 G ram and 10.9 (Mav) should i recommend an SSHD or an ssd. (He doesnt want an HDD, hes had bad 'voodoo' with em'. Thanks!nithya_ram wrote:
Give me d source code for merging two img files into one img file\\
If you want someone to do your work for you, simply pay someone. However, if you have a question about code you're currently working on, feel free to ask a specific question here on the forum.
Maybe you are looking for
-
New C310 - Wireless working FAIL - Printer's wireless network seems to be dead
Product: HP Photosmart Premium C310 OS: Windows Vista 64 bit and Windows 7 64 Bit Error: Wireless working: FAIL Changes: No changes since this is the first install of this printer ever Description: I've just unpacked my new C310 as a replacement for
-
How can I verify that my Apple Express is "absolutely" extending my Apple Extreme?
Greetings, I purchased an Apple Express to extend my Apple Extreme due to intermittent Wi-Fi signal in part of my home. I connected it and it automatically configured the Express to extend my Apple Extreme. My question is how exactly can I verify abs
-
Seperate instances of server class for authentication
I'd like to implement some form of authentication in my server class. I thought about adding a few login routines and while the client hasn't authenticated itself all calls to functions other than the login stuff will throw Exceptions. However, as I
-
Evaluation Path for View of Organizational Structure
Hi all, I am trying to define new VIEWID using EVPATH which would do the following filtering (by using f.m. HRWPC_GET_NAV_SUBTREE): giving org.unit number, it would return employees of current org unit and in case that there are some sub org units w
-
When I am editing information is there a keyboard shortcut to advance to the next song without using the mouse to click "next"?