Should I use a CASE statement to accomplish or something else
So I have the following query right now
select *
--bulk collect into possession_leaders
from
select distinct
opt.team_id,
sch.game_code,
sch.game_code_1032,
sch.home_team_id_1032,
sch.home_team_id,
sch.home_team_name,
sch.home_team_nickname,
sch.home_team_abbrev,
sch.away_team_id_1032,
sch.away_team_id,
sch.away_team_name,
sch.away_team_nickname,
sch.away_team_abbrev,
opt.possession,
rank () over (order by possession desc) as rankings_order
from
customer_data.cd_soccer_schedule sch,
soccer.soccer_optical_team_gm_stats opt
where sch.game_code = opt.game_code
and sch.season_id = 200921
and opt.possession is not null
order by rankings_order asc
)It outputs the following (Sorry for it being so cramped together):
**Note: Columns are in the same order as the query, I didn't post the column names b/c everything would look even sloppier then it does
1 5358 870986 2009050606 6 5359 Kansas City Wizards KC 5 5358 D.C. United DC 69.5% 1
2 5354 870945 2009040501 1 5354 Chicago Fire Chi 10 5362 New York Red Bulls RB 58.1% 2
3 5721 870983 2009050211 11 5363 San Jose Earthquakes SJ 17 5721 Chivas USA Chv 56% 3
4 5360 870984 2009050207 7 5360 Los Angeles Galaxy LA 10 5362 New York Red Bulls RB 55.6% 4
5 5361 870961 2009041705 5 5358 D.C. United DC 9 5361 New England Revolution NE 55.4% 5
6 5362 870988 2009050810 10 5362 New York Red Bulls RB 11 5363 San Jose Earthquakes SJ 50.1% 6
7 5363 870988 2009050810 10 5362 New York Red Bulls RB 11 5363 San Jose Earthquakes SJ 49.9% 7
8 5358 870961 2009041705 5 5358 D.C. United DC 9 5361 New England Revolution NE 44.6% 8
9 5362 870984 2009050207 7 5360 Los Angeles Galaxy LA 10 5362 New York Red Bulls RB 44.4% 9
10 5363 870983 2009050211 11 5363 San Jose Earthquakes SJ 17 5721 Chivas USA Chv 44% 10
11 5362 870945 2009040501 1 5354 Chicago Fire Chi 10 5362 New York Red Bulls RB 41.9% 11
12 5359 870986 2009050606 6 5359 Kansas City Wizards KC 5 5358 D.C. United DC 30.5% 12What i'm trying to do is basically have the output formated so that when the team_id column matches the either the home_team_id or away_team_id colum i want the following columns to be renamed as:
so if team_id = home_team_id for example then I want the following...
sch.home_team_id_1032 as team_code_1032,
sch.home_team_id as team_code,
sch.home_team_name as team_name,
sch.home_team_nickname as team_nickname,
sch.home_team_abbrev as team_abbrev
and then the away team columns would be...
sch.away_team_id_1032 as opp_team_code_1032,
sch.away_team_id as opp_team_code,
sch.away_team_name as opp_team_name,
sch.away_team_nickname as opp_team_nickname,
sch.away_team_abbrev as opp_team_abbrev
and same thing vice versa if the team_id column matches the away_team_id
How is the best way to go about this? W/a case statement? and if so can someone please post the logic/
Hi,
user652714 wrote:
So I have the following query right now
select *
--bulk collect into possession_leaders
from
select distinct
opt.team_id,
sch.game_code,
sch.game_code_1032,
sch.home_team_id_1032,
sch.home_team_id,
sch.home_team_name,
sch.home_team_nickname,
sch.home_team_abbrev,
sch.away_team_id_1032,
sch.away_team_id,
sch.away_team_name,
sch.away_team_nickname,
sch.away_team_abbrev,
opt.possession,
rank () over (order by possession desc) as rankings_order
from
customer_data.cd_soccer_schedule sch,
soccer.soccer_optical_team_gm_stats opt
where sch.game_code = opt.game_code
and sch.season_id = 200921
and opt.possession is not null
order by rankings_order asc
)It outputs the following (Sorry for it being so cramped together):
**Note: Columns are in the same order as the query, I didn't post the column names b/c everything would look even sloppier then it doesAre you sure?
The 6th column in the query is home_team name; the 6th column of the output has values like 5359 and 5354. Did you perhaps duplicate the rankings_iorder column at the beginning of the results?
Why don't you simplify the problem. Instead of 15 or 16 columns, 10 of which are twins (5 pairs of 2 columns), why don't you post a problem with 6 columns, 4 of which are twins? Pick short columns, such as home_team_abbrev rather than home_team_name.
Adding the other columns later should be easy; merely a matter of coping one of the columns ion the solution.
Whenever you have a problem, post some sample data and the results you want from that data.
In this case, the sample data can be about 6 columns from the result set below. I'll bet you can make a good sample set with fewer than 12 rows, also.
1 5358 870986 2009050606 6 5359 Kansas City Wizards KC 5 5358 D.C. United DC 69.5% 1
2 5354 870945 2009040501 1 5354 Chicago Fire Chi 10 5362 New York Red Bulls RB 58.1% 2
3 5721 870983 2009050211 11 5363 San Jose Earthquakes SJ 17 5721 Chivas USA Chv 56% 3
4 5360 870984 2009050207 7 5360 Los Angeles Galaxy LA 10 5362 New York Red Bulls RB 55.6% 4
5 5361 870961 2009041705 5 5358 D.C. United DC 9 5361 New England Revolution NE 55.4% 5
6 5362 870988 2009050810 10 5362 New York Red Bulls RB 11 5363 San Jose Earthquakes SJ 50.1% 6
7 5363 870988 2009050810 10 5362 New York Red Bulls RB 11 5363 San Jose Earthquakes SJ 49.9% 7
8 5358 870961 2009041705 5 5358 D.C. United DC 9 5361 New England Revolution NE 44.6% 8
9 5362 870984 2009050207 7 5360 Los Angeles Galaxy LA 10 5362 New York Red Bulls RB 44.4% 9
10 5363 870983 2009050211 11 5363 San Jose Earthquakes SJ 17 5721 Chivas USA Chv 44% 10
11 5362 870945 2009040501 1 5354 Chicago Fire Chi 10 5362 New York Red Bulls RB 41.9% 11
12 5359 870986 2009050606 6 5359 Kansas City Wizards KC 5 5358 D.C. United DC 30.5% 12What i'm trying to do is basically have the output formated so that when the team_id column matches the either the home_team_id or away_team_id colum i want the following columns to be renamed as:
so if team_id = home_team_id for example then I want the following...
sch.home_team_id_1032 as team_code_1032,
sch.home_team_id as team_code,
sch.home_team_name as team_name,
sch.home_team_nickname as team_nickname,
sch.home_team_abbrev as team_abbrev
and then the away team columns would be...
sch.away_team_id_1032 as opp_team_code_1032,
sch.away_team_id as opp_team_code,
sch.away_team_name as opp_team_name,
sch.away_team_nickname as opp_team_nickname,
sch.away_team_abbrev as opp_team_abbrev
and same thing vice versa if the team_id column matches the away_team_idSorry, column names have to stay the same throughout the query. This is a very unusual request, and it's hard for me to imagine what you really want.
You miight be able to do a UNION and add rows that look like column headings.
No kidding, you have to post the results you want.
No matter how clear an idea you have of what those resutls should be, no one else knows, and it's much easier to post the correct results than to accurately describe them.
Similar Messages
-
How do I use the CASE statement in the where clause?
Hello Everyone,
I have 2 queries that do what I need to do but I am trying to learn how to use the CASE statement.
I have tried to combine these 2 into one query using a case statement but don't get the results I need.
Could use some help on how to use the case syntax to get the results needed.
thanks a lot
select segment_name,
product_type,
count (distinct account_id)
FROM NL_ACCT
where
ind = 'N'
and
EM_ind = 'N'
and product_type in ('TAX','PAY')
and acct_open_dt between (cast('2006-01-17' as date)) and (cast('2006-01-17' as date) + 60)
GROUP BY 1,2
order by product_type
select segment_name,
product_type,
count (distinct account_id)
FROM NL_ACCT
where
ind = 'N'
and
EM_ind = 'N'
and product_type not in ('TAX','PAY')
and acct_open_dt between (cast('2006-01-17' as date)) and (cast('2006-01-17' as date) + 30)
group by 1,2
order by product_typeSomething like:
SELECT segment_name, product_type,
SUM(CASE WHEN account_id IN ('TAX','PAY') and
acct_open_dt BETWEEN TO_DATE('2006-01-17', 'yyyy-mm-dd') and
TO_DATE('2006-01-17', 'yyyy-mm-dd') + 60 THEN 1
ELSE 0 END) tax_pay,
SUM(CASE WHEN account_id NOT IN ('TAX','PAY') and
acct_open_dt BETWEEN TO_DATE('2006-01-17', 'yyyy-mm-dd') and
TO_DATE('2006-01-17', 'yyyy-mm-dd') + 30 THEN 1
ELSE 0 END) not_tax_pay
FROM NL_ACCT
WHERE ind = 'N' and
em_ind = 'N' and
acct_open_dt BETWEEN TO_DATE('2006-01-17', 'yyyy-mm-dd') and
TO_DATE('2006-01-17', 'yyyy-mm-dd') + 60
GROUP BY segment_name, product_type
ORDER BY product_typeNote: You cannor GROUP BY 1,2, you need to explicitly name the columns to group by.
HTH
John -
Hi,
I have a scenario where my stored procedure takes 5 parameters and the users can pass NULL or some value to these parameters and based on the parameters, I need to pull data from various tables.
Is it possible to use a case statement in the join, similar the one in the below example. I'm getting error when I use the below type of statement.
select a.*
from a
case
when parameter1=1 then
inner join a on a.id = b.id
when parameter1=2 then
inner join a on a.id = c.id
end;
Please let me know, if this type of statement works, and if it works will it create any performance issues?. If the above doesn't work, could you please give me some alternate solutions?
Thanks.Here's a technique for joining A to B or C depending on the input parameters. In theory, you are joining to both tables but the execution plan includes filters to skip whichever join is not appropriate. The drawback is that you have to do outer joins, not inner ones.
CREATE TABLE A AS SELECT LEVEL ak FROM dual CONNECT BY LEVEL <= 100;
CREATE TABLE b AS SELECT ak, bk
FROM A, (SELECT LEVEL bk FROM dual CONNECT BY LEVEL <= 10);
CREATE TABLE c(ak, ck) AS SELECT ak, bk*10 FROM b;
variable p1 NUMBER;
variable p2 NUMBER;
exec :p1 := 1;
exec :p2 := 20;
SELECT /*+ gather_plan_statistics */ A.ak, nvl(b.bk, c.ck) otherk FROM A
LEFT JOIN b ON A.ak = b.ak AND :p1 IS NOT NULL AND b.bk = :p1
LEFT JOIN c ON A.ak = c.ak AND :p1 is null and :p2 IS NOT NULL and c.ck = :p2
WHERE A.ak <= 9;
SELECT * FROM TABLE(dbms_xplan.display_cursor(NULL,NULL,'IOSTATS LAST'));
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
| 0 | SELECT STATEMENT | | 1 | | 9 |00:00:00.01 | 7 |
|* 1 | HASH JOIN OUTER | | 1 | 9 | 9 |00:00:00.01 | 7 |
|* 2 | HASH JOIN OUTER | | 1 | 9 | 9 |00:00:00.01 | 7 |
|* 3 | TABLE ACCESS FULL | A | 1 | 9 | 9 |00:00:00.01 | 3 |
| 4 | VIEW | VW_DCL_5532A50F | 1 | 9 | 9 |00:00:00.01 | 4 |
|* 5 | FILTER | | 1 | | 9 |00:00:00.01 | 4 |
|* 6 | TABLE ACCESS FULL| B | 1 | 9 | 9 |00:00:00.01 | 4 |
| 7 | VIEW | VW_DCL_5532A50F | 1 | 9 | 0 |00:00:00.01 | 0 |
|* 8 | FILTER | | 1 | | 0 |00:00:00.01 | 0 |
|* 9 | TABLE ACCESS FULL | C | 0 | 9 | 0 |00:00:00.01 | 0 |
Predicate Information (identified by operation id):
1 - access("A"."AK"="ITEM_0")
2 - access("A"."AK"="ITEM_1")
3 - filter("A"."AK"<=9)
5 - filter(:P1 IS NOT NULL)
6 - filter(("B"."AK"<=9 AND "B"."BK"=:P1))
8 - filter((:P2 IS NOT NULL AND :P1 IS NULL))
9 - filter(("C"."AK"<=9 AND "C"."CK"=:P2))
You can see that table C was not really accessed: the buffer count is 0.
exec :p1 := NULL;
SELECT /*+ gather_plan_statistics */ A.ak, nvl(b.bk, c.ck) otherk FROM A
LEFT JOIN b ON A.ak = b.ak AND :p1 IS NOT NULL AND b.bk = :p1
LEFT JOIN c ON A.ak = c.ak AND :p1 is null and :p2 IS NOT NULL and c.ck = :p2
WHERE A.ak <= 9;
SELECT * FROM TABLE(dbms_xplan.display_cursor(NULL,NULL,'IOSTATS LAST'));
Now table B is not accessed.
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads |
| 0 | SELECT STATEMENT | | 1 | | 9 |00:00:00.02 | 7 | 2 |
|* 1 | HASH JOIN OUTER | | 1 | 9 | 9 |00:00:00.02 | 7 | 2 |
|* 2 | HASH JOIN OUTER | | 1 | 9 | 9 |00:00:00.01 | 3 | 0 |
|* 3 | TABLE ACCESS FULL | A | 1 | 9 | 9 |00:00:00.01 | 3 | 0 |
| 4 | VIEW | VW_DCL_5532A50F | 1 | 9 | 0 |00:00:00.01 | 0 | 0 |
|* 5 | FILTER | | 1 | | 0 |00:00:00.01 | 0 | 0 |
|* 6 | TABLE ACCESS FULL| B | 0 | 9 | 0 |00:00:00.01 | 0 | 0 |
| 7 | VIEW | VW_DCL_5532A50F | 1 | 9 | 9 |00:00:00.01 | 4 | 2 |
|* 8 | FILTER | | 1 | | 9 |00:00:00.01 | 4 | 2 |
|* 9 | TABLE ACCESS FULL | C | 1 | 9 | 9 |00:00:00.01 | 4 | 2 | -
Can CR 2008 with XML ODBC driver using SQL CASE statement?
Hi:
when i use SQL Command to provide data to the report from XML file connection. I can not use CASE statement , CR always has error message about "CASE" word.
I test the same Statement in SQL client connected to Oracle, it runs fine.
So.. Is it driver's limitation that XML datasource can not use CASE statement inside SQL command window?
Thanks anyone's reply in advance.
JohnnychiHi Johnny,
CR supports what every the ODBC driver supports. The error you are getting is from the XML driver, CR is just passing it through.
Try using an ODBC to XML driver and then a stand-alone ODBC test tool to see if your SQL works.
If not you'll have to find another way to use the CASE statement.
Thank you
Don -
I have 6 radio buttons.i want to use a case statement to read them.
i have 6 radio buttons.i grouped them.i want to read them in a subroutine using a case statement.how can i read them
Hi Leela,
You cannot use the Case statement to read the radio buttons.
nstead you will have to use Loop at Screen under At Selection Screen Output.
Please refer to the below code or the reference:
*& Report ZHYPERION *
*& Project : SubSea7
Created on : 07/02/2007
Created by : Puneet Jhari.
*& Purpose : For SAP Interface download Hyperion.
REPORT zhyperion NO STANDARD PAGE HEADING MESSAGE-ID zhyper.
Start of Data Declaration
TYPE-POOLS : truxs,vrm.
TABLES : glpct,cepc.
DATA : var TYPE i,
total TYPE f.
DATA : BEGIN OF wa2,
ryear LIKE glpct-ryear,
rbukrs LIKE glpct-rbukrs,
racct LIKE glpct-racct,
ksl01 LIKE glpct-ksl01,
END OF wa2.
DATA : BEGIN OF wa3,
ryear LIKE glpct-ryear,
rbukrs LIKE glpct-rbukrs,
racct LIKE glpct-racct,
ksl01 LIKE glpct-ksl01,
END OF wa3.
DATA : BEGIN OF wa4,
racct LIKE glpct-racct,
END OF wa4.
DATA : BEGIN OF wa5,
rbukrs LIKE glpct-rbukrs,
racct LIKE glpct-racct,
total1(8) TYPE p DECIMALS 2,
END OF wa5.
DATA : BEGIN OF wa9,
khinr LIKE cepc-khinr,
racct LIKE glpct-racct,
total1(8) TYPE p DECIMALS 2,
END OF wa9.
DATA : BEGIN OF wa6,
khinr LIKE cepc-khinr,
prctr LIKE cepc-prctr,
rprctr LIKE glpct-rprctr,
ryear LIKE glpct-ryear,
rbukrs LIKE glpct-rbukrs,
racct LIKE glpct-racct,
ksl01 LIKE glpct-ksl01,
END OF wa6.
DATA : BEGIN OF wa7,
khinr LIKE cepc-khinr,
prctr LIKE cepc-prctr,
rprctr LIKE glpct-rprctr,
ryear LIKE glpct-ryear,
rbukrs LIKE glpct-rbukrs,
racct LIKE glpct-racct,
ksl01 LIKE glpct-ksl01,
END OF wa7.
DATA : itab3 LIKE TABLE OF wa2,
itab4 LIKE TABLE OF wa3,
itab5 LIKE TABLE OF wa4 WITH HEADER LINE,
itab6 LIKE TABLE OF wa5 WITH HEADER LINE,
itab7 LIKE TABLE OF wa6,
itab8 LIKE TABLE OF wa7,
itab10 LIKE TABLE OF wa9.
DATA : flag(1) TYPE c,
temp(6) TYPE c.
DATA : itab2 TYPE truxs_t_text_data,
itab9 TYPE truxs_t_text_data WITH HEADER LINE.
DATA : name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list,
FILNAM11 TYPE STRING,
FILNAM21 TYPE STRING.
End of Data Declaration
Begin of Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: r1 DEFAULT 'X' RADIOBUTTON GROUP g1 USER-COMMAND rad1,
r2 RADIOBUTTON GROUP g1 .
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-005.
PARAMETERS: rbukrs1 TYPE glpct-rbukrs MODIF ID ful,
khinr1 TYPE cepc-khinr AS LISTBOX VISIBLE LENGTH 20
MODIF ID sam ,
ryear1 TYPE glpct-ryear MODIF ID ful,
ryear2 TYPE glpct-ryear MODIF ID sam,
rpmax1 TYPE i MODIF ID ful,
rpmax2 TYPE i MODIF ID sam,
filnam1 TYPE rlgrap-filename MODIF ID ful,
filnam2 TYPE RLGRAP-FILENAME MODIF ID sam.
SELECTION-SCREEN END OF BLOCK b3.
End of Selection Screen
AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
PERFORM populate. "For populating the drop-down list.
CLEAR VALUE.
REFRESH LIST.
NAME = 'KHINR1'.
VALUE-KEY = '1S7_NOCASV'.
VALUE-TEXT = '1S7_NOCASV'.
APPEND VALUE TO LIST.
VALUE-KEY = '1S7_NOCJOT'.
VALUE-TEXT = '1S7_NOCJOT'.
APPEND VALUE TO LIST.
LOOP AT SCREEN. "For toggling between the selection screens.
IF r1 EQ 'X'.
IF screen-group1 = 'SAM'.
screen-active = 0.
ENDIF.
ELSEIF r2 EQ 'X'.
IF screen-group1 = 'FUL'.
screen-active = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
For the Drop-Down Listbox
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list
EXCEPTIONS
ID_ILLEGAL_NAME = 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.
Begin of Data Selection
START-OF-SELECTION.
When Company Code radio button is selected.
IF r1 EQ 'X'. "If Company Code radio button is selected.
IF rbukrs1 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
IF rpmax1 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
IF ryear1 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
IF filnam1 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
MOVE FILNAM1 TO FILNAM11.
CASE rpmax1.
WHEN '01'.
SELECT ryear rbukrs racct ksl01
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '02'.
SELECT ryear rbukrs racct ksl02
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '03'.
SELECT ryear rbukrs racct ksl03
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '04'.
SELECT ryear rbukrs racct ksl04
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '05'.
SELECT ryear rbukrs racct ksl05
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '06'.
SELECT ryear rbukrs racct ksl06
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '07'.
SELECT ryear rbukrs racct ksl07
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '08'.
SELECT ryear rbukrs racct ksl08
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '09'.
SELECT ryear rbukrs racct ksl09
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '10'.
SELECT ryear rbukrs racct ksl10
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '11'.
SELECT ryear rbukrs racct ksl11
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '12'.
SELECT ryear rbukrs racct ksl12
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '13'.
SELECT ryear rbukrs racct ksl13
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '14'.
SELECT ryear rbukrs racct ksl14
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '15'.
SELECT ryear rbukrs racct ksl15
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
WHEN '16'.
SELECT ryear rbukrs racct ksl16
FROM glpct INTO TABLE itab3 WHERE rbukrs EQ rbukrs1 AND ryear EQ ryear1.
ENDCASE.
MOVE itab3 TO itab4.
LOOP AT itab3 INTO wa2.
flag = 0.
LOOP AT itab5 INTO wa4.
IF wa2-racct EQ wa4-racct.
flag = 1.
EXIT.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM itab5.
IF flag = 1.
CONTINUE.
ENDIF.
LOOP AT itab4 INTO wa3.
IF wa2-rbukrs EQ wa3-rbukrs AND wa2-racct EQ wa3-racct AND
wa2-ryear EQ wa3-ryear.
total = total + wa3-ksl01.
ENDIF.
ENDLOOP.
wa5-rbukrs = wa2-rbukrs.
wa5-racct = wa2-racct+4(6).
wa5-total1 = total.
APPEND wa5 TO itab6.
CLEAR total.
APPEND wa2-racct TO itab5.
ENDLOOP.
If no data is available corresponding to the values entered.
IF itab6[] IS INITIAL.
MESSAGE i003.
ENDIF.
For making the file Comma separated
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = ','
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
TABLES
i_tab_sap_data = itab6
CHANGING
i_tab_converted_data = itab2
EXCEPTIONS
CONVERSION_FAILED = 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.
For downloading it to the Presentation Server
MOVE itab2[] TO itab9[].
OPEN DATASET filnam1 FOR OUTPUT IN LEGACY TEXT MODE.
LOOP AT itab9.
TRANSFER itab9 TO filnam1.
ENDLOOP.
CLOSE DATASET filnam1.
IF sy-subrc EQ 0.
MESSAGE s004.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = FILNAM11
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
IMPORTING
FILELENGTH =
tables
data_tab = itab2
FIELDNAMES =
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 eq 0.
message s004.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
When Region radio button is selected.
ELSEIF r2 EQ 'X'.
IF khinr1 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
IF rpmax2 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
IF ryear2 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
IF filnam2 IS INITIAL.
MESSAGE i002.
LEAVE TO SCREEN 1000.
ENDIF.
MOVE FILNAM2 TO FILNAM21.
CASE rpmax2.
WHEN '01'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl01
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '02'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl02
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '03'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl03
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '04'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl04
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '05'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl05
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '06'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl06
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '07'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl07
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '08'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl08
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '09'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl09
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '10'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl10
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '11'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl11
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '12'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl12
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '13'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl13
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '14'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl14
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '15'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl15
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
WHEN '16'.
SELECT ckhinr cprctr grprctr gryear grbukrs gracct g~ksl16
INTO CORRESPONDING FIELDS OF TABLE itab7
FROM ( glpct AS g
INNER JOIN cepc AS c ON grprctr = cprctr )
WHERE c~khinr = khinr1 AND
g~ryear = ryear2.
ENDCASE.
MOVE itab7 TO itab8.
LOOP AT itab7 INTO wa6.
flag = 0.
LOOP AT itab5 INTO wa4.
IF wa6-racct EQ wa4-racct.
flag = 1.
EXIT.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM itab5.
IF flag = 1.
CONTINUE.
ENDIF.
LOOP AT itab8 INTO wa7.
IF wa6-rbukrs EQ wa7-rbukrs AND wa6-racct EQ wa7-racct AND
wa6-ryear EQ wa7-ryear.
total = total + wa7-ksl01.
ENDIF.
ENDLOOP.
wa9-khinr = khinr1.
wa9-racct = wa6-racct+4(6).
wa9-total1 = total.
APPEND wa9 TO itab10.
CLEAR total.
APPEND wa6-racct TO itab5.
ENDLOOP.
*If no data is available corresponding to the values entered.
IF itab10 IS INITIAL.
MESSAGE i003.
ENDIF.
For making the file Comma separated
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = ','
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
TABLES
i_tab_sap_data = itab10
CHANGING
i_tab_converted_data = itab2
EXCEPTIONS
CONVERSION_FAILED = 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.
For downloading it to the Presentation Server
MOVE itab2[] TO itab9[].
OPEN DATASET filnam2 FOR OUTPUT IN LEGACY TEXT MODE.
LOOP AT itab9.
TRANSFER itab9 TO filnam2.
ENDLOOP.
CLOSE DATASET filnam2.
IF sy-subrc EQ 0.
MESSAGE s004.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = FILNAM21
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
IMPORTING
FILELENGTH =
tables
data_tab = itab2
FIELDNAMES =
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 eq 0.
message s004.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
*& Form POPULATE
text
FORM populate.
CLEAR value.
REFRESH list.
name = 'KHINR1'.
value-key = '1S7_SUBSEA'.
value-text = '1S7_SUBSEA'.
APPEND value TO list.
value-key = '1S7_GEN'.
value-text = '1S7_GEN'.
APPEND value TO list.
value-key = '1S7'.
value-text = '1S7'.
APPEND value TO list.
value-key = '1S7_CORPTP'.
value-text = '1S7_CORPTP'.
APPEND value TO list.
value-key = '1S7_BRRE'.
value-text = '1S7_BRRE'.
APPEND value TO list.
value-key = '1S7_BRCON'.
value-text = '1S7_BRCON'.
APPEND value TO list.
value-key = '1S7_BRCJOB'.
value-text = '1S7_BRCJOB'.
APPEND value TO list.
value-key = '1S7_BRCJBU'.
value-text = '1S7_BRCJBU'.
APPEND value TO list.
value-key = '1S7_BRCJCO'.
value-text = '1S7_BRCJCO'.
APPEND value TO list.
value-key = '1S7_BRCJIR'.
value-text = '1S7_BRCJIR'.
APPEND value TO list.
value-key = '1S7_BRCJEN'.
value-text = '1S7_BRCJEN'.
APPEND value TO list.
value-key = '1S7_BRCJPI'.
value-text = '1S7_BRCJPI'.
APPEND value TO list.
value-key = '1S7_BRCJSU'.
value-text = '1S7_BRCJSU'.
APPEND value TO list.
value-key = '1S7_BRCJFL'.
value-text = '1S7_BRCJFL'.
APPEND value TO list.
value-key = '1S7_BRCJOT'.
value-text = '1S7_BRCJOT'.
APPEND value TO list.
value-key = '1S7_BRCASV'.
value-text = '1S7_BRCASV'.
APPEND value TO list.
value-key = '1S7_BRCASE'.
value-text = '1S7_BRCASE'.
APPEND value TO list.
value-key = '1S7_BRCOOC'.
value-text = '1S7_BRCOOC'.
APPEND value TO list.
value-key = '1S7_BRCOHD'.
value-text = '1S7_BRCOHD'.
APPEND value TO list.
value-key = '1S7_BRCGEN'.
value-text = '1S7_BRCGEN'.
APPEND value TO list.
value-key = '1S7_BRDRI'.
value-text = '1S7_BRDRI'.
APPEND value TO list.
value-key = '1S7_BRDJOB'.
value-text = '1S7_BRDJOB'.
APPEND value TO list.
value-key = '1S7_BRDASV'.
value-text = '1S7_BRDASV'.
APPEND value TO list.
value-key = '1S7_BRDASE'.
value-text = '1S7_BRDASE'.
APPEND value TO list.
value-key = '1S7_BRDAEW'.
value-text = '1S7_BRDAEW'.
APPEND value TO list.
value-key = '1S7_BRDAEO'.
value-text = '1S7_BRDAEO'.
APPEND value TO list.
value-key = '1S7_BRDAET'.
value-text = '1S7_BRDAET'.
APPEND value TO list.
value-key = '1S7_BRDOOC'.
value-text = '1S7_BRDOOC'.
APPEND value TO list.
value-key = '1S7_BRDOHD'.
value-text = '1S7_BRDOHD'.
APPEND value TO list.
value-key = '1S7_BRVER'.
value-text = '1S7_BRVER'.
APPEND value TO list.
value-key = '1S7_BRVJOB'.
value-text = '1S7_BRVJOB'.
APPEND value TO list.
value-key = '1S7_BRVASV'.
value-text = '1S7_BRVASV'.
APPEND value TO list.
value-key = '1S7_BRVASE'.
value-text = '1S7_BRVASE'.
APPEND value TO list.
value-key = '1S7_BRVOOC'.
value-text = '1S7_BRVOOC'.
APPEND value TO list.
value-key = '1S7_BRVOHD'.
value-text = '1S7_BRVOHD'.
APPEND value TO list.
value-key = '1S7_UKRE'.
value-text = '1S7_UKRE'.
APPEND value TO list.
value-key = '1S7_UKCON'.
value-text = '1S7_UKCON'.
APPEND value TO list.
value-key = '1S7_UKCJOB'.
value-text = '1S7_UKCJOB'.
APPEND value TO list.
value-key = '1S7_UKCJBU'.
value-text = '1S7_UKCJBU'.
APPEND value TO list.
value-key = '1S7_UKCJCO'.
value-text = '1S7_UKCJCO'.
APPEND value TO list.
value-key = '1S7_UKCJIR'.
value-text = '1S7_UKCJIR'.
APPEND value TO list.
value-key = '1S7_UKCJEN'.
value-text = '1S7_UKCJEN'.
APPEND value TO list.
value-key = '1S7_UKCJPI'.
value-text = '1S7_UKCJPI'.
APPEND value TO list.
value-key = '1S7_UKCJSU'.
value-text = '1S7_UKCJSU'.
APPEND value TO list.
value-key = '1S7_UKCJFL'.
value-text = '1S7_UKCJFL'.
APPEND value TO list.
value-key = '1S7_UKCJOT'.
value-text = '1S7_UKCJOT'.
APPEND value TO list.
value-key = '1S7_UKCASV'.
value-text = '1S7_UKCASV'.
APPEND value TO list.
value-key = '1S7_UKCASE'.
value-text = '1S7_UKCASE'.
APPEND value TO list.
value-key = '1S7_UKCOOC'.
value-text = '1S7_UKCOOC'.
APPEND value TO list.
value-key = '1S7_UKBA'.
value-text = '1S7_UKBA'.
APPEND value TO list.
value-key = '1S7_UKBATE'.
value-text = '1S7_UKBATE'.
APPEND value TO list.
value-key = '1S7_UKCOHD'.
value-text = '1S7_UKCOHD'.
APPEND value TO list.
value-key = '1S7_UKCGEN'.
value-text = '1S7_UKCGEN'.
APPEND value TO list.
value-key = '1S7_UKDRI'.
value-text = '1S7_UKDRI'.
APPEND value TO list.
value-key = '1S7_UKDJOB'.
value-text = '1S7_UKDJOB'.
APPEND value TO list.
value-key = '1S7_UKDASV'.
value-text = '1S7_UKDASV'.
APPEND value TO list.
value-key = '1S7_UKDASE'.
value-text = '1S7_UKDASE'.
APPEND value TO list.
value-key = '1S7_UKDAEW'.
value-text = '1S7_UKDAEW'.
APPEND value TO list.
value-key = '1S7_UKDAEO'.
value-text = '1S7_UKDAEO'.
APPEND value TO list.
value-key = '1S7_UKDAET'.
value-text = '1S7_UKDAET'.
APPEND value TO list.
value-key = '1S7_UKDOOC'.
value-text = '1S7_UKDOOC'.
APPEND value TO list.
value-key = '1S7_UKDOHD'.
value-text = '1S7_UKDOHD'.
APPEND value TO list.
value-key = '1S7_UKVER'.
value-text = '1S7_UKVER'.
APPEND value TO list.
value-key = '1S7_UKVJOB'.
value-text = '1S7_UKVJOB'.
APPEND value TO list.
value-key = '1S7_UKVASV'.
value-text = '1S7_UKVASV'.
APPEND value TO list.
value-key = '1S7_UKVASE'.
value-text = '1S7_UKVASE'.
APPEND value TO list.
value-key = '1S7_UKVOOC'.
value-text = '1S7_UKVOOC'.
APPEND value TO list.
value-key = '1S7_UKVOHD'.
value-text = '1S7_UKVOHD'.
APPEND value TO list.
value-key = '1S7_NORE'.
value-text = '1S7_NORE'.
APPEND value TO list.
value-key = '1S7_NOCON'.
value-text = '1S7_NOCON'.
APPEND value TO list.
value-key = '1S7_NOCJOB'.
value-text = '1S7_NOCJOB'.
APPEND value TO list.
value-key = '1S7_NOCJBU'.
value-text = '1S7_NOCJBU'.
APPEND value TO list.
value-key = '1S7_NOCJCO'.
value-text = '1S7_NOCJCO'.
APPEND value TO list.
value-key = '1S7_NOCJIR'.
value-text = '1S7_NOCJIR'.
APPEND value TO list.
value-key = '1S7_NOCJEN'.
value-text = '1S7_NOCJEN'.
APPEND value TO list.
value-key = '1S7_NOCJPI'.
value-text = '1S7_NOCJPI'.
APPEND value TO list.
value-key = '1S7_NOCJSU'.
value-text = '1S7_NOCJSU'.
APPEND value TO list.
value-key = '1S7_NOCJFL'.
value-text = '1S7_NOCJFL'.
APPEND value TO list.
value-key = '1S7_NOCJOT'.
value-text = '1S7_NOCJOT'.
APPEND value TO list.
value-key = '1S7_NOCASV'.
value-text = '1S7_NOCASV'.
APPEND value TO list.
value-key = '1S7_NOCASE'.
value-text = '1S7_NOCASE'.
APPEND value TO list.
value-key = '1S7_NOCOOC'.
value-text = '1S7_NOCOOC'.
APPEND value TO list.
value-key = '1S7_NOCOHD'.
value-text = '1S7_NOCOHD'.
APPEND value TO list.
value-key = '1S7_NOCGEN'.
value-text = '1S7_NOCGEN'.
APPEND value TO list.
value-key = '1S7_NODRI'.
value-text = '1S7_NODRI'.
APPEND value TO list.
value-key = '1S7_NODJOB'.
value-text = '1S7_NODJOB'.
APPEND value TO list.
value-key = '1S7_NODASV'.
value-text = '1S7_NODASV'.
APPEND value TO list.
value-key = '1S7_NODASE'.
value-text = '1S7_NODASE'.
APPEND value TO list.
value-key = '1S7_NODAEW'.
value-text = '1S7_NODAEW'.
APPEND value TO list.
value-key = '1S7_NODAEO'.
value-text = '1S7_NODAEO'.
APPEND value TO list.
value-key = '1S7_NODAET'.
value-text = '1S7_NODAET'.
APPEND value TO list.
value-key = '1S7_NODOOC'.
value-text = '1S7_NODOOC'.
APPEND value TO list.
value-key = '1S7_NODOHD'.
value-text = '1S7_NODOHD'.
APPEND value TO list.
value-key = '1S7_NOVER'.
value-text = '1S7_NOVER'.
APPEND value TO list.
value-key = '1S7_NOVJOB'.
value-text = '1S7_NOVJOB'.
APPEND value TO list.
value-key = '1S7_NOVASV'.
value-text = '1S7_NOVASV'.
APPEND value TO list.
value-key = '1S7_NOVASE'.
value-text = '1S7_NOVASE'.
APPEND value TO list.
value-key = '1S7_NOVOOC'.
value-text = '1S7_NOVOOC'.
APPEND value TO list.
value-key = '1S7_NOVOHD'.
value-text = '1S7_NOVOHD'.
APPEND value TO list.
value-key = '1S7_GORE'.
value-text = '1S7_GORE'.
APPEND value TO list.
value-key = '1S7_GOCON'.
value-text = '1S7_GOCON'.
APPEND value TO list.
value-key = '1S7_GOCJOB'.
value-text = '1S7_GOCJOB'.
APPEND value TO list.
value-key = '1S7_GOCJBU'.
value-text = '1S7_GOCJBU'.
APPEND value TO list.
value-key = '1S7_GOCJCO'.
value-text = '1S7_GOCJCO'.
APPEND value TO list.
value-key = '1S7_GOCJIR'.
value-text = '1S7_GOCJIR'.
APPEND value TO list.
value-key = '1S7_GOCJEN'.
value-text = '1S7_GOCJEN'.
APPEND value TO list.
value-key = '1S7_GOCJPI'.
value-text = '1S7_GOCJPI'.
APPEND value TO list.
value-key = '1S7_GOCJSU'.
value-text = '1S7_GOCJSU'.
APPEND value TO list.
value-key = '1S7_GOCJFL'.
value-text = '1S7_GOCJFL'.
APPEND value TO list.
value-key = '1S7_GOCJOT'.
value-text = '1S7_GOCJOT'.
APPEND value TO list.
value-key = '1S7_GOCASV'.
value-text = '1S7_GOCASV'.
APPEND value TO list.
value-key = '1S7_GOCASE'.
value-text = '1S7_GOCASE'.
APPEND value TO list.
value-key = '1S7_GOCOOC'.
value-text = '1S7_GOCOOC'.
APPEND value TO list.
value-key = '1S7_GOCOHD'.
value-text = '1S7_GOCOHD'.
APPEND value TO list.
value-key = '1S7_GOCGEN'.
value-text = '1S7_GOCGEN'.
APPEND value TO list.
value-key = '1S7_GODRI'.
value-text = '1S7_GODRI'.
APPEND value TO list.
value-key = '1S7_GODJOB'.
value-text = '1S7_GODJOB'.
APPEND value TO list.
value-key = '1S7_GODASV'.
value-text = '1S7_GODASV'.
APPEND value TO list.
value-key = '1S7_GODASE'.
value-text = '1S7_GODASE'.
APPEND value TO list.
value-key = '1S7_GODAEW'.
value-text = '1S7_GODAEW'.
APPEND value TO list.
value-key = '1S7_GODAEO'.
value-text = '1S7_GODAEO'.
APPEND value TO list.
value-key = '1S7_GODAET'.
value-text = '1S7_GODAET'.
APPEND value TO list.
value-key = '1S7_GODOOC'.
value-text = '1S7_GODOOC'.
APPEND value TO list.
value-key = '1S7_GODOHD'.
value-text = '1S7_GODOHD'.
APPEND value TO list.
value-key = '1S7_GOVER'.
value-text = '1S7_GOVER'.
APPEND value TO list.
value-key = '1S7_GOVJOB'.
value-text = '1S7_GOVJOB'.
APPEND value TO list.
value-key = '1S7_GOVASV'.
value-text = '1S7_GOVASV'.
APPEND value TO list.
value-key = '1S7_GOVASE'.
value-text = '1S7_GOVASE'.
APPEND value TO list.
value-key = '1S7_GOVOOC'.
value-text = '1S7_GOVOOC'.
APPEND value TO list.
value-key = '1S7_GOVOHD'.
value-text = '1S7_GOVOHD'.
APPEND value TO list.
value-key = '1S7_GVRE'.
value-text = '1S7_GVRE'.
APPEND value TO list.
value-key = '1S7_GVCON'.
value-text = '1S7_GVCON'.
APPEND value TO list.
value-key = '1S7_GVCJOB'.
value-text = '1S7_GVCJOB'.
APPEND value TO list.
value-key = '1S7_GVCJBU'.
value-text = '1S7_GVCJBU'.
APPEND value TO list.
value-key = '1S7_GVCJCO'.
value-text = '1S7_GVCJCO'.
APPEND value TO list.
value-key = '1S7_GVCJIR'.
value-text = '1S7_GVCJIR'.
APPEND value TO list.
value-key = '1S7_GVCJEN'.
value-text = '1S7_GVCJEN'.
APPEND value TO list.
value-key = '1S7_GVCJPI'.
value-text = '1S7_GVCJPI'.
APPEND value TO list.
value-key = '1S7_GVCJSU'.
value-text = '1S7_GVCJSU'.
APPEND value TO list.
value-key = '1S7_GVCJFL'.
value-text = '1S7_GVCJFL'.
APPEND value TO list.
value-key = '1S7_GVCJOT'.
value-text = '1S7_GVCJOT'.
APPEND value TO list.
value-key = '1S7_GVCASV'.
value-text = '1S7_GVCASV'.
APPEND value TO list.
value-key = '1S7_GVCASE'.
value-text = '1S7_GVCASE'.
APPEND value TO list.
value-key = '1S7_GVCOOC'.
value-text = '1S7_GVCOOC'.
APPEND value TO list.
value-key = '1S7_GVCOHD'.
value-text = '1S7_GVCOHD'.
APPEND value TO list.
value-key = '1S7_GVCGEN'.
value-text = '1S7_GVCGEN'.
APPEND value TO list.
value-key = '1S7_GVDRI'.
value-text = '1S7_GVDRI'.
APPEND value TO list.
value-key = '1S7_GVDJOB'.
value-text = '1S7_GVDJOB'.
APPEND value TO list.
value-key = '1S7_GVDASV'.
value-text = '1S7_GVDASV'.
APPEND value TO list.
value-key = '1S7_GVDASE'.
value-text = '1S7_GVDASE'.
APPEND value TO list.
value-key = '1S7_GVDOOC'.
value-text = '1S7_GVDOOC'.
APPEND value TO list.
value-key = '1S7_GVDOHD'.
value-text = '1S7_GVDOHD'.
APPEND value TO list.
value-key = '1S7_GVVER'.
value-text = '1S7_GVVER'.
APPEND value TO list.
value-key = '1S7_GVVJOB'.
value-text = '1S7_GVVJOB'.
APPEND value TO list.
value-key = '1S7_GVVASV'.
value-text = '1S7_GVVASV'.
APPEND value TO list.
value-key = '1S7_GVVASE'.
value-text = '1S7_GVVASE'.
APPEND value TO list.
value-key = '1S7_GVVOOC'.
value-text = '1S7_GVVOOC'.
APPEND value TO list.
value-key = '1S7_GVVOHD'.
value-text = '1S7_GVVOHD'.
APPEND value TO list.
value-key = '1S7_GCRE'.
value-text = '1S7_GCRE'.
APPEND value TO list.
value-key = '1S7_GCCON'.
value-text = '1S7_GCCON'.
APPEND value TO list.
value-key = '1S7_GCCJOB'.
value-text = '1S7_GCCJOB'.
APPEND value TO list.
value-key = '1S7_GCCJBU'.
value-text = '1S7_GCCJBU'.
APPEND value TO list.
value-key = '1S7_GCCJCO'.
value-text = '1S7_GCCJCO'.
APPEND value TO list.
value-key = '1S7_GCCJIR'.
value-text = '1S7_GCCJIR'.
APPEND value TO list.
value-key = '1S7_GCCJEN'.
value-text = '1S7_GCCJEN'.
APPEND value TO list.
value-key = '1S7_GCCJPI'.
value-text = '1S7_GCCJPI'.
APPEND value TO list.
value-key = '1S7_GCCJSU'.
value-text = '1S7_GCCJSU'.
APPEND value TO list.
value-key = '1S7_GCCJFL'.
value-text = '1S7_GCCJFL'.
APPEND value TO list.
value-key = '1S7_GCCJOT'.
value-text = '1S7_GCCJOT'.
APPEND value TO list.
value-key = '1S7_GCCASV'.
value-text = '1S7_GCCASV'.
APPEND value TO list.
value-key = '1S7_GCCASE'.
value-text = '1S7_GCCASE'.
APPEND value TO list.
value-key = '1S7_GCCOOC'.
value-text = '1S7_GCCOOC'.
APPEND value TO list.
value-key = '1S7_GCCOHD'.
value-text = '1S7_GCCOHD'.
APPEND value TO list.
value-key = '1S7_GCCRD'.
value-text = '1S7_GCCRD'.
APPEND value TO list.
value-key = '1S7_GCCGEN'.
value-text = '1S7_GCCGEN'.
APPEND value TO list.
value-key = '1S7_GCDRI'.
value-text = '1S7_GCDRI'.
APPEND value TO list.
value-key = '1S7_GCDJOB'.
value-text = '1S7_GCDJOB'.
APPEND value TO list.
value-key = '1S7_GCDASV'.
value-text = '1S7_GCDASV'.
APPEND value TO list.
value-key = '1S7_GCDASE'.
value-text = '1S7_GCDASE'.
APPEND value TO list.
value-key = '1S7_GCDOOC'.
value-text = '1S7_GCDOOC'.
APPEND value TO list.
value-key = '1S7_GCDOHD'.
value-text = '1S7_GCDOHD'.
APPEND value TO list.
value-key = '1S7_GCVER'.
value-text = '1S7_GCVER'.
APPEND value TO list.
value-key = '1S7_GCVJOB'.
value-text = '1S7_GCVJOB'.
APPEND value TO list.
value-key = '1S7_GCVASV'.
value-text = '1S7_GCVASV'.
APPEND value TO list.
value-key = '1S7_GCVASE'.
value-text = '1S7_GCVASE'.
APPEND value TO list.
value-key = '1S7_GCVOOC'.
value-text = '1S7_GCVOOC'.
APPEND value TO list.
value-key = '1S7_GCVOHD'. -
How to use a case statement in where clause
Hi All,
I have a requirement which is to bring all the claims that are created in the last month.So, i wrote a query something like this
select * from claims
where
(Month(ClaimOpenDate) = Month(Getdate())-1 and year(claimopendate) = year(getDate()))
which would give me any new claims created in last month of current year, but this condition fails if we are in the first month of a new year( lets say if we are in 2016 jan then month(getdate())-1 would be 0 and year(getdate()) would be 2016 so we dont
find any records where year is 2016 and month is 0 for claimopen).
So, i would like to use a case statament or something which can help me get around this one.
Can someone please help me with any suggestions?
ThanksHi Jason,
Thanks a lot for your help. This is what exactly i am looking for but i just gave a sample query above below is my original query
select
row_number() over (order by [ClaimNumber]) as DataElementName
,c.PolicyNumber as PolicyNum
, c.FirstName as CustNameF
,c.LastName as CustNameL
,c.PolicyForm as PolType
,'Homesite' as Company
,[ClaimNumber] as ClaimNum
,E.office as Ofc
,e.Supervisior_FullName as Team
, RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FORepF
, case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FORepL
,e.AdjusterID as RepC -- not sure
,CONVERT ( varchar,c.LossDate ,101) as DOL
,convert (varchar,c.ClaimOpenDate,101) as DOR
,rtrim(c.Loss_State) as LossSt
,c.Loss_ZipCode as LossZIP
,c.Loss_City as LossCity
,c.LossType as FOL
,'' as PR
,'' as PRNum
,1 as FeaNum
,'HO' as FeaType
,case when rtrim(c.claimStatus)= 'Closed' then 'Closed' else 'Open' end as FeaStat
,'' as FeaOpen
,'' as FeaClosed
,s.PaymentIndemnityAmount as PaidAmt
,s.ReserveIndemnityAmount as Reserve
,'' as Sub
,'' as Sal
,'' as FeatOwnOfc
,e.Supervisior_FullName as FeatOwnTeam
,RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FeatOwnRepF
,case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FeatOwnRepL
,e.AdjusterID as FeatOwnRepCode
,NULL AS Description --not sure
from [Stg].[HS_DW_RV_Claims] c
inner join [dbo].[Claims_Primary_Adjuster] a on a.CLAIM_NUMBER = c.ClaimNumber
inner join [dbo].[vw_Adjuster] e on e.adjuster_Name = a.primary_ADJUSTER
left outer join [Stg].[HS_DW_LossClaimSummary] s on c.ClaimKey=s.ClaimKey
where c.LoadSource = 'CMS'
and
(s.PaymentIndemnityAmount <>0 or s.PaymentExpenseAmount <>0)
and
ClaimOpenDate BETWEEN DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP) -1, 0) AND DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP), 0)
UNION ALL
select
row_number() over (order by [ClaimNumber]) as DataElementName
,c.PolicyNumber as PolicyNum
, c.FirstName as CustNameF
,c.LastName as CustNameL
,c.PolicyForm as PolType
,'Homesite' as Company
,[ClaimNumber] as ClaimNum
,E.office as Ofc
,e.Supervisior_FullName as Team
, RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FORepF
, case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FORepL
,e.AdjusterID as RepC -- not sure
,CONVERT ( varchar,c.LossDate ,101) as DOL
,convert (varchar,c.ClaimOpenDate,101) as DOR
,rtrim(c.Loss_State) as LossSt
,c.Loss_ZipCode as LossZIP
,c.Loss_City as LossCity
,c.LossType as FOL
,'' as PR
,'' as PRNum
,1 as FeaNum
,'HO' as FeaType
,case when rtrim(c.claimStatus)= 'Closed' then 'Closed' else 'Open' end as FeaStat
,'' as FeaOpen
,'' as FeaClosed
,s.PaymentIndemnityAmount as PaidAmt
,s.ReserveIndemnityAmount as Reserve
,'' as Sub
,'' as Sal
,'' as FeatOwnOfc
,e.Supervisior_FullName as FeatOwnTeam
,RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FeatOwnRepF
,case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FeatOwnRepL
,e.AdjusterID as FeatOwnRepCode
,DESCRIPTION --not sure
from Stg.IG_Document D
inner join [Stg].[HS_DW_RV_Claims] c on D.PARENTREF = C.ClaimNumber
inner join [dbo].[Claims_Primary_Adjuster] a on a.CLAIM_NUMBER = c.ClaimNumber
inner join [dbo].[vw_Adjuster] e on e.adjuster_Name = a.primary_ADJUSTER
left outer join [Stg].[HS_DW_LossClaimSummary] s on c.ClaimKey=s.ClaimKey
where c.LoadSource = 'CMS'
and
DESCRIPTION like '%Denial Letter%'
and
ClaimOpenDate BETWEEN DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP) -1, 0) AND DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP), 0)
So if i use your logic in the end for both the where clauses its been more than 10 minutes and the query is still running however if i use my old method it doesnt even take a second. Looks like its affecting the execution plan. Any suggestions to get around
this one please?
Thanks -
How can I do mirroring of a screen from new iPad to hdtv using apple tv and still work on something else in my ipad
You don't. Mirroring is duplicating your ipad screen on another projector - so you can't have another app going on your iPad without it also showing up on the projected image. Some apps are designed so that you see a different image in the iPad than the mirrored out display, but even then you're within the app itself.
-
I am trying to activate Firefox on my Ipad. I saved the download file. When I opened it and tried to drag the icon into my application file, I got a pop-up message saying that a newer version of Firefox existed and did I want to replace it. Should I replace my Firefox 5 or is there something else I can do?
I'm afraid I'll lose my browser.* Download a new copy of the Firefox program: http://www.mozilla.com/firefox/all.html
* Trash the current Firefox application to do a clean (re-)install.
* Install the new version that you have downloaded.
Your profile data is stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder], so you won't lose your bookmarks and other personal data. -
Need help in using a case statement in expression operator
Hi All,
I am using OWB version 10.2.0.1.0.
My requirement is to add a new column called call _zone_key in expression operator and map it to the target table. I need to use the below expression for populating call_zone_key values
Expression:
case when (INGRP1.CHARGETYPE in ('O','F') or INGRP1.TARIFF_GROUP in ('SMSINT','MMSINT')or ( INGRP1.CALL_TYPE = '002' and INGRP1.TARIFF_GROUP = 'MTV'))
then
(select call_zone_reltn_key from call_zone_reltn where
call_zone_cd=substr(case
when substr( INGRP1.B_SUBNO,1,2)='00'
then
substr( INGRP1.B_SUBNO,3)
else substr( INGRP1.B_SUBNO,1)
end,1,length(call_zone_cd))and rownum=1)
else -1
end
All the columns needed for using the above expression is available in INGRP1 but still I am unable to deploy the mapping using above expression. Call_zone_reltn table is also imported to the module. I am getting below error
Error:
Warning
ORA-06550: line 4980, column 2:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternativ
NEW_MOD_MAP_CELL_USAGE_FCT_PRE
Create
Warning
ORA-06550: line 4989, column 43:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
* & - + ; / at for mod remainder rem <an exponent (**)> and
or group having intersect minus order start union where
connect || multiset
If i replace the expression with numbers such as 1 or 2, I am able to deploy the mapping.
Kindly help in fixing this issue.
Thanks,
KabilanYou can't use the SELECT statement inside the expression, you need to join both tables before the expression. Use a Join operator with this JOIN condition:
CALCULATED_CALL_ZONE_CD = call_zone_reltn.call_zone_cd ( + )
Where Calculated_call_zone_cd proceed from a previous expression:
CALCULATED_CALL_ZONE_CD = substr(case when substr( INGRP1.B_SUBNO,1,2)='00' then substr( INGRP1.B_SUBNO,3) else substr( INGRP1.B_SUBNO,1) end,1,length(call_zone_cd))
And after joining both tables, you can use another expression to get the rownum, then another filter operator to keep only the rownum = 1, and now you can use your expression without the SELECT, using the call_zone_cd column from the outgroup in the joiner operator (you need to include that column in the filter operator to use it).
Regards
ANA GH -
Should I use a case for my iPhone 5?
I have the iPhone 5 with AppleCare+. I am very carefull with all of my Apple products. I love the design of the iPhone 5, but am sadly using a case right now. Should I leave it on or take it off?
The black/shale verion of the Iphone 5 has reported as easily stratched so if you have this version, then I would use a case. There are some nice cases that have holes in them for the Apple logo, etc at the rear and the Iphone 5 versions are out. I have seen a nice brushed aluminium and black cash which went onto the Iphone 5 nicely... it was very chic indeed and the Apple logos were very visable. That said, if you have a silver and white version and are careful, you should not need a case with it IMO. Those versions are better QC on it. I believe Apple have upgraded their QC on the hardware production due to scratch compliants which has being successful despite a strike and riot by 4000 workers making them in central China whose beef was not being trained properly on it. Turns out, the actual trigger for the strike was being made work through a Chinese national holiday week which normally sees businesses close down...
I have ordered my new black/shale version of the Iphone 5 and will get it early november, I expect it to be pre upgrade of the QC but as far as scuffing is concerned, its only in a small % of models which Apple found unacceptable and I hope Im not one of those folks getting a scuff prone phone. If I am, Ill be back to Apple looking for a new one that is upto their standards of quality and mine. For the price, I would expect nothing less.. -
T-SQL: SET Statement Using a Case Statement is not returning a value
SQL VER: 2008
Please see the attached screenshot from SSMS. The Set statement below is not returned a value or may be returning a zero value. The AllocPercent field is set to zero in code preceeding this Update Statement:
AllocPercent
=
CASE
WHEN AllocBase
IS
NULL
OR AllocBase
= 0
THEN 0
ELSE PM_Input/AllocBase
END
As you can see by the screen shot from the Select Statement that is displaying the results after the Update Statement is completed, the value of AllocPercent is = 0 even though all the values necessary for it to compute a value > 0 are present in the
table. Incidentally, the values in both the AllocBase and PM_Input fields are the same before the Update Statement is ran, as shown in the Select ran after the Update Statement.
I have ran this type of code several times with never a problem. This seems really simple, but I just can't seem to get it to compute.
Any help would be greatly appreciated.
Regards,
bob sutor
Bob SutorYep--This statement is running in a Stored Procedure and inside its own block statement.
I did get a response that suggested I change the SET statement as follows, that worked:
AllocPercent
= CASE WHEN AllocBase IS NULL OR AllocBase = 0 THEN 0.00 ELSE cast(PM_Input*1.0/AllocBase*1.0
as decimal(6,2)) END
Your response did get me thinking which was great! I appreciate your help.
Regards,
...bob sutor
Bob Sutor -
Should i use nested SQL Statements? or PL/SQL?
here is my table:
let's call this table total_stats, with 2 fields (columns) Date and Total.
Row | Total
ROW1 | 12508
ROW2 | 12526
I am going crazy trying to write some sql or pl/sql that will give me the following results: the result of row2Total - row1Total. I need the delta of the two Total's rows.
Is there an easy way to do this without writing multiple nested sql statments?
Should i write a procedure that uses cursors to help me get my end result?
thanksUse analytic functions - LAG and LEAD - to access other rows in the result set in a current row. This should get you started:
SQL> create table total_stats as
2 select sysdate-1 as some_date, 12508 as some_value from dual
3 union all
4 select sysdate as some_date, 12526 as some_value from dual
5 /
Table created.
SQL> select * from total_stats;
SOME_DATE SOME_VALUE
12/11/2007 12508
13/11/2007 12526
2 rows selected.
SQL> select
2 some_date,
3 some_value as this_dates_value,
4 lag(some_value) over (order by some_date) as the_previous_dates_value
5 from
6 total_stats
7 /
SOME_DATE THIS_DATES_VALUE THE_PREVIOUS_DATES_VALUE
12/11/2007 12508
13/11/2007 12526 12508
2 rows selected. -
Which info object should be used for Financial statement line (BPS and BCS)
Hi experts.
A rather easy and straightfoward questions for someone out there.
In BPS as we know, we use the info object '0SEM_POSIT' (account groups, or financial statement line) to summamrize and store amounts from groups of accounts or for example data from COPA's value fields, and which is already an attribute of the info object '0ACCOUNT'.
I am told that there is another BCS related info object called '0CS_ITEM' that serves the same purpose, and uses it for the same reason for the purpose of consolidations.
We'd obviously like to use just the one of these info objects because of planning and reporting.
Can someone out there with knowledge in BCS recommend which one to use, and from their experience in the past how they combined the use of both (if you in fact did use both).
Also, is it true that in BCS you cannot use a two characteristic BW hierarchy for consolidations, and it can only consolidate a one characteristic BW hierarchy?
Thanks dearlyHi Eugene,
I kind of understood what you said, but just incase, let me explain my situation a little clearer. In BPS I'm using 0SEM_POSIT for two reasons:
1) To create hierarchy based on 0SEM_POSIT info object, and making each node postable. This is because on this project we don't plan at account level. Only at a kind of account group/financial statement line level. So each node is postable so that they roll up to the higher levels.
2) I will have 0SEM_POSIT as an attribute of 0ACCOUNT (which is standard delivered as an attribute in BW). This will ensure that I derive the actuals at that the same level as the planned. This is required for two reasons:
a) I can have the actuals as comaprison column in the Planning
layout.
b) I can report on the Actuals vs. Plan at the postable node
level in BW queries.
So having explained this, what I understood from your explanation is:
a) I can continue to 0SEM_POSIT as my info object for my postable node hierarchy, and
b) I can also use 0CS_ITEM as a consolidation unit specifically for BCS only.
So what I really didn't understand is:
1) your explanation of the mapping of 0SEM_POSIT to 0CS_ITEM, and what this mapping actually does. For example does 0CS_ITEM derive the values from 0SEM_POSIT because of this mapping? Can you explain this a bit? Is Datastream a tool in BCS by which BCS readinf financial data from other components?
2) Can BCS use a 2 characteristic postable nodes hierarchy as a consolidation unit? For example, if I create ONE hierarchy using 0SEM_POSIT, and 0ACCOUNT. Both will be postable at any level of the hirarchy.
Can BCS consolidate using this 2 characteristic hierarchy structure? OR, must it use 0CS_ITEM info object?
3) How does both 0SEM-POSIT, and 0CS_ITEM co-exist together, in terms of planning, consolidation, and reporting. For example if I report using the 0CS_ITEM hierarchy, then I will not be able to read plan data, because plan data is posted on the 0SEM_POSIT? and vice versa......? This question kind of ties in with 1).
Sorry for the long message, but I wanted to make sure I explained it better.
Thanks for your help -
Select in CASE statement or in IF-THEN-ELSE
I have been struggling for a week with a problem and still can't solve the way I want.
Given four text fields in page : p1_name, p1_place_name, p1_place_number and p1_place_init_letter - where user types text and press 'Search' button to see the results.
p1_name finds results in table EMPLOYEES
p1_place_name, p1_place_number and p1_place_init_letter find results in table PLACES
the two tables are linked by id_place field
I would like reports to be shown depending on search results:
- if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist AND EMPLOYEES.id_place = PLACES.id_place then a single report shows only employee row
- if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist AND EMPLOYEES.id_place # PLACES.id_place then two reports showing 1) employees with name = :p1_name and 2) places with name, number and init_letter = :p1_.....
- if p1_name not exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist then a message with 'NO EMPLOYEE' and report shows only places where name, number and init_letter = :p1_.....
- if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) not exist then report shows only employee row where name = :p1_name and message with 'NO PLACE'
- if p1_name not exists and (p1_place_name and p1_place_number and p1_place_init_letter) not exist then messages 'NO EMPLOYEE' and 'NO PLACE'
I do NOT know if it is possible, and if it is, then what do I have to use : IF - THEN - ELSE or CASE ?
I tried to build HTML report region conditionally shown for each situation, but they do not work the way I want.
Could you please help me ?
Thank you in advance !Agree with Dan. Use a dedicated report region for a unique query. Use a rendering condition to determine if that reporting region must be rendered (i.e. whether or not that reporting query must be executed ).
The alternative is creating a function that constructs the SQL query dynamically, based on the user supplied values for page items. Use the function as the source for the reporting region, instead of a SQL statement. (this is similar to creating a ref cursor for a client, minus the actual step to create the ref cursor - instead the source SQL for that ref cursor is returned).
Also consider asking your Apex questions in the dedicated Apex forum on OTN. -
Use a tree or a list or something else?
Hello all...I need to create a sort of "family tree". I'm given a String[] where each entry will either be of the form "child parent" or "person gender". If its in the form "child parent" I know that the family tree has child as a child of parent. If its in the form "person gender", I know what that persons gender is. I need to go through this array of strings making sure that each child has at most two parents which must be of the opposite sex, and that no child is its own descendant (eg. If Bob is a child of Sue who is a child of Joe, Joe better not be a child of Bob). What I need to report is the index of the String[] where this fails.
Hopefully that's a clear explanation.
Here's an example:
{"BOB JOHN","BOB MARY","MARY JOHN","JOHN f","MARY f","AL f"}
Returns: 4
The first 4 elements are considered consistent. They describe that BOB's 2 parents are JOHN and MARY and that (unconventionally) MARY is JOHN's child. JOHN is female. But "MARY f" is inconsistent with this since that makes both of BOB's parents female.My first thought was to store this as a Tree but since a parent can have lots of children and a child can have two parents and I may be adding parents before I know their genders and then having to go through and modify things. It seems too complex. Then I thought to store it as an arraylist. But I still run into problems where if I modify things I have to search through many different places to make sure I reflect it everywhere and everything still holds true.
What do you guys think? I can post some other examples if its still unclearYou should probably approach this problem by breaking it down into some general processing steps. As an example, you probably can't check for required conditions - like gender, parentage, etc - until you have processed the whole set of input. That suggests you will have at least two stages:
Build up structures.
Do the condition checking.
What kinds of structures would you use to do the condition checking?
Hint: Just one structure probably isn't going to hack it.
Hint: For starters, yoou probably need a list of persons.
Hint: Each person should have a gender.
Hint: You need to be able to check for parents of each person.
Hint: You need to check for circles in the parenting.
Maybe you are looking for
-
I have a new Thinkpad Edge e530. The adapter gets very hot when the battery is charging. Not so hot that I can't hold it, but still, very hot. Relevant specs: * Adapter: 65 W * Battery: "the bigger one" (6 cell LI Bat-75+,62WH) * Graphics: integr
-
Yahoo IMAP support ... sneaky!
I found several references to IMAP support by Yahoo about a year ago (imap.next.mail.yahoo.com, imap.mail.yahoo.com) that worked for a while and then stopped, presumably because of the resources required to support that protocol on top of pop. Then,
-
my ipod 5 hasn't been letting me take pictures for a WHILE now. Probably about 2 months its on my inner camera because when I bought my iPod it didn't even come with a back camera which I think is freaking stupid. I've tried everything! I'm done
-
Database link between the databases with the same name
Hi, I need to establish a db link between two databases that are named the same way on two different servers. server 1 has a database dev1 and server2 has a database dev1. The tnsnames on server2: DEV1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOS
-
Content-length and chunked-encoding
Hi, Need to include content-length and chunked-encoding headers with response, I am using Sun One Webserver SP 6.5. Thanks in anticipation, Adnan