Problem with perform statement
Hi All,
I 'm in PAI event. i'm writing code for a check box. there
CASE SY-UCOMM.
when 'FC'.
here i need to write a select statement like
select field from database into itab where field1 = itab1-field1.
This itab1 data is in the following form.
FORM user_comm USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
so how can i use this form in my PAI?
can anybody help me.
thanks
g.s.naidu
Hi can anybody tell me how can i write a perform statement for a form statement.
i want to write a perform statement for this
" FORM user_double_click_on_sumry USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
this is from alv grid function module when we try to move to next screen we pass this parameter.
i_callback_user_command = 'user_double_click_on_sumry'.
now i want to use this form statement some where else. so can anybody tell me how can i write the perform for the above form statement.
thanks
g.s.naidu
Similar Messages
-
Problem with READ Statement in the field routine of the Transformation
Hi,
I have problem with read statement with binary search in the field routine of the transformation.
read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
Code in the start routine
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp <> 3.
delete it_zcam where end_dt initial.
sort it_zcam by surce accno.
endif.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif.
this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
this field i am using in the report filter.
please let me know if anybody has the soluton or reason for this strage behaviour.
thanks,
Rahim.i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
1. is the key of zcam_o11 source and accno ?
2. you need to get the sortout of if endif (see code below)
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp 3.
delete it_zcam where end_dt initial.
endif.
sort it_zcam by surce accno.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif. -
Problem with performance in flash player 11.4.402.287
Hi,
We found the problem in 11.4.402.287 flash player. IN Debug version, Flex application works fine but in standard version we experience problems with performance.
This happens only in 11.4.402 version for Firefox. In another browsers and Flash player versions everything works fine.
For example, 11.3 for Firefox does not have this problem.
Application has a lot of small objects that receives rollover and rollout events and depend on object highlited some of these objectsHi,
Can you try 11.5 beta? http://labs.adobe.com/downloads/flashplayer11-5.html
thanks,
Hitomi -
Performance problem with MERGE statement
Version : 11.1.0.7.0
I have an insert statement like following which is taking less than 2 secs to complete and inserts around 4000 rows:
INSERT INTO sch.tab1
(c1,c2,c3)
SELECT c1,c2,c3
FROM sch1.tab1@dblink
WHERE c1 IN (SELECT c1 FROM sch1.tab2@dblink);I wanted to change it to a MERGE statement just to avoid duplicate data. I changed it to following :
MERGE INTO sch.tab1 t1
USING (SELECT c1,c2,c3
FROM sch1.tab1@dblink
WHERE c1 IN (SELECT c1 FROM sch1.tab2@dblink) t2
ON (t1.c1 = t2.c1)
WHEN NOT MATCHED THEN
INSERT (t1.c1,t1.c2,t1.c3)
VALUES (t2.c1,t2.c2,t2.c3);The MERGE statement is taking more than 2 mins (and I stopped the execution after that). I removed the WHERE clause subquery inside the subquery of the USING section and it executed in 1 sec.
If I execute the same select statement with the WHERE clause outside the MERGE statement, it takes just 1 sec to return the data.
Is there any known issue with MERGE statement while implementing using above scenario?riedelme wrote:
Are your join columns indexed?
Yes, the join columns are indexed.
You are doing a remote query inside the merge; remote queries can slow things down. Do you have to select all thr rows from the remote table? What if you copied them locally using a materialized view?Yes, I agree that remote queries will slow things down. But the same is not happening while select, insert and pl/sql. It happens only when we are using MERGE. I have to test what happens if we use a subquery refering to a local table or materialized view. Even if it works, I think there is still a problem with MERGE in case of remote subqueries (atleast till I test local queries). I wish some one can test similar scenarios so that we can know whether it is a genuine problem or some specific problem from my side.
>
BTW, I haven't had great luck with MERGE either :(. Last time I tried to use it I found it faster to use a loop with insert/update logic.
Edited by: riedelme on Jul 28, 2009 12:12 PM:) I used the same to overcome this situation. I think MERGE needs to be still improved functionally from Oracle side. I personally feel that it is one of the robust features to grace SQL or PL/SQL. -
Problem with performance in a code.
Hi People! I have problems with the performance of this program. The tables that I use have much data and the program take two hours to finish.
Please, some one tell me how can I make a better performance.
Thanks!
This is the program:
TABLES:
faglflext, "Saldos mensuales por cta.
contable y prf center.
zavg_bal_table,
skat. "Chart of accounts
********************INTERNAL TABLE DEFINITION***************************
DATA: BEGIN OF t_itab1 OCCURS 0.
DATA: rbukrs TYPE faglflext-rbukrs. "Company Code
DATA: racct TYPE faglflext-racct. "Account ID
DATA: prctr TYPE faglflext-prctr. "Profit Center
DATA: kslvt TYPE faglflext-kslvt. "Total of the period in group currency
DATA: ksl01 TYPE faglflext-ksl01. "Total of the period in group currency
DATA: ksl02 TYPE faglflext-ksl02. "Total of the period in group currency
DATA: ksl03 TYPE faglflext-ksl03. "Total of the period in group currency
DATA: ksl04 TYPE faglflext-ksl04. "Total of the period in group currency
DATA: ksl05 TYPE faglflext-ksl05. "Total of the period in group currency
DATA: ksl06 TYPE faglflext-ksl06. "Total of the period in group currency
DATA: ksl07 TYPE faglflext-ksl07. "Total of the period in group currency
DATA: ksl08 TYPE faglflext-ksl08. "Total of the period in group currency
DATA: ksl09 TYPE faglflext-ksl09. "Total of the period in group currency
DATA: ksl10 TYPE faglflext-ksl10. "Total of the period in group currency
DATA: ksl11 TYPE faglflext-ksl11. "Total of the period in group currency
DATA: ksl12 TYPE faglflext-ksl12. "Total of the period in group currency
DATA: ksl13 TYPE faglflext-ksl13. "Total of the period in group currency
DATA: ksl14 TYPE faglflext-ksl14. "Total of the period in group currency
DATA: ksl15 TYPE faglflext-ksl15. "Total of the period in group currency
DATA: ksl16 TYPE faglflext-ksl16. "Total of the period in group currency
DATA: rldnr TYPE faglflext-rldnr. "Ledger in GL Accounting
DATA: rtcur TYPE faglflext-rtcur. "Currency Key
DATA: txt20 TYPE skat-txt20. "Description Text
DATA: saknr TYPE skat-saknr. "G/L account number
DATA: ktopl TYPE skat-ktopl. "Chart of Accounts
DATA: rpmax TYPE faglflext-rpmax. "Period
DATA: total_sum LIKE faglflext-ksl01. "Amount of the first month
DATA: ryear LIKE faglflext-ryear. "Fiscal Year
DATA: year LIKE faglflext-ryear. "Past Year
DATA: day_a TYPE sy-datum.
DATA: per_day TYPE rr_umper.
DATA: average TYPE vtcur12.
DATA: agregate TYPE vtcur12.
DATA: accumulate TYPE vtcur12.
DATA: average_sap TYPE rr_umper.
DATA: END OF t_itab1.
DATA: BEGIN OF t_itab2 OCCURS 0.
DATA: rbukrs TYPE faglflext-rbukrs. "Company Code
DATA: racct TYPE faglflext-racct. "Account ID
DATA: prctr TYPE faglflext-prctr. "Profit Center
DATA: kslvt TYPE faglflext-kslvt. "Total of the period in group currency
DATA: ksl01 TYPE faglflext-ksl01. "Total of the period in group currency
DATA: ksl02 TYPE faglflext-ksl02. "Total of the period in group currency
DATA: ksl03 TYPE faglflext-ksl03. "Total of the period in group currency
DATA: ksl04 TYPE faglflext-ksl04. "Total of the period in group currency
DATA: ksl05 TYPE faglflext-ksl05. "Total of the period in group currency
DATA: ksl06 TYPE faglflext-ksl06. "Total of the period in group currency
DATA: ksl07 TYPE faglflext-ksl07. "Total of the period in group currency
DATA: ksl08 TYPE faglflext-ksl08. "Total of the period in group currency
DATA: ksl09 TYPE faglflext-ksl09. "Total of the period in group currency
DATA: ksl10 TYPE faglflext-ksl10. "Total of the period in group currency
DATA: ksl11 TYPE faglflext-ksl11. "Total of the period in group currency
DATA: ksl12 TYPE faglflext-ksl12. "Total of the period in group currency
DATA: ksl13 TYPE faglflext-ksl13. "Total of the period in group currency
DATA: ksl14 TYPE faglflext-ksl14. "Total of the period in group currency
DATA: ksl15 TYPE faglflext-ksl15. "Total of the period in group currency
DATA: ksl16 TYPE faglflext-ksl16. "Total of the period in group currency
DATA: rldnr TYPE faglflext-rldnr. "Ledger in GL Accounting
DATA: rtcur TYPE faglflext-rtcur. "Currency Key
DATA: txt20 TYPE skat-txt20. "Description Text
DATA: saknr TYPE skat-saknr. "G/L account number
DATA: ktopl TYPE skat-ktopl. "Chart of Accounts
DATA: rpmax TYPE faglflext-rpmax. "Period
DATA: total_sum LIKE faglflext-ksl01. "Amount of the first month
DATA: ryear LIKE faglflext-ryear. "Fiscal Year
DATA: year LIKE faglflext-ryear. "Past Year
DATA: END OF t_itab2.
DATA: BEGIN OF t_zavg OCCURS 0.
DATA: bukrs TYPE bukrs.
DATA: racct TYPE racct.
DATA: prctr TYPE prctr.
DATA: day_a TYPE sy-datum.
DATA: per_day TYPE rr_umper.
DATA: average TYPE vtcur12.
DATA: agregate TYPE vtcur12.
DATA: accumulate TYPE vtcur12.
DATA: average_sap TYPE rr_umper.
DATA: END OF t_zavg.
DATA: BEGIN OF t_zavg2 OCCURS 0.
DATA: day_a TYPE sy-datum.
DATA: racct TYPE racct.
DATA: prctr TYPE prctr.
DATA: per_day TYPE rr_umper.
DATA: average TYPE vtcur12.
DATA: agregate TYPE vtcur12.
DATA: accumulate TYPE vtcur12.
DATA: average_sap TYPE rr_umper.
DATA: END OF t_zavg2.
* Variable definition *
DATA: balance_month_01 LIKE faglflext-ksl01.
DATA: balance_month_02 LIKE faglflext-ksl01.
DATA: balance_month_03 LIKE faglflext-ksl01.
DATA: balance_month_04 LIKE faglflext-ksl01.
DATA: balance_month_05 LIKE faglflext-ksl01.
DATA: balance_month_06 LIKE faglflext-ksl01.
DATA: balance_month_07 LIKE faglflext-ksl01.
DATA: balance_month_08 LIKE faglflext-ksl01.
DATA: balance_month_09 LIKE faglflext-ksl01.
DATA: balance_month_10 LIKE faglflext-ksl01.
DATA: balance_month_11 LIKE faglflext-ksl01.
DATA: balance_month_12 LIKE faglflext-ksl01.
DATA: balance_month_13 LIKE faglflext-ksl01.
DATA: current_average_balance LIKE zavg_bal_table-average.
DATA: current_balance LIKE faglflext-ksl01.
DATA: current_activity_balance LIKE faglflext-ksl01.
DATA: current_aggregate_balance LIKE zavg_bal_table-agregate.
DATA: average_balance_ytd LIKE zfintbco0001-period_avg_12.
DATA: count TYPE i.
DATA: wa_itab LIKE LINE OF t_itab1.
DATA: wa_low LIKE LINE OF t_itab1.
DATA: wa_high LIKE LINE OF t_itab1.
DATA: wa_itab2 LIKE LINE OF t_itab2.
DATA: wa_zavg2 LIKE LINE OF t_zavg2.
DATA: wa_zavg LIKE LINE OF t_zavg.
DATA: t_acum TYPE i.
DATA: companycode TYPE faglflext-rbukrs.
DATA: descripcion TYPE skat-txt20.
DATA: oref TYPE REF TO cx_root,
emsg TYPE zedesc,
param1 TYPE zparm,
parm1 TYPE zparm.
DATA: avg1 TYPE faglflext-ksl01. "AVG = AVERAGE
DATA: avg2 TYPE faglflext-ksl01.
DATA: avg3 TYPE faglflext-ksl01.
DATA: avg4 TYPE faglflext-ksl01.
DATA: avg5 TYPE faglflext-ksl01.
DATA: avg6 TYPE faglflext-ksl01.
DATA: avg7 TYPE faglflext-ksl01.
DATA: avg8 TYPE faglflext-ksl01.
DATA: avg9 TYPE faglflext-ksl01.
DATA: avg10 TYPE faglflext-ksl01.
DATA: avg11 TYPE faglflext-ksl01.
DATA: avg12 TYPE faglflext-ksl01.
DATA: conteo TYPE i.
DATA: conteo2 TYPE i.
DATA: numerocta TYPE faglflext-racct.
DATA: profitcenter TYPE faglflext-prctr.
DATA: average_month_01 TYPE zavg_bal_table-average.
DATA: aggregate_month_01 TYPE zavg_bal_table-agregate.
DATA: average_month_02 TYPE zavg_bal_table-average.
DATA: aggregate_month_02 TYPE zavg_bal_table-agregate.
DATA: average_month_03 TYPE zavg_bal_table-average.
DATA: aggregate_month_03 TYPE zavg_bal_table-agregate.
DATA: average_month_04 TYPE zavg_bal_table-average.
DATA: aggregate_month_04 TYPE zavg_bal_table-agregate.
DATA: average_month_05 TYPE zavg_bal_table-average.
DATA: aggregate_month_05 TYPE zavg_bal_table-agregate.
DATA: average_month_06 TYPE zavg_bal_table-average.
DATA: aggregate_month_06 TYPE zavg_bal_table-agregate.
DATA: average_month_07 TYPE zavg_bal_table-average.
DATA: aggregate_month_07 TYPE zavg_bal_table-agregate.
DATA: average_month_08 TYPE zavg_bal_table-average.
DATA: aggregate_month_08 TYPE zavg_bal_table-agregate.
DATA: average_month_09 TYPE zavg_bal_table-average.
DATA: aggregate_month_09 TYPE zavg_bal_table-agregate.
DATA: average_month_10 TYPE zavg_bal_table-average.
DATA: aggregate_month_10 TYPE zavg_bal_table-agregate.
DATA: average_month_11 TYPE zavg_bal_table-average.
DATA: aggregate_month_11 TYPE zavg_bal_table-agregate.
DATA: average_month_12 TYPE zavg_bal_table-average.
DATA: aggregate_month_12 TYPE zavg_bal_table-agregate.
DATA: ano TYPE i.
DATA: ano_pasado TYPE i.
DATA: ano_corriente TYPE i.
DATA: mesdia TYPE adb_pfrom.
DATA: firstline TYPE i.
DATA: kslvt TYPE faglflext-kslvt.
DATA: ksl01 TYPE faglflext-ksl01.
DATA: ksl02 TYPE faglflext-ksl02.
DATA: ksl03 TYPE faglflext-ksl03.
DATA: ksl04 TYPE faglflext-ksl04.
DATA: ksl05 TYPE faglflext-ksl05.
DATA: ksl06 TYPE faglflext-ksl06.
DATA: ksl07 TYPE faglflext-ksl07.
DATA: ksl08 TYPE faglflext-ksl08.
DATA: ksl09 TYPE faglflext-ksl09.
DATA: ksl10 TYPE faglflext-ksl10.
DATA: ksl11 TYPE faglflext-ksl11.
DATA: ksl12 TYPE faglflext-ksl12.
DATA: ksl13 TYPE faglflext-ksl13.
DATA: ksl14 TYPE faglflext-ksl14.
DATA: ksl15 TYPE faglflext-ksl15.
DATA: ksl16 TYPE faglflext-ksl16.
DATA: itab_kslvt TYPE faglflext-kslvt.
DATA: itab_ksl01 TYPE faglflext-ksl01.
DATA: itab_ksl02 TYPE faglflext-ksl02.
DATA: itab_ksl03 TYPE faglflext-ksl03.
DATA: itab_ksl04 TYPE faglflext-ksl04.
DATA: itab_ksl05 TYPE faglflext-ksl05.
DATA: itab_ksl06 TYPE faglflext-ksl06.
DATA: itab_ksl07 TYPE faglflext-ksl07.
DATA: itab_ksl08 TYPE faglflext-ksl08.
DATA: itab_ksl09 TYPE faglflext-ksl09.
DATA: itab_ksl10 TYPE faglflext-ksl10.
DATA: itab_ksl11 TYPE faglflext-ksl11.
DATA: itab_ksl12 TYPE faglflext-ksl12.
DATA: itab_ksl13 TYPE faglflext-ksl13.
DATA: itab_ksl14 TYPE faglflext-ksl14.
DATA: itab_ksl15 TYPE faglflext-ksl15.
DATA: itab_ksl16 TYPE faglflext-ksl16.
DATA: itab_bal00 TYPE faglflext-kslvt.
DATA: itab_bal01 TYPE faglflext-ksl01.
DATA: itab_bal02 TYPE faglflext-ksl02.
DATA: itab_bal03 TYPE faglflext-ksl03.
DATA: itab_bal04 TYPE faglflext-ksl04.
DATA: itab_bal05 TYPE faglflext-ksl05.
DATA: itab_bal06 TYPE faglflext-ksl06.
DATA: itab_bal07 TYPE faglflext-ksl07.
DATA: itab_bal08 TYPE faglflext-ksl08.
DATA: itab_bal09 TYPE faglflext-ksl09.
DATA: itab_bal10 TYPE faglflext-ksl10.
DATA: itab_bal11 TYPE faglflext-ksl11.
DATA: itab_bal12 TYPE faglflext-ksl12.
DATA: itab_bal13 TYPE faglflext-ksl13.
DATA: itab_bal14 TYPE faglflext-ksl14.
DATA: itab_bal15 TYPE faglflext-ksl15.
DATA: itab_bal16 TYPE faglflext-ksl16.
DATA: numero_de_cta TYPE faglflext-racct.
DATA: company_code TYPE faglflext-rbukrs.
DATA: profit_center TYPE faglflext-prctr.
DATA: currency_code TYPE faglflext-rtcur.
DATA: average_month TYPE zavg_bal_table-average.
DATA: aggregate_month TYPE zavg_bal_table-agregate.
* VARIABLES FOR INTERFACES LOG
DATA: v_tipo TYPE zzfinbc85typede VALUE 1. "Tipo 1 = OUT
DATA: v_nom_int(9) TYPE c VALUE 'ZFINFII00'. "Nombre de la interfaz
DATA: v_modulo(2) TYPE c VALUE 'FI'. "Modulo
DATA: v_comp_code(4) TYPE c VALUE '0000'. "Compañia 0000
DATA: v_alegacy(4) TYPE c VALUE '0001'.
DATA: v_fecha TYPE d.
DATA: v_error2(3) TYPE c VALUE 'E'.
DATA: l_sys_exc TYPE REF TO cx_ai_system_fault.
DATA: last_day TYPE sy-datum.
DATA: numero_mes TYPE i.
DATA: ryear TYPE faglflext-ryear.
DATA: numero_cuenta TYPE faglflext-racct.
DATA: numero_profit TYPE faglflext-prctr.
DATA: day_a TYPE i.
DATA: text(20) TYPE c.
*Acknowledge
DATA: lo_async_messaging TYPE REF TO if_wsprotocol_async_messaging,
lo_msg_id_protocol TYPE REF TO if_wsprotocol_message_id,
l_msg_id TYPE sxmsguid,
l_ack_request TYPE prx_ack_request_details.
DATA: fecha TYPE sy-datum.
DATA: fecha_ejecutandose TYPE sy-datum.
DATA: fecha_corriente TYPE i.
DATA: jan_fin TYPE sy-datum.
DATA: feb_fin TYPE sy-datum.
DATA: febb_fin TYPE sy-datum.
DATA: mar_fin TYPE sy-datum.
DATA: apr_fin TYPE sy-datum.
DATA: may_fin TYPE sy-datum.
DATA: jun_fin TYPE sy-datum.
DATA: jul_fin TYPE sy-datum.
DATA: aug_fin TYPE sy-datum.
DATA: sep_fin TYPE sy-datum.
DATA: oct_fin TYPE sy-datum.
DATA: nov_fin TYPE sy-datum.
DATA: dec_fin TYPE sy-datum.
DATA: porciento1 TYPE faglflext-ksl01.
DATA: porciento2 TYPE faglflext-ksl01.
DATA: porciento3 TYPE faglflext-ksl01.
DATA: porciento4 TYPE faglflext-ksl01.
DATA: porciento5 TYPE faglflext-ksl01.
DATA: porciento6 TYPE faglflext-ksl01.
DATA: porciento7 TYPE faglflext-ksl01.
DATA: porciento8 TYPE faglflext-ksl01.
DATA: porciento9 TYPE faglflext-ksl01.
DATA: porciento10 TYPE faglflext-ksl01.
DATA: porciento11 TYPE faglflext-ksl01.
DATA: porciento12 TYPE faglflext-ksl01.
data: mes(2) type c value '00'.
data: mes_anterior type sy-datum.
data: ceros(2) type c.
*DEFINICION DE RANGOS.
RANGES profit FOR faglflext-prctr.
RANGES account FOR faglflext-racct.
RANGES end_month FOR zavg_bal_table-day_a.
*Sele asigna el fin de mes a cada variable para que sea utilizada luego en el programa.
jan_fin = '20060131'.
feb_fin = '20060228'.
febb_fin = '20060229'.
mar_fin = '20060331'.
apr_fin = '20060430'.
may_fin = '20060531'.
jun_fin = '20060630'.
jul_fin = '20060731'.
aug_fin = '20060831'.
sep_fin = '20060930'.
oct_fin = '20061031'.
nov_fin = '20061130'.
dec_fin = '20061231'.
*Inicializando las variables a valor '0'.
balance_month_01 = 0.
balance_month_02 = 0.
balance_month_03 = 0.
balance_month_04 = 0.
balance_month_05 = 0.
balance_month_06 = 0.
balance_month_07 = 0.
balance_month_08 = 0.
balance_month_09 = 0.
balance_month_10 = 0.
balance_month_11 = 0.
balance_month_12 = 0.
balance_month_13 = 0.
current_average_balance = 0.
current_balance = 0.
current_activity_balance = 0.
current_aggregate_balance = 0.
average_balance_ytd = 0.
count = 0.
t_acum = 0.
conteo = 1.
conteo2 = 1.
ceros = '00'.
*THIS IS A STRUCTURE NAMED E_SKAT. WITH THE TWO FIELDS NAMED SAKNR *
*AND TXT20. *
TYPES: BEGIN OF e_skat,
ktopl LIKE skat-ktopl,
saknr LIKE skat-saknr,
txt20 LIKE skat-txt20,
END OF e_skat.
* SORT THE STRUCTURE IN ORDER FOR BEST PERFORMANCE *
DATA it_skat TYPE SORTED TABLE OF e_skat
WITH UNIQUE KEY saknr WITH HEADER LINE.
DATA: wa_skat LIKE LINE OF it_skat.
* CONSTANT DEFINITIONS (HAVE THE SAME VALUE EVER) *
CONSTANTS:
etype TYPE zetype VALUE 'INTER', "Utilizada con la funcion de error
innum TYPE zintnum VALUE 'ZFINFII00', "Utilizada con la funcion de error
inname TYPE zinname VALUE 'Sendero and Cognos Interfase', "Utilizada con la funcion de error
c_cuenta(10) TYPE c VALUE '0000270011',
c_ol(2) TYPE c VALUE '0L',
c_chart(4) TYPE c VALUE 'CAPI', "Chart Of Accounts
c_ceros(17) TYPE n VALUE '00000000000000.00', "ceros
acct_cog(10) TYPE n VALUE '0000270011', "Numero de cta. que se busca en COGNOS.
capi(4) TYPE c VALUE 'CAPI'.
* PARAMETROS de entrada para el usuario. *
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
PARAMETERS:
p_date TYPE sy-datum DEFAULT sy-datum. "Fecha de corrida
IF p_date IS INITIAL.
p_date = sy-datum.
ENDIF.
* PARAMETEROS DE ENTRADA POR MEDIO DE RANGOS PARA EL USUARIO *
SELECT-OPTIONS:
p_bukrs FOR faglflext-rbukrs.
SELECTION-SCREEN END OF BLOCK bl1.
*IF THE USER SELECT THIS CHECK BOX WITH A CHECK MARK THE PROGRAM *
*SUBMIT THIS INTERFACE TO. *
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
PARAMETERS:
p_cognos TYPE c AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK bl2.
* This statement calls the subroutine specified, SENDERO or COGNOS *
IF p_cognos IS INITIAL.
PERFORM sendero.
ELSE.
PERFORM cognos.
ENDIF.
EXIT.
* SENEDERO INTERFACE *
FORM sendero.
*ESTE SELECT EXTRAE LA DATA DE LA TABLA FAGFLEXT Y SKAT
DATA: msgdetails TYPE zgl_sendero_file_dt_tab.
DATA: wa_msgdetails LIKE LINE OF msgdetails.
SELECT a~ryear a~rpmax a~rtcur a~racct a~rbukrs a~prctr
a~kslvt a~ksl01 a~ksl02 a~ksl03 a~ksl04 a~ksl05
a~ksl06 a~ksl07 a~ksl08 a~ksl09 a~ksl10 a~ksl11
a~ksl12 a~ksl13 a~ksl14 a~ksl15 a~ksl16 b~saknr
b~txt20 b~ktopl
FROM faglflext AS a INNER JOIN skat AS b ON a~racct = b~saknr AND a~rclnt = b~mandt
CLIENT SPECIFIED INTO CORRESPONDING FIELDS OF TABLE t_itab1
WHERE a~rclnt = sy-mandt
AND a~rbukrs IN p_bukrs
AND a~rldnr = '0L'
AND a~ryear = p_date+0(4)
AND b~spras EQ sy-langu
AND b~ktopl EQ 'CAPI'.
*SI NO ENCUENTRA DATA EN LA TABLA FAGLFLEXT ENVIA EL MENSAJE DE ERROR
*A LA TABLA DE ERROR.
IF sy-subrc <> 0.
MOVE 'No data found in FLAGLFLEXT or ZAVG_BAL_TABLE for this process.'(e01) TO emsg.
* PERFORM call_error_function USING emsg.
* PERFORM call_log_function_send.
MESSAGE: emsg TYPE 'E'.
ENDIF.
*EN ESTE SELECT SACO LA DESCRIPCION DE LA CUENTA
SORT t_itab1 BY racct ASCENDING.
DELETE t_itab1 WHERE racct = ''.
SORT t_itab1 BY prctr ASCENDING.
CLEAR t_itab1.
READ TABLE t_itab1 INTO wa_low INDEX 1 .
DESCRIBE TABLE t_itab1 LINES firstline.
READ TABLE t_itab1 INTO wa_high INDEX firstline.
IF wa_high-prctr = 'DUMMY'. "SI EL ULTIMO RECORD CONTIENE ALGUN 'DUMMY' ESCOJER EL RECORD DE ARRIBA.
firstline = firstline - 1. "CONTIENE EL NUMERO DEL INDICE.
READ TABLE t_itab1 INTO wa_high INDEX firstline.
ENDIF.
profit-sign = 'I'.
profit-option = 'BT'.
profit-low = wa_low-prctr.
profit-high = wa_high-prctr.
APPEND profit.
*COMPUTOS PARA CALCULAR EL ULTIMO DIA DEL MES.
fecha = p_date.
numero_mes = p_date+4(2). "PASO NUMERO DEL MES A VARIABLE.
p_date+4(2) = p_date+4(2) - numero_mes. "LE RESTO EL MISMO MES A LA FECHA PARA COMENZAR EL CONTEO DESDE EL MES 1.
DO numero_mes TIMES. "SE VA A EJECUTAR LAS MISMAS VECES DEL NUMERO DEL MES.
p_date+4(2) = p_date+4(2) + 1. "SE INCREMENTA EL NUMERO DEL MES.
CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH' "Obtiene el ultimo numero del mes.
EXPORTING
day_in = p_date
IMPORTING
last_day_of_month = last_day
EXCEPTIONS
day_in_not_valid = 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.
IF fecha = p_date.
fecha = fecha - 1. "le resta a fecha -1 para que busque en la tabla zavg_bal_table el record del dia anterior.
end_month-sign = 'I'.
end_month-option = 'EQ'.
end_month-low = fecha.
APPEND end_month.
ELSE.
end_month-sign = 'I'.
end_month-option = 'EQ'.
end_month-low = last_day.
APPEND end_month.
ENDIF.
ENDDO.
SORT end_month BY low ASCENDING.
SELECT bukrs racct prctr day_a per_day average agregate accumulate average_sap
FROM zavg_bal_table CLIENT SPECIFIED APPENDING TABLE t_zavg
WHERE mandt = sy-mandt
AND bukrs IN p_bukrs
AND day_a <= sy-datum
AND prctr IN profit.
SORT t_itab1 BY rbukrs racct prctr.
SORT t_zavg BY bukrs racct prctr day_a.
*IMPRESION Y ENVIO DE LOS DATOS REQUERIDOS
*Estos If verifican el mes que se esta ejecutando por el usuario para cambiarselo a la variable que identifica el fin de mes.
IF p_date+4(2) = jan_fin+4(2).
jan_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = feb_fin+4(2).
feb_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = mar_fin+4(2).
mar_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = apr_fin+4(2).
apr_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = may_fin+4(2).
may_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = jun_fin+4(2).
jun_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = jul_fin+4(2).
jul_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = aug_fin+4(2).
aug_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = sep_fin+4(2).
sep_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = oct_fin+4(2).
oct_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = nov_fin+4(2).
nov_fin+6(2) = p_date+6(2).
ENDIF.
IF p_date+4(2) = dec_fin+4(2).
dec_fin+6(2) = p_date+6(2).
ENDIF.
*Comienza primer loop en el programa a t_itab1 que es la tabla interna que contiene los datos de faglflext.
LOOP AT t_itab1 INTO wa_itab WHERE racct NE ''.
AT NEW prctr. "Limpia las variables que se muestran en el clear cada ves que comienza un nuevo profit center.
CLEAR: itab_kslvt, itab_ksl01, itab_ksl02, itab_ksl03, itab_ksl04, itab_ksl05, itab_ksl06, itab_ksl07, itab_ksl08,
itab_ksl09, itab_ksl10, itab_ksl11, itab_ksl12, itab_ksl13, itab_ksl14, itab_ksl15, itab_ksl16,
itab_bal00, itab_bal01, itab_bal02, itab_bal03, itab_bal04, itab_bal05, itab_bal06, itab_bal07,
itab_bal08, itab_bal09, itab_bal10, itab_bal11, itab_bal12, itab_bal13, itab_bal14, itab_bal15,
itab_bal16.
ENDAT.
*Se le pasa a la variable itab_ksl## el valor del mes que contenga flext.
itab_kslvt = itab_kslvt + wa_itab-kslvt. itab_ksl01 = itab_ksl01 + wa_itab-ksl01. itab_ksl02 = itab_ksl02 + wa_itab-ksl02.
itab_ksl03 = itab_ksl03 + wa_itab-ksl03. itab_ksl04 = itab_ksl04 + wa_itab-ksl04.
itab_ksl05 = itab_ksl05 + wa_itab-ksl05. itab_ksl06 = itab_ksl06 + wa_itab-ksl06.
itab_ksl07 = itab_ksl07 + wa_itab-ksl07. itab_ksl08 = itab_ksl08 + wa_itab-ksl08.
itab_ksl09 = itab_ksl09 + wa_itab-ksl09. itab_ksl10 = itab_ksl10 + wa_itab-ksl10.
itab_ksl11 = itab_ksl11 + wa_itab-ksl11. itab_ksl12 = itab_ksl12 + wa_itab-ksl12.
itab_ksl13 = itab_ksl13 + wa_itab-ksl13. itab_ksl14 = itab_ksl14 + wa_itab-ksl14.
itab_ksl15 = itab_ksl15 + wa_itab-ksl15. itab_ksl16 = itab_ksl16 + wa_itab-ksl16.
*En estas variables va acumulando el valor por mes. Osea, va sumando todo lo que tenga de ese mes por profit center. Al venir un profit
*nuevo esta se limpia.
itab_bal00 = itab_bal00 + wa_itab-kslvt. itab_bal01 = itab_bal01 + wa_itab-ksl01. itab_bal02 = itab_bal02 + wa_itab-ksl02.
itab_bal03 = itab_bal03 + wa_itab-ksl03. itab_bal04 = itab_bal04 + wa_itab-ksl04.
itab_bal05 = itab_bal05 + wa_itab-ksl05. itab_bal06 = itab_bal06 + wa_itab-ksl06.
itab_bal07 = itab_bal07 + wa_itab-ksl07. itab_bal08 = itab_bal08 + wa_itab-ksl08.
itab_bal09 = itab_bal09 + wa_itab-ksl09. itab_bal10 = itab_bal10 + wa_itab-ksl10.
itab_bal11 = itab_bal11 + wa_itab-ksl11. itab_bal12 = itab_bal12 + wa_itab-ksl12.
itab_bal13 = itab_bal13 + wa_itab-ksl13. itab_bal14 = itab_bal14 + wa_itab-ksl14.
itab_bal15 = itab_bal15 + wa_itab-ksl15. itab_bal16 = itab_bal16 + wa_itab-ksl16.
ryear = wa_itab-ryear.
CLEAR t_zavg.
sy-subrc = 0.
numero_de_cta = wa_itab-racct.
company_code = wa_itab-rbukrs.
profit_center = wa_itab-prctr.
currency_code = wa_itab-rtcur.
descripcion = wa_itab-txt20.
*Segundo loop a realizarce. Este utiliza la tabla interna: t_zavg la cual contiene los datos extraidos de zavg_bal_table.
LOOP AT t_zavg INTO wa_zavg WHERE bukrs = wa_itab-rbukrs AND racct = wa_itab-racct AND prctr = wa_itab-prctr.
AT NEW prctr. "Al cambiar el profit center limpia las variables que se encuentran en el clear.
CLEAR: average_month_01, average_month_02, average_month_03, average_month_04, average_month_05,
average_month_06, average_month_07, average_month_08, average_month_09, average_month_10, average_month_11,
average_month_12, average_month.
ENDAT.
*Dependiendo del mes que contiene el record de la tabla t_zavg este va acumulando el average_month.
IF wa_zavg-day_a+4(2) = '01'.
average_month_01 = average_month_01 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '02'.
average_month_02 = average_month_02 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '03'.
average_month_03 = average_month_03 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '04'.
average_month_04 = average_month_04 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '05'.
average_month_05 = average_month_05 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '06'.
average_month_06 = average_month_06 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '07'.
average_month_07 = average_month_07 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '08'.
average_month_08 = average_month_08 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '09'.
average_month_09 = average_month_09 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '10'.
average_month_10 = average_month_10 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '11'.
average_month_11 = average_month_11 + wa_zavg-accumulate.
ENDIF.
IF wa_zavg-day_a+4(2) = '12'.
average_month_12 = average_month_12 + wa_zavg-accumulate.
ENDIF.
*Este if verifica que cuando el record que se esta verificando sea con fecha de fin de mes calcule el resto del codigo que se encuentra debajo.
IF wa_zavg-day_a = jan_fin OR wa_zavg-day_a = feb_fin OR wa_zavg-day_a = mar_fin OR wa_zavg-day_a = apr_fin OR wa_zavg-day_a = may_fin OR wa_zavg-day_a = jun_fin OR
wa_zavg-day_a = jul_fin OR wa_zavg-day_a = aug_fin OR wa_zavg-day_a = sep_fin OR wa_zavg-day_a = oct_fin OR
wa_zavg-day_a = nov_fin OR wa_zavg-day_a = dec_fin.
aggregate_month = wa_zavg-agregate.
day_a = wa_zavg-day_a.
*Calcula el aggregate_month dependiendo de la fecha del record que se esta procesando.
IF wa_zavg-day_a+4(2) = '01'.
aggregate_month_01 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '02'.
aggregate_month_02 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '03'.
aggregate_month_03 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '04'.
aggregate_month_04 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '05'.
aggregate_month_05 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '06'.
aggregate_month_06 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '07'.
aggregate_month_07 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '08'.
aggregate_month_08 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '09'.
aggregate_month_09 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '10'.
aggregate_month_10 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '11'.
aggregate_month_11 = wa_zavg-agregate.
ENDIF.
IF wa_zavg-day_a+4(2) = '12'.
aggregate_month_12 = wa_zavg-agregate.
ENDIF.
ENDIF.
*Este if verifica que cuando el record que se esta verificando sea con fecha de fin de mes calcule el resto del codigo que se encuentra debajo.
IF wa_zavg-day_a+4(4) = jan_fin+4(4) OR wa_zavg-day_a+4(4) = feb_fin+4(4) OR wa_zavg-day_a+4(4) = febb_fin+4(4) OR wa_zavg-day_a+4(4) = mar_fin+4(4) OR
wa_zavg-day_a+4(4) = apr_fin+4(4) OR wa_zavg-day_a+4(4) = may_fin+4(4) OR wa_zavg-day_a+4(4) = jun_fin+4(4) OR wa_zavg-day_a+4(4) = jul_fin+4(4) OR
wa_zavg-day_a+4(4) = aug_fin+4(4) OR wa_zavg-day_a+4(4) = sep_fin+4(4) OR wa_zavg-day_a+4(4) = oct_fin+4(4) OR wa_zavg-day_a+4(4) = nov_fin+4(4) OR
wa_zavg-day_a+4(4) = dec_fin+4(4).
*Calcula la division entre la cantidad acumulada por mes y la fecha del fin de mes.
IF average_month_01 IS NOT INITIAL.
porciento1 = average_month_01 / jan_fin+6(2).
average_month = porciento1.
ENDIF.
IF average_month_02 IS NOT INITIAL.
porciento2 = average_month_02 / feb_fin+6(2).
average_month = porciento2.
ENDIF.
IF average_month_03 IS NOT INITIAL.
porciento3 = average_month_03 / mar_fin+6(2).
average_month = porciento3.
ENDIF.
IF average_month_04 IS NOT INITIAL.
porciento4 = average_month_04 / apr_fin+6(2).
average_month = porciento4.
ENDIF.
IF average_month_05 IS NOT INITIAL.
porciento5 = average_month_05 / may_fin+6(2).
average_month = porciento5.
ENDIF.
IF average_month_06 IS NOT INITIAL.
porciento6 = average_month_06 / jun_fin+6(2).
average_month = porciento6.
ENDIF.
IF average_month_07 IS NOT INITIAL.
porciento7 = average_month_07 / jul_fin+6(2).
average_month = porciento7.
ENDIF.
IF average_month_08 IS NOT INITIAL.
porciento8 = average_month_08 / aug_fin+6(2).
average_month = porciento8.
ENDIF.
IF average_month_09 IS NOT INITIAL.
porciento9 = average_month_09 / sep_fin+6(2).
average_month = porciento9.
ENDIF.
IF average_month_10 IS NOT INITIAL.
porciento10 = average_month_10 / oct_fin+6(2).
average_month = porciento10.
ENDIF.
IF average_month_11 IS NOT INITIAL.
porciento11 = average_month_11 / nov_fin+6(2).
average_month = porciento11.
ENDIF.
IF average_month_12 IS NOT INITIAL.
porciento12 = average_month_12 / dec_fin+6(2).
average_month = porciento12.
ENDIF.
*Cuando la fecha que esta entrando el usuario es la misma a la del record que se esta procesando en ese momento ejecuta el siguiente IF.
IF p_date+4(4) = wa_zavg-day_a+4(4).
current_average_balance = average_month.
current_aggregate_balance = aggregate_month.
average_balance_ytd = average_month.
ENDIF.
ENDIF.
ENDLOOP.
AT END OF prctr.
IF sy-subrc = 0.
*ESTAS VARIABLES SE ESTAN PASANDO A UNA VARIABLE NORMAL YA QUE SI SE DEJAN DENTRO DEL WORK AREA (WA) LE PONE ASTERISCOS.
*LOS IF QUE SE DEMUESTRAN ABAJO SON PARECIDOS A LOS UTILIZADOS EN LA *
*PARTE POSTERIOR LO UNICO QUE LA FECHA UTILIZADA NO ES EXTRAIDA DE LA *
*TABLA, ES LA QUE EL USUARIO INSERTA DENTRO DEL PARAMETRO. *
IF p_date+4(2) >= '01'.
COMPUTE: balance_month_01 = itab_bal00 + itab_bal01.
ENDIF.
IF p_date+4(2) >= '02'.
COMPUTE: balance_month_02 = itab_bal00 + itab_bal01 + itab_bal02.
ENDIF.
IF p_date+4(2) >= '03'.
COMPUTE: balance_month_03 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03.
ENDIF.
IF p_date+4(2) >= '04'.
COMPUTE: balance_month_04 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04.
ENDIF.
IF p_date+4(2) >= '05'.
COMPUTE: balance_month_05 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05.
ENDIF.
IF p_date+4(2) >= '06'.
COMPUTE: balance_month_06 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06.
ENDIF.
IF p_date+4(2) >= '07'.
COMPUTE: balance_month_07 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07.
ENDIF.
IF p_date+4(2) >= '08'.
COMPUTE: balance_month_08 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08.
ENDIF.
IF p_date+4(2) >= '09'.
COMPUTE: balance_month_09 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09.
ENDIF.
IF p_date+4(2) >= '10'.
COMPUTE: balance_month_10 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10.
ENDIF.
IF p_date+4(2) >= '11'.
COMPUTE: balance_month_11 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11.
ENDIF.
IF p_date+4(2) >= '12'.
COMPUTE: balance_month_12 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12.
ENDIF.
IF p_date+4(2) >= '13'.
COMPUTE: balance_month_13 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12 + itab_bal13.
ENDIF.
COMPUTE: current_balance = + itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12 + itab_bal13 + itab_bal14 + itab_bal15 + itab_bal16.
*Computo para el activity balance.
IF p_date+4(2) = '01'.
current_activity_balance = itab_ksl01.
ENDIF.
IF p_date+4(2) = '02'.
current_activity_balance = itab_ksl02.
ENDIF.
IF p_date+4(2) = '03'.
current_activity_balance = itab_ksl03.
ENDIF.
IF p_date+4(2) = '04'.
current_activity_balance = itab_ksl04.
ENDIF.
IF p_date+4(2) = '05'.
current_activity_balance = itab_ksl05.
ENDIF.
IF p_date+4(2) = '06'.
current_activity_balance = itab_ksl06.
ENDIF.
IF p_date+4(2) = '07'.
current_activity_balance = itab_ksl07.
ENDIF.
IF p_date+4(2) = '08'.
current_activity_balance = itab_ksl08.
ENDIF.
IF p_date+4(2) = '09'.
current_activity_balance = itab_ksl09.
ENDIF.
IF p_date+4(2) = '10'.
current_activity_balance = itab_ksl10.
ENDIF.
IF p_date+4(2) = '11'.
current_activity_balance = itab_ksl11.
ENDIF.
IF p_date+4(2) = '12'.
current_activity_balance = itab_ksl12.
ENDIF.
*LE RESTA 1 AL AÑO CORRIENTE PARA VERIFICAR LUEGO SI EXISTE INFORMACION*
*DE AÑOS ANTERIORES. *
ano = ryear - 1.
* Get the values of the past year. *
ano = p_date+0(4) - 1.
IF ryear = ano.
wa_msgdetails-activity_previous_year = itab_ksl12.
* balance_previous_year = wa_msgdetails-balance_previous_year. *
wa_msgdetails-average_previous_year = average_month_12.
wa_msgdetails-aggreg_previous_year = aggregate_month_12.
ELSE.
*If the table don't have data the variables get '0000000000000'. *
wa_msgdetails-activity_previous_year = '00000000000000.00'.
wa_msgdetails-average_previous_year = '00000000000000.00'.
wa_msgdetails-aggreg_previous_year = '00000000000000.00'.
AT LAST.
wa_msgdetails-balance_previous_year = '00000000000000.00'.
wa_msgdetails-balance_previous_year = itab_kslvt +
itab_ksl01 +
itab_ksl02 +
itab_ksl03 +
itab_ksl04 +
itab_ksl05 +
itab_ksl06 +
itab_ksl07 +
itab_ksl08 +
itab_ksl09 +
itab_ksl10 +
itab_ksl11 +
itab_ksl12.
ENDAT.
ENDIF.
wa_msgdetails-account = numero_de_cta.
wa_msgdetails-company = company_code.
wa_msgdetails-cost_center = profit_center.
wa_msgdetails-currency_code = currency_code.
wa_msgdetails-account_description = descripcion.
wa_msgdetails-activity_month_01 = itab_ksl01.
wa_msgdetails-average_month_01 = porciento1.
wa_msgdetails-aggreg_month_01 = aggregate_month_01.
wa_msgdetails-activity_month_02 = itab_ksl02.
wa_msgdetails-average_month_02 = porciento2.
wa_msgdetails-aggreg_month_02 = aggregate_month_02.
wa_msgdetails-activity_month_03 = itab_ksl03.
wa_msgdetails-average_month_03 = porciento3.
wa_msgdetails-aggreg_month_03 = aggregate_month_03.
wa_msgdetails-activity_month_04 = itab_ksl04.
wa_msgdetails-average_month_04 = porciento4.
wa_msgdetails-aggreg_month_04 = aggregate_month_04.
wa_msgdetails-activity_month_05 = itab_ksl05.
wa_msgdetails-average_month_05 = porciento5.
wa_msgdetails-aggreg_month_05 = aggregate_month_05.
wa_msgdetails-activity_month_06 = itab_ksl06.
wa_msgdetails-average_month_06 = porciento6.
wa_msgdetails-aggreg_month_06 = aggregate_month_06.
wa_msgdetails-activity_month_07 = itab_ksl07.
wa_msgdetails-average_month_07 = porciento7.
wa_msgdetails-aggreg_month_07 = aggregate_month_07.
wa_msgdetails-activity_month_08 = itab_ksl08.
wa_msgdetails-average_month_08 = porciento8.
wa_msgdetails-aggreg_month_08 = aggregate_month_08.
wa_msgdetails-activity_month_09 = itab_ksl09.
wa_msgdetails-average_month_09 = porciento9.
wa_msgdetails-aggreg_month_09 = aggregate_month_09.
wa_msgdetails-activity_month_10 = itab_ksl10.
wa_msgdetails-average_month_10 = porciento10.
wa_msgdetails-aggreg_month_10 = aggregate_month_10.
wa_msgdetails-activity_month_11 = itab_ksl11.
wa_msgdetails-average_month_11 = porciento11.
wa_msgdetails-aggreg_month_11 = aggregate_month_11.
wa_msgdetails-activity_month_12 = itab_ksl12.
wa_msgdetails-average_month_12 = porciento12.
wa_msgdetails-aggreg_month_12 = aggregate_month_12.
wa_msgdetails-activity_month_13 = itab_ksl13.
wa_msgdetails-average_month_13 = '00000000000000.00'.
wa_msgdetails-aggreg_month_13 = '00000000000000.00'.
wa_msgdetails-balance_month_01 = balance_month_01.
wa_msgdetails-balance_month_02 = balance_month_02.
wa_msgdetails-balance_month_03 = balance_month_03.
wa_msgdetails-balance_month_04 = balance_month_04.
wa_msgdetails-balance_month_05 = balance_month_05.
wa_msgdetails-balance_month_06 = balance_month_06.
wa_msgdetails-balance_month_07 = balance_month_07.
wa_msgdetails-balance_month_08 = balance_month_08.
wa_msgdetails-balance_month_09 = balance_month_09.
wa_msgdetails-balance_month_10 = balance_month_10.
wa_msgdetails-balance_month_11 = balance_month_11.
wa_msgdetails-balance_month_12 = balance_month_12.
wa_msgdetails-balance_month_13 = balance_month_13.
wa_msgdetails-current_balance = current_balance.
wa_msgdetails-current_activity_balance = current_activity_balance.
CLEAR: porciento1, porciento2, porciento3, porciento4, porciento5, porciento6, porciento7, porciento8, porciento9, porciento10, porciento11,
porciento12, average_month.
*se multiplican las siguientes variables que contienen cantidades por -1 cuando el primer numero de la cta. es igual a
* 5, 6, 7, ó 8.
IF numero_de_cta+4(1) = '5' OR numero_de_cta+4(1) = '6' OR numero_de_cta+4(1) = '7' OR numero_de_cta+4(1) = '8'.
IF wa_msgdetails-current_balance IS NOT INITIAL.
wa_msgdetails-current_balance = wa_msgdetails-current_balance * -1.
ENDIF.
IF wa_msgdetails-activity_previous_year IS NOT INITIAL.
wa_msgdetails-activity_previous_year = wa_msgdetails-activity_previous_year * -1.
ENDIF.
IF wa_msgdetails-average_previous_year IS NOT INITIAL.
wa_msgdetails-average_previous_year = wa_msgdetails-average_previous_year * -1.
ENDIF.
IF wa_msgdetails-aggreg_previous_year IS NOT INITIAL.
wa_msgdetails-aggreg_previous_year = wa_msgdetails-aggreg_previous_year * -1.
ENDIF.
IF wa_msgdetails-balance_previous_year IS NOT INITIAL.
wa_msgdetails-balance_previous_year = wa_msgdetails-balance_previous_year * -1.
ENDIF.
IF wa_msgdetails-current_activity_balance IS NOT INITIAL.
wa_msgdetails-current_activity_balance = wa_msgdetails-current_activity_balance * -1.
ENDIF.
IF wa_msgdetails-activity_month_01 IS NOT INITIAL.
wa_msgdetails-activity_month_01 = wa_msgdetails-activity_month_01 * -1.
ENDIF.
IF wa_msgdetails-balance_month_01 IS NOT INITIAL.
wa_msgdetails-balance_month_01 = wa_msgdetails-balance_month_01 * -1.
ENDIF.
IF wa_msgdetails-average_month_01 IS NOT INITIAL.
wa_msgdetails-average_month_01 = wa_msgdetails-average_month_01 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_01 IS NOT INITIAL.
wa_msgdetails-aggreg_month_01 = wa_msgdetails-aggreg_month_01 * -1.
ENDIF.
IF wa_msgdetails-activity_month_02 IS NOT INITIAL.
wa_msgdetails-activity_month_02 = wa_msgdetails-activity_month_02 * -1.
ENDIF.
IF wa_msgdetails-balance_month_02 IS NOT INITIAL.
wa_msgdetails-balance_month_02 = wa_msgdetails-balance_month_02 * -1.
ENDIF.
IF wa_msgdetails-average_month_02 IS NOT INITIAL.
wa_msgdetails-average_month_02 = wa_msgdetails-average_month_02 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_02 IS NOT INITIAL.
wa_msgdetails-aggreg_month_02 = wa_msgdetails-aggreg_month_02 * -1.
ENDIF.
IF wa_msgdetails-activity_month_03 IS NOT INITIAL.
wa_msgdetails-activity_month_03 = wa_msgdetails-activity_month_03 * -1.
ENDIF.
IF wa_msgdetails-balance_month_03 IS NOT INITIAL.
wa_msgdetails-balance_month_03 = wa_msgdetails-balance_month_03 * -1.
ENDIF.
IF wa_msgdetails-average_month_03 IS NOT INITIAL.
wa_msgdetails-average_month_03 = wa_msgdetails-average_month_03 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_03 IS NOT INITIAL.
wa_msgdetails-aggreg_month_03 = wa_msgdetails-aggreg_month_03 * -1.
ENDIF.
IF wa_msgdetails-activity_month_04 IS NOT INITIAL.
wa_msgdetails-activity_month_04 = wa_msgdetails-activity_month_04 * -1.
ENDIF.
IF wa_msgdetails-balance_month_04 IS NOT INITIAL.
wa_msgdetails-balance_month_04 = wa_msgdetails-balance_month_04 * -1.
ENDIF.
IF wa_msgdetails-average_month_04 IS NOT INITIAL.
wa_msgdetails-average_month_04 = wa_msgdetails-average_month_04 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_04 IS NOT INITIAL.
wa_msgdetails-aggreg_month_04 = wa_msgdetails-aggreg_month_04 * -1.
ENDIF.
IF wa_msgdetails-activity_month_05 IS NOT INITIAL.
wa_msgdetails-activity_month_05 = wa_msgdetails-activity_month_05 * -1.
ENDIF.
IF wa_msgdetails-balance_month_05 IS NOT INITIAL.
wa_msgdetails-balance_month_05 = wa_msgdetails-balance_month_05 * -1.
ENDIF.
IF wa_msgdetails-average_month_05 IS NOT INITIAL.
wa_msgdetails-average_month_05 = wa_msgdetails-average_month_05 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_05 IS NOT INITIAL.
wa_msgdetails-aggreg_month_05 = wa_msgdetails-aggreg_month_05 * -1.
ENDIF.
IF wa_msgdetails-activity_month_06 IS NOT INITIAL.
wa_msgdetails-activity_month_06 = wa_msgdetails-activity_month_06 * -1.
ENDIF.
IF wa_msgdetails-balance_month_06 IS NOT INITIAL.
wa_msgdetails-balance_month_06 = wa_msgdetails-balance_month_06 * -1.
ENDIF.
IF wa_msgdetails-average_month_06 IS NOT INITIAL.
wa_msgdetails-average_month_06 = wa_msgdetails-average_month_06 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_06 IS NOT INITIAL.
wa_msgdetails-aggreg_month_06 = wa_msgdetails-aggreg_month_06 * -1.
ENDIF.
IF wa_msgdetails-activity_month_07 IS NOT INITIAL.
wa_msgdetails-activity_month_07 = wa_msgdetails-activity_month_07 * -1.
ENDIF.
IF wa_msgdetails-balance_month_07 IS NOT INITIAL.
wa_msgdetails-balance_month_07 = wa_msgdetails-balance_month_07 * -1.
ENDIF.
IF wa_msgdetails-average_month_07 IS NOT INITIAL.
wa_msgdetails-average_month_07 = wa_msgdetails-average_month_07 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_07 IS NOT INITIAL.
wa_msgdetails-aggreg_month_07 = wa_msgdetails-aggreg_month_07 * -1.
ENDIF.
IF wa_msgdetails-activity_month_08 IS NOT INITIAL.
wa_msgdetails-activity_month_08 = wa_msgdetails-activity_month_08 * -1.
ENDIF.
IF wa_msgdetails-balance_month_08 IS NOT INITIAL.
wa_msgdetails-balance_month_08 = wa_msgdetails-balance_month_08 * -1.
ENDIF.
IF wa_msgdetails-average_month_08 IS NOT INITIAL.
wa_msgdetails-average_month_08 = wa_msgdetails-average_month_08 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_08 IS NOT INITIAL.
wa_msgdetails-aggreg_month_08 = wa_msgdetails-aggreg_month_08 * -1.
ENDIF.
IF wa_msgdetails-activity_month_09 IS NOT INITIAL.
wa_msgdetails-activity_month_09 = wa_msgdetails-activity_month_09 * -1.
ENDIF.
IF wa_msgdetails-balance_month_09 IS NOT INITIAL.
wa_msgdetails-balance_month_09 = wa_msgdetails-balance_month_09 * -1.
ENDIF.
IF wa_msgdetails-average_month_09 IS NOT INITIAL.
wa_msgdetails-average_month_09 = wa_msgdetails-average_month_09 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_09 IS NOT INITIAL.
wa_msgdetails-aggreg_month_09 = wa_msgdetails-aggreg_month_09 * -1.
ENDIF.
IF wa_msgdetails-activity_month_10 IS NOT INITIAL.
wa_msgdetails-activity_month_10 = wa_msgdetails-activity_month_10 * -1.
ENDIF.
IF wa_msgdetails-balance_month_10 IS NOT INITIAL.
wa_msgdetails-balance_month_10 = wa_msgdetails-balance_month_10 * -1.
ENDIF.
IF wa_msgdetails-average_month_10 IS NOT INITIAL.
wa_msgdetails-average_month_10 = wa_msgdetails-average_month_10 * -1.
ENDIF.
IF wa_msgdetails-aggreg_month_10 IS NOT INITIAL.
wa_msgdetails-aggreg_month_10 = wa_msgdetails-aggreg_month_10 * -1.
ENDIF.
IF wa_msgdetails-activity_month_11 IS NOT INITIAL.
wa_msgdetails-activity_month_11 = wa_msgdetails-activity_month_11 * -1.
ENDIF.
IF wa_msgdetails-balance_month_11 IS NOT INITIAL.
wa_msgdetails-balance_month_11 = wa_msgdetails-balance_month_11 * -1.
ENDIF.
IF wa_msgdetails-average_month_11 IS NOT INITIAL.
wa_msgdetails-average_month_11 = wa_msgdetails-average_month_11 *Hi,
Are the month-ends (jan_fin etc) stored in the system? There are many variable declarations and if statements that could probably be eliminated if that is the case. More efficient use of storing those variables in internal tables so that the data is only used when needed.
Warren -
Problem with PIVOT statement and ORA-56901
Hi,
I am having a problem with PIVOT in Oracle.
I have a view in an oracle 11g database
that returns me data in the format:- (... indicates left out text)
DefinitionID ... AttributeValue FieldID
============ ============== =======
... 3000 X30a9...
... JohnN X4674...
I am then trying to use a PIVOT statement to hopefully give me data
in the format
COLUMN1 COLUMN2
======= =======
JohnN 3000
The PIVOT statement I am trying is
SELECT X4674... AS Column1,
X30A9... AS COLUMN2
FROM (SELECT instanceid, definitionid, attributevalue, FIELDID
FROM PI_ENTITY_INSTANCE_VIEW) up PIVOT (MAX(ATTRIBUTEVALUE)
FOR FIELDID IN (X4674...,X30A9... ) )
where definitionid = hextoraw('7353C67A56C74B5A8234CD16064399E8')
I have used a very similar VIEW and PIVOT statement for sql server
(with necessary changes for Oracle applied) and the
data returns in SQL Server as expected.
Unfortunately I am getting the Oracle error
ORA-56901: non-constant expression is not allowed for pivot|unpivot values
Is there anyway to get a PIVOT working on Oracle where I use the
fieldid's like I do above or is there some other way to supply the vales to the
IN clause to overcome this error?
Thank you for any help you can provide
John NugentHi, John,
Welcome to the forum!
X4674, X30A9 and os on are the literal values that you're looking for, right?
In Oracle, string literals need to be enclosed in single-quotes, like this:
FOR FIELDID IN ('X4674', 'X30A9') You might find it more convenient to assign column aliases in the PIVOT clause, like this:
PIVOT ( MAX (attributevalue)
FOR fieldid IN ( 'X4674' AS column1
, 'X30A9' AS column2
) Remember that anything inside quotes is case-sensitive, so 'X30A9' is not equal to 'X30a9'. Use UPPER (or LOWER) to do case-insensitive string comparisons.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
If you can use commonly available tables (such as those in the scott or hr schemas) to show your problem, then you don't have to post any sample data; just the results and explanation.
Always say which version of Oracle you're using. You did say you were using Oracle 11g, but there's no 11f or 11h, and sometimes the difference between, say 11.1 and 11.2 can be significant. Why not say exactly what you're using, e.g. 11.1.0.7.0?
You'll get better answers faster if you always supply this information whenever you post a question.
Edited by: Frank Kulash on Sep 22, 2011 2:09 PM
Added allliterative alias alternative
Edited by: Frank Kulash on Sep 22, 2011 4:04 PM -
Emergency: problem with update statement!
hello guys, i have a very serious problem with an update statement in pl/sql.
i had an application written in sybase, where i had the following update statement:
update mis_dik_adeia
set trexon_etos_days = days_per_year
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_dik_adeia.adeia_id between :aapo and :aews
and mis_dik_adeia.employee_id = :erg
and mis_dik_adeia.etos = :etos
and mis_plafon_adeivn.years_yphr = ( select max( a.years_yphr ) from mis_plafon_adeivn a where a.adeia_id = mis_plafon_adeivn.adeia_id and a.years_yphr <= :eth ) using sqlca;
This is working properly in sybase. When i copied this code in pl/sql it displayed me error and it's impossible to work. Then i thought to make a nested select statement like this:
update mis_dik_adeia
set trexon_etos_days = (select days_per_year
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
but as you can understand, it is working, but it doesn't produce the same results as the update statement in Sybase!
It is very important for me to solve this problem , which is a very big trouble for me for a long time.
Please if anyone can help me i would appreciate it a lot!
Regards ,
Bill...Bill,
folowing the logic of your original query by Sybase
(it's embedded SQL in Power Builder, isn't it ?):
update mis_dik_adeia
set trexon_etos_days = (select days_per_year
from mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
where
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and
exists (select 1
from mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
In 9i you can also try the following:
megre into mis_dik_adeia
using (
select
days_per_year,
mis_dik_adeia.rowid rid
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr =
(select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth)
) src
on (mis_dik_adeia.rowid = src.rid)
when matched then
update set mis_dik_adeia.trexon_etos_days = src.days_per_year
when not matched then
insert (mis_dik_adeia.adeia_id) values(0);
In 10G it can be easily:
megre into mis_dik_adeia
using (
select
days_per_year,
mis_dik_adeia.rowid rid
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr =
(select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth)
) src
on (mis_dik_adeia.rowid = src.rid)
when matched then
update set mis_dik_adeia.trexon_etos_days = src.days_per_year;
I have to notice I didn't check it carefully, so I can miss...
Rgds.
Corrected a mistake in the table name
Message was edited by:
dnikiforov -
Hi
I am trying to achieve the following in my report:
If an employee has a surname of . (dot) or a first name of . (dot), the report should not display a dot. An employee's name is made up of surname, first name and middle name which should all be concatenated together. To try to achieve this, I have the following statement in my report:
decode(e.Surname, '.', ( LTRIM(RTRIM((INITCAP(e.FIRST_NAME)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
e.FIRST_NAME, '.', ( LTRIM(RTRIM((INITCAP(e.Surname)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
( LTRIM(RTRIM((INITCAP(e.SURNAME )))||', '||INITCAP(e.FIRST_NAME)||' '||INITCAP(e.MIDDLE_NAME)) ) ) as emp_name
FROM Employee e
Problem: The above statement is only working for those employees with surname of . (dot). It's not working for first names of dot. How can I use the decode statement OR is there any other way of doing it without using the CASE statement?
It seems my decode statement doesn't work with 2 different fields (surname, firstname) being tested within one decode statement.Thanks.Thank you so much InoL . I have used the ltrim with Replace but now have a new problem.
Because I am joining Surname, First name and middle name together and put a comma after the Surname, the name now appears as follows:
, Maria Ane (if Surname is a dot)
Boiler, (if first name is a dot)
I would like to get rid of a comma and only have comma when surname or first name does not have a dot, i.e. for those people with full names e.g. Blake, Anna Marie.
InoL, how can I achieve this? Thanks. -
Hi All,
We are encountering a strange problem with the merge command.
The following statement works :-
merge into ATTRIBUTE_GROUP@US_PRODUCT_UAT a
using
select
a1.group_id,
a1.NAME,
a1.CREATE_DATE,
a1.MODIFY_DATE
from
ATTRIBUTE_GROUP_LOG a1,
product_push_wrk a2
where
a2.column_id = a1.group_id and
a2.modify_date = a1.modify_date ) b
on ( a.group_id = b.group_id)
when matched then
update set
a.NAME = b.NAME,
a.CREATE_DATE = b.CREATE_DATE,
a.MODIFY_DATE = b.MODIFY_DATE
when not matched then
insert
a.group_id,
a.NAME,
a.CREATE_DATE,
a.MODIFY_DATE
values
b.group_id,
b.NAME,
b.CREATE_DATE,
b.MODIFY_DATE
However when we change the order of the columns in the select query as follows the an error occurs : -
merge into ATTRIBUTE_GROUP@US_PRODUCT_UAT a
using
select
a1.NAME,
a1.group_id,
a1.CREATE_DATE,
a1.MODIFY_DATE
from
ATTRIBUTE_GROUP_LOG a1,
product_push_wrk a2
where
a2.column_id = a1.group_id and
a2.modify_date = a1.modify_date ) b
on ( a.group_id = b.group_id)
when matched then
update set
a.NAME = b.NAME,
a.CREATE_DATE = b.CREATE_DATE,
a.MODIFY_DATE = b.MODIFY_DATE
when not matched then
insert
a.group_id,
a.NAME,
a.CREATE_DATE,
a.MODIFY_DATE
values
b.group_id,
b.NAME,
b.CREATE_DATE,
b.MODIFY_DATE
ERROR at line 15:
ORA-00904: "B"."GROUP_ID": invalid identifier
SQL> l 15
15* on ( a.group_id = b.group_id)
The structure of the attribute_log table is as follows :-
SQL> desc ATTRIBUTE_GROUP
Name Null? Type
GROUP_ID NOT NULL NUMBER
NAME NOT NULL VARCHAR2(96)
CREATE_DATE NOT NULL DATE
MODIFY_DATE NOT NULL DATE
Any pointers to the cause of this error will be highly appreciated.
Thanks and Regards,
SumanThe table structures are as follows :-
04:17:17 SQL> desc product_push_wrk
Name Null? Type
COLUMN_ID NOT NULL NUMBER
TYPE NOT NULL VARCHAR2(10)
PARENT_COLUMN_ID NUMBER
LEVEL_NO NUMBER
MODIFY_DATE NOT NULL DATE
04:17:25 SQL> desc ATTRIBUTE_GROUP_LOG
Name Null? Type
GROUP_ID NOT NULL NUMBER
NAME NOT NULL VARCHAR2(96)
CREATE_DATE DATE
MODIFY_DATE DATE
04:18:02 SQL> desc ATTRIBUTE_GROUP
Name Null? Type
GROUP_ID NOT NULL NUMBER
NAME NOT NULL VARCHAR2(96)
CREATE_DATE DATE
MODIFY_DATE DATE -
Hi All,
I have a problem with the usage of the submit statement.
I have a report program, say report 'A'.
In the report program 'A', I have a custom screen with number '9001'.
In the screen 9001, of program A, there is a button to display ALV.
In the PAI event, under module Module call_report, i am calling another report program say B, using the statement Submit B and return, when the button is clicked.
In the report program B i have a select options. and a docking alv container in it.
Flow of the program is:
1. Run the program A.
2. Select the button on screen 9001.
3. Call the report program B.
4. Enter a value in the select option and run the program B.
5. Go back to program A by selecting back button.
The problem is as at step 4.:
Now, when i press Intervals button ( Arrow mark ) present beside the select option, my program B is getting executed and the list output is being shown.
Kindly let me know what is the problem.you can very well use the submit procedure as suggested above or you also can do "leave to screen '9001' " for the back button.
-
Problem with while statement :(
i am having a problem with my while statement, can anyone help me to get it working :(
i am trying to get the while statement to only run when the input hasnt been a yes or a no, can someone please help me.
System.out.print("Are you a Resident? (yes/no): ");
Resident = console.next(); //Requests resident status from user and puts in in Resident
while ((Resident != "yes") && (Resident != "no"))
System.out.print("error - You didnt type yes or no. Try again: ");
Resident = console.next();
}while ((Resident != "yes") && (Resident != "no"))Don't compare Strings with ==, use the equals() method instead.
while(!("yes".equals(Resident) && "no".equals(Resident))) -
Problems with Callable Statement
Hi All,
I have a problem with the callable statement that contains stored procedure.Here main thing i want to know is that can a stored procedure can be used for a database like Access.Because i am using Access as a database here.In which i have created the table Students.
The table Students contains 3 fields they are name,amount & balance.
The program is compiling well but during the runtime it is showing an error:-
"Syntax error in Create Table" .
For ur reference i have posted the code:-
import java.io.*;
import java.sql.*;
public class CallStatDemo
public static void main(String arg[])
Connection con;
CallableStatement cs;
Driver dr;
String str1,str2;
int in1,in2;
double d1;
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:Ananth"); //the dsn name is Ananth
init(con);
if(con==null)
System.out.println("Connection not Established");
else
cs=con.prepareCall("{call Payment(?,?)}");
cs.setString(1,"Raman"); //name
cs.setString(2,"2000"); //amount
cs.execute();
catch(Exception e)
System.out.println("Error Message : "+e);
static void init(Connection con)
throws SQLException
Statement stmt = con.createStatement();
stmt.execute ("create or replace procedure Payment(name in text,amount in text)is " +
" begin"+
" update Students set balance=balance-amount where name =name;"+
"end Payment;");
stmt.close();
Thanx,
m.ananthuI have no clue if Access supports stored procedures, and this surely isn't related to JDBC at all. Did you check your Access documentation?
Your posted code does not contain any CREATE TABLE statement, so where do you get your error (which line)
Most probably Access does not support stored procedures. To verify that, you should execute your CREATE PROCEDURE statement from within Access, to verify that it is a supported statement. -
Problem with switch-statement & ä, ö, ü
Hi all,
I am doing this Java online tutorial right now and have a problem with one of the exercises. Hopefully you can help me:
I have to write a program that determines the number of consonants, vowels, punctuation characters, and spaces in an input line. I found a solution, but have two questions about it:
Im unable to calculate the amount of umlauts (ä, ö, ü). Somehow the program doesnt recognize those characters. Why?
In general Im not very happy with this huge list of cases. How would you solve a problem like this? Is there a more convenient/elegant way?
Thanks in advance!
Write a program that determines the number of consonants, vowels, punctuation characters, and spaces in an input line.
Read in the line into a String (in the usual way). Now use the charAt() method in a loop to access the characters one by one.
Use a switch statement to increment the appropriate variables based on the current character. After processing the line, print out
the results.
import java.util.Scanner;
class Kap43A1
public static void main ( String[] args )
String line;
char letter;
int total, countV=0, countC=0, countS=0, countU=0, countP=0;
Scanner scan = new Scanner(System.in);
System.out.println( "Please write a sentence " );
line = scan.nextLine();
total=line.length(); //Gesamtanzahl an Zeichen des Satzes
for (int counter=0; counter<total; counter++)
letter = line.charAt(counter); //ermitteln des Buchstabens an einer bestimmten Position des Satzes
switch (letter)
case 'A': case 'a':
case 'E': case 'e':
case 'I': case 'i':
case 'O': case 'o':
case 'U': case 'u':
countV++;
break;
case 'B': case 'b': case 'C': case 'c': case 'D': case 'd': case 'F': case 'f': case 'G': case 'g': case 'H': case 'h':
case 'J': case 'j': case 'K': case 'k': case 'L': case 'l': case 'M': case 'm': case 'N': case 'n': case 'P': case 'p':
case 'Q': case 'q': case 'R': case 'r': case 'S': case 's': case 'T': case 't': case 'V': case 'v': case 'W': case 'w':
case 'X': case 'x': case 'Y': case 'y': case 'Z': case 'z':
countC++;
break;
case ' ':
countS++;
break;
case ',': case '.': case ':': case '!': case '?':
countP++;
break;
case 'Ä': case 'ä': case 'Ö': case 'ö': case 'Ü': case 'ü':
countU++;
break;
System.out.println( "Total amount of characters:\t" + total );
System.out.println( "Number of consonants:\t\t" + countC );
System.out.println( "Number of vocals:\t\t" + countV );
System.out.println( "Number of umlauts:\t\t" + countU );
System.out.println( "Number of spaces:\t\t" + countS );
System.out.println( "Number of punctuation chars:\t" + countP );
}WRE wrote:
In general Im not very happy with this huge list of cases. How would you solve a problem like this? Is there a more convenient/elegant way?I've been doing this a lot lately myself evaluating documents with 20 or so million words. Few tips:
1. Regular expressions can vastly reduce the list of cases. For example you can capture all letters from a to z or A to Z as follows [a-zA-Z]. To match a single character in a String you can then make use of the Pattern and Matcher classes, and incorporate the regular expression. e.g.
//Un-compiled code, may contain errors.
private Pattern letterPattern = Pattern.compile("[a-zA-Z]");
public int countNumberOfLettersInString(final String string) {
int count = 0;
Matcher letterMatcher = letterPattern.matcher(string);
while(letterMatcher.find()) {
count++;
return count;
}2. As mentioned above, Sets are an excellent choice. Simply declare a static variable and instantiate it using a static initializer block. Then loop over the String to determine if the character is in the given set. e.g.
//Un-compiled code, may contain errors.
private static Set<Character> macrons = new HashSet<Character>();
static {
macrons.add('ä');
macrons.add('ö');
macrons.add('ü');
public int countNumberOfMacronsInString(final String string) {
int count = 0;
for(char c : string.toCharArray()) {
if(macrons.contains(c) {
count++;
return count;
}Mel -
Oracle 9i, Rel.2 - Problems with dynam statement and cursor
Hello,
I have the following problem with Oracle 9i, Release 2:
I have a SQL-statement, which I create with the help of a configuration table. That means I don’t know how this statement looks at runtime. It could be look like this:
SELECT Att1, Att2, Att3
FROM Tab1
or this…
SELECT Att1, Att2
FROM Tab1
or this…
SELECT Att1
FROM Tab1
etc.
That means I don’t know in advance how many columns will be in the select-clause.
Here my code snippet until here:
v_query_str := 'SELECT ' || v_select_clause_str
|| ' FROM cb.' || v_table;
,,v_select_clause_str" willl be created dynamically
,,v_table" is as well from the config-table
Now I want to iterate through the result of the query and do further processing.
For this reason I wanted to use a cursor, iterate through the rows and save every value of each row in an own variable (but I don’t know the number of columns!!!).
But how can I open a cursor and iterate through it without knowing the number of columns???
The following code is NOT working:
TYPE t_dataColumnComp IS TABLE OF VARCHAR2(200);
a_dataColumnComp t_dataColumnComp;
--here I create the query…
v_query_str := 'SELECT ' || v_select_clause_str
|| ' FROM cb.' || v_table;
OPEN c_tempAtt FOR v_query_str;
LOOP
FETCH c_tempAtt INTO a_dataColumnComp; --THIS DON’T WORK
EXIT WHEN c_tempAtt%NOTFOUND;
FOR i IN 1..a_dataColumnComp.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE(a_dataColumnComp(i));
END LOOP;
END LOOP;
CLOSE c_tempAtt; --close cursor variable
Regards
HomerYou will need to use DBMS_SQL to handle this since the number of columns in the result set is not known until runtime.
See here for an example of using DBMS_SQL:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:235814350980 -
Problem with logical statements
Hi all!
we have a problem with BI Answers filter.
Our customer have a complex filter like ((EXPR1 AND EXPR2) OR (EXPR3 AND EXPR4) ...)
BI Server rewrite this expression on physycal layer as ((EXPR1 OR EXPR3) AND (EXPR1 OR EXPR4) AND (EXPR2 OR EXPR3) AND (EXPR2 OR EXPR4) ..)
Because original filter is big and complex, in the 'BI style' it's size is greater then 500 kBytes, and physical query (Oracle database) execution time is about 2 hours, while with WHERE expression written in initial style the query executed in few seconds in SQL+.
How can we suppress BI Server from transformation of logical OR statements?
thankshi,,
the star schema is correct, ----> ok
the columns selected did not affect execution time --> ok , try to build it step by step(one column at time)
the query from BI log in other SQL client executed by the same time --> you mean 2 hours??as Bi?
the problem is that in normal style query script size is few kBytes and WHERE statement consists of about 50 logical parts }
and after BI transformation query script size is 0,5 MBytes and WHERE statement consists of about 3000 logical parts } ---> try to ckeck your logical
statements again.it is not possible that.ckeck the groups that exist in filter section///are these the one you need??
Last, i mentioned have you tried the direct sql query in the answers section??what about the time there???
+
There is a tab when you make the report-------Criteria results Prompts and !!!Advanced!!
Check Advanced , the sql issued..
i hope i helped
http://greekoraclebi.blogspot.com/
///////////////////////////////////////
Maybe you are looking for
-
How do I transfer a project from someone else's FCPX, version 10.0.9, which I can no longer open, to my FCPX, version 10.1.4?
-
Ideal size for pdf portfolio?
i made mine in InDesign and exported it and it is 1M. from what i've read it should be fine, but is this too big to send to prospective employers?
-
HT4993 my phone was stolen and i had 5gig backed up on icloud and i cannot pull it up
My phone was stolen and I had 5gigs backed up on icloud and I cannot retrieve it.
-
Hi guys, I need help about AT SELECTION SCREEN ON VALUE REQUEST FOR a. Actually, I need this to be ON VALUE REQUEST FOR a and b, because I need to update both parameter with this single search help. Can anybody show me how to do this? Thanks before.
-
Hi to all Accidentally, I delete the standard work flow WS00000038 (Workflow for requisition release), and now I need use it. How I do, by to recreate this workflow ? Thank you very much Regards Rodrigo