Friends need ur help in query
SELECT AL_ID,AL_CAPTION FROM ALB WHERE AL_MEMBERID=8
UNION
SELECT VD_ID,VD_CAPTION FROM VDSF WHERE VD_MEMBERID=8
ORDER BY 2;
This is my result set for the query
3 Bunch
4 New
5 falss
Actually it displays in the Order by Case Sensitive, i want it in the order
3 Bunch
5 falss
4 New
Is this possible, if then please help without changing the Case Sensitive of the Data
Thanks,
Dick...
Hey I think the only problem with your query was use of same name
select AL_ID,AL_CAPTION
from
SELECT AL_ID,AL_CAPTION FROM ALB WHERE AL_MEMBERID=8
UNION
SELECT VD_ID,VD_CAPTION FROM VDSF WHERE VD_MEMBERID=8
ORDER BY upper(AL_CAPTION);
AL_ID and AL_CAPTION .So an alias is needed for order by otherwise It will confuse AL_CAPTION as the AL_CAPTION inside from().
Similar Messages
-
Dear Friends,
I have two selects running something like this:
select <column-names> from <table-names> where <conditions>
union
select <column-names> from <table-names> where <conditions>.
there are three outer-join conditions in the first select and
three outer joins in the second like:
c=l(+)[in the first select]
d=m(+)
e=n(+)
and
f=l(+) [in the second select]
g=m(+)
h=n(+)
The result here generates 52 rows which is correct.
Now the case is that I am removing the union clause from the above SQL
and converting it like this.
select <column-names[1]>+<column-names[2]> from <table-names[1]>+<table-names[2]> where <conditions[1]>+<conditions[2]>
but i get the error:
same table cannot be outerjoined to two tables in the same query because i now have this
in the new query :
c=l(+)[from the first select]
d=m(+)
e=n(+)
f=l(+) [from the second select]
g=m(+)
h=n(+)
if I remove the join like:
c=l[from the first select]
d=m
e=n
f=l(+) [from the second select]
g=m(+)
h=n(+)
the query executes but results into 160 rows too much of unneeded redundancy, which is wrong.
My question is that:"Is there any way to do this? I mean to remove the union and combine the two selects into one without affecting the result of the Query which should be 52 rows only (while not affecting the joins I think this should also be the case)".
Need your suggestions.
Thanks,
VishalVishal,
What exactly are you trying to achieve? Removing/replacing the âunionâ is not really a goal.
You are comparing apples with oranges here.
select <column-names> from <table-names> where <conditions>
union
select <column-names> from <table-names> where <conditions>does one thing and â¦select <column-names[1]>+<column-names[2]> from <table-names[1]>+<table-names[2]> where <conditions[1]>+<conditions[2]>does another.
The results set cannot even be considered equivalent since one returns X columns and the other 2*X. Even if you ignore this aspect (how could you?) and compare the number of rows returned ⦠first query returns N+M-D1 (where N is rows returned from sql1, M is rows returned from sql2 and D1 is some number determined by the implicit distinct done by the âunionâ) ⦠the second query returns N*M-D2 (that is, the Cartesian product of sql1 and sql2 minus some D2 number if sql1 and sql2 have tables in common). N+M-D1 would be equal to N*M-D2 only by fluke.
Maybe, as Laurent put it, a concrete example with sample data and a proper stated goal are what you need to provide. -
Hi,
I have aquery which looks like this
CREATE TABLE BKP3
PARALLEL(DEGREE 4 INSTANCES 1)
NOLOGGING
AS
SELECT /* + PARALLEL(4,1) */ *
FROM BKP2 A
WHERE A.COL1 NOT IN (SELECT /* + PARALLEL(4,1) */ COL1
FROM BKP1)
AND A.COL2 NOT IN (SELECT /* + PARALLEL(4,1) */ COL2
FROM BKP1)
AND ROWNUM<=5000000;
Table BKP1 holds more than 5million rows and table BKP2 holds more than 60million rows.
This query is very slow. Is there any way i can improve the performance.
Kindly help.> I dont know how but somehow i am unable to run the explain plan.
What have you tried and what error did you get?
What is your Oracle version?
In 10g I think sys.plan_table$ is granted public access by default. Try using this handy Explain Plan script in SQL*Plus:
www.williamrobertson.net/code/xplan.sql -
Hi,
It' s duplicate thread...deleted
Edited by: user586 on Mar 23, 2011 9:42 AMHi,
You should do two regular expression operations.
First, extract just the part of the string that is between the parentheses. Use that substring, and not the full string, in the rest of the query.
After that, you can use REGEXP_SUBSTR the way you were doing.
You should devise a way to test all your strings at once, without having to type the same string more than once.
I used this table to test:
CREATE TABLE table_x
( txt VARCHAR2 (40)
INSERT INTO table_x (txt) VALUES ('TECHPKG(INTELLI CC+FRT SONAR)');
INSERT INTO table_x (txt) VALUES ('PWRPKG(P/W+P/L+CC)');Here's my solution:
WITH got_paren_txt AS
SELECT REGEXP_REPLACE ( txt
, '^.*\((.*)\).*$'
, '\1'
) AS paren_txt
FROM table_x
, got_item_cnt AS
SELECT PAREN_txt
, 1 + LENGTH (paren_txt)
- LENGTH ( REPLACE ( paren_txt
, '+'
) AS item_cnt
FROM got_paren_txt
, cntr AS
SELECT LEVEL AS n
FROM (
SELECT MAX (item_cnt) AS max_item_cnt
FROM got_item_cnt
CONNECT BY LEVEL <= max_item_cnt
SELECT i.paren_txt
, c.n
, REGEXP_SUBSTR ( i.paren_txt
, '[^+]+'
, 1
, c.n
) AS item
FROM got_item_cnt i
JOIN cntr c ON c.n <= i.item_cnt
ORDER BY i.paren_txt
, c.n
;and its output:
PAREN_TXT N ITEM
INTELLI CC+FRT SONAR 1 INTELLI CC
INTELLI CC+FRT SONAR 2 FRT SONAR
P/W+P/L+CC 1 P/W
P/W+P/L+CC 2 P/L
P/W+P/L+CC 3 CCThis assumes that each string will contain a '(', followed by a ')'. If you can have multiple sets of parentheses in the same string, the query above can be adjusted. Post some sample data that shows what kinds of strings you might need to handle, and the results you want from them.
Whenever you post a question, say what version of Oracle you're using. The query above will work in Oracle 10, but it could be simplified in Oracle 11 using REGEXP_COUNT and the new version of REGEXP_SUBSTR. -
Hey all, I have the following scenario,
Table A
Column1
2
3
5
Table B
Column2
7
5
4
Table C
Column1, Column2
2,7
3,8
5,10
So basically I need to compare in a way that the combination of the values in A AND B match the recordset in C as such,
select column1, column2 from Table A, Table B
where a combination of both those columns exists in Table C. Therefore in the above example, this query should return "2,7" as the output. Any ideas would be appreciated.This should do?
SQL> select c.col1, c.col2
2 from c
3 where (c.col1, c.col2) in (select col1, col2
4 from (select c.col1 col1
5 from C, a
6 where c.col1 = a.col1) q1
7 ,(select c.col2 col2
8 from C, b
9 where c.col2 = b.col1) q2
10 )
11 /
COL1 COL2
2 7Cheers
Sarma. -
Hi friends need some help in ALE IDOC !
For training purpose I am trying to create an IDOC using ALE
where I am using the same client as server as well as receiver......So I am using as receiver "NONE" . this is already present in the SM59 under logical systems..
But i cant create a port for that...as its saying its not compatible with the TRFC "
Can any one tell me what is the way to create the port ?Hi,
You are new to ALE and IDOCs so I am giving all step by step to do the ALE.
Outbound:
Step 1. Application document is created when transaction is saved.
2. Message control is invoked.
3. Messages are processed by system.
4. Messages are Edited (if desired).
5. Output (ALE / EDI) is checked
6. Validate against Message control record from Partner Profile
7. Application Document is saved.
8. Entry NAST table is created for every selected output program
along with Medium & Timing.
9. Check for Process Immediately .
If (yes)
Determine Processing Program from TNAPR Table.
ELSE
Execute RSNASTED Program.
10. Read Partner Profile to determine Process Code.
11. Process Code points to the Function Module & Invoked.
12. IDoc is generated.
13. Check for ALE Request.
if (Yes)
Perform Filters, Conversions, Version Changes etc.
Else.
IDoc is stored in DATABASE.
INBOUND:
Step 1. EDI Subsystem creates an IDoc file from EDI Messages
2. Subsystem calls Functional Module EDI_DATA_INCOMING from startRFC program.
3. Data in Control Record is validate against the Partner Profile.
4. IDoc is generated in Database and syntax check is carried out.
5. IDoc file is deleted once file read.
6. Event PROCESSSTATE REACHED is triggered in Idoc Object Workflow.
7. Check for Process Immediately.
If NO
Execute RBDAPP01 Program
Else
Read Process Code from Partner Profile
Process Code Points to Function Module
Application Document Posted.
further help:
check url
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapgenie.com/ale/configuration.htm
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapdevelopment.co.uk/training
And also u can get lots of inof from the below link.
http://www.sapgenie.com/ale/why_ale.htm
Just follow the procedure
Sending System(Outbound ALE Process)
Tcode SALE ? for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 ? Create Model View
Tcode BD82 ? Generate partner Profiles & Create Ports
Tcode BD64 ? Distribute the Model view
Message Type MATMAS
Tcode BD10 ? Send Material Data
Tcode WE05 ? Idoc List for watching any Errors
Receiving System(Inbound ALE )
Tcode SALE ? for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 ? Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 ? Idoc List for inbound status codes
ALE IDOC Steps
Sending System(Outbound ALE Process)
Tcode SALE ?3 for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 !V Create Model View
Tcode BD82 !V Generate partner Profiles & Create Ports
Tcode BD64 !V Distribute the Model view
This is Receiving system Settings
Receiving System(Inbound ALE )
Tcode SALE ?3 for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 !V Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 !V Idoc List for inbound status codes
Message Type MATMAS
Tcode BD10 !V Send Material Data
Tcode WE05 !V Idoc List for watching any Errors
STEP 1)a Goto Tcode SALE
Click on Sending & Receiving Systems-->Select Logical Systems
Here Define Logical Systems---> Click on Execute Button
go for new entries
-System Name : ERP000
-Description : Sending System
-System Name : ERP800
-Description : Receiving System
press Enter & Save
it will ask Request
if you want new request create new Request orpress continue for transfering the objects
B) goto Tcode SALE
Select Assign Client to Logical Systems-->Execute
000--> Double click on this
Give the following Information
-Client : ERP 000
-City :
-Logical System
-Currency
-Client role
Save this Data
Step 2) For RFC Creation
Goto Tcode SM59-->Select R/3 Connects
Click on Create Button
RFC Destination Name should be same as partner's logical system name and case sensitive
to create the ports automatically while generating the partner profiles
give the information for required fields
RFC Destination : ERP800
Connection type: 3
Description
Target Host : ERP000
System No:000
lan : EN
Client : 800
User : Login User Name
Password:
save this & Test it & RemortLogin
STEP 3) Goto Tcode BD64 -- click on Change mode button
click on create moduleview
short text : xxxxxxxxxxxxxx
Technical Neme : MODEL_ALV
save this & Press ok
select your just created modelview Name :'MODEL_ALV'.
goto add message type
Model Name : MODEL_ALV
sender : ERP000
Receiver : ERP800
Message type :MATMAS
save & Press Enter
STEP 4) Goto Tcode BD82
Give Model View : MODEL_ALV
Partner system : ERP800
execute this by press F8 Button
it will gives you sending system port No :A000000015(Like)
STEP 5) Goto Tcode BD64
select the modelview
goto >edit>modelview-->distribute
press ok & Press enter
STEP 6) goto Tcode : BD10 for Material sending
Material : mat_001
Message Type : MATMAS
Logical System : ERP800
and Execute
STEP 7)goto Tcode : BD11 for Material Receiving
Material : 100-300
Message Type : MATMAS
and Execute --> 1 request idoc created for message type Matmas
press enter
Here Master Idoc set for Messge type MATMAS-->press Enter
1 Communication Idoc generated for Message Type
this is your IDOC
Change Pointers
how to change the description of a material using ALE Change Pointers.
I will give the following few steps
1) Tcode BD61---> check the change pointers activated check box
save and goback.
2) Tcode BD50---> check the MATMAS check box save and comeback.
3) Tcode BD51---> goto IDOC_INPUT_MATMAS01 select the checkbox save and comeback.
4) Tcode BD52---> give message type : matmas press ok button.
select all what ever you want and delete remaining fields.
save & come back.
5) 5) go to Tcode MM02 select one material and try to change the description and save it
it will effects the target systems material desciption will also changes
6) goto Tcode SE38 give program Name is : RBDMIDOC and Execute
give Message type : MATMAS and Executte
ALE/IDOC Status Codes/Messages
01 Error --> Idoc Added
30 Error --> Idoc ready for dispatch(ALE Service)
then goto SE38 --> Execute the Program RBDMIDOC
29 Error --> ALE Service Layer
then goto SE38 --> Execute the Program RSEOUT00
03 Error --> Data Passed to Port ok
then goto SE38 --> Execute the Program RBDMOIND
12 Error --> Dispatch ok
Inbound Status Codes
50 Error --> It will go for ALE Service Layer
56 Error --> Idoc with Errors added
51 Error --> Application Document not posted
65 Error --> Error in ALE Service Layer
for 51 or 56 Errors do the following steps
goto WE19 > give the IDOC Number and Execute>
Press on Inbound function Module
for 65 Error --> goto SE38 --> Execute the Program RBDAPP01 then your getting 51 Error
Thanks
Sarada -
Need urgent help with query....
i need to print loc field with it but the logic is get ti loc code where the month is maximum...
Need output like this
K Loc M_1 M_2 M_3 M_4 M_5 M_6
A 1 2.5 4.5 0 0 0 0
B 4 0 0 0 0 2.5 0
C 3 2.5 2.5 2.5 2.5 2.5 2.5
drop table y;
create table y( key char(1),
loc number,
month char(2),
amnt number);
insert into y values('A',2,'01',2.50);
insert into y values('A',1,'02',4.50);
insert into y values('B',4,'05',2.50);
insert into y values('C',2,'01',2.50);
insert into y values('C',8,'02',2.50);
insert into y values('C',3,'03',2.50);
insert into y values('C',3,'04',2.50);
insert into y values('C',3,'05',2.50);
insert into y values('C',3,'06',2.50);
commit ;
select key
,sum(decode(month,'01',amnt,0)) m_1
,sum(decode(month,'02',amnt,0)) m_2
,sum(decode(month,'03',amnt,0)) m_3
,sum(decode(month,'04',amnt,0)) m_4
,sum(decode(month,'05',amnt,0)) m_5
,sum(decode(month,'06',amnt,0)) m_6
from y
group by key;
SQL> select key
2 ,sum(decode(month,'01',amnt,0)) m_1
3 ,sum(decode(month,'02',amnt,0)) m_2
4 ,sum(decode(month,'03',amnt,0)) m_3
5 ,sum(decode(month,'04',amnt,0)) m_4
6 ,sum(decode(month,'05',amnt,0)) m_5
7 ,sum(decode(month,'06',amnt,0)) m_6
8 from y
9 group by key;
K M_1 M_2 M_3 M_4 M_5 M_6
A 2.5 4.5 0 0 0 0
B 0 0 0 0 2.5 0
C 2.5 2.5 2.5 2.5 2.5 2.5Well, maybe I'm lucky to understand here ?
SQL> select
2 key
3 ,max(loc) keep (dense_rank last order by
amnt,month) loc
4 ,sum(decode(month,'01',amnt,0)) m_1
5 ,sum(decode(month,'02',amnt,0)) m_2
6 ,sum(decode(month,'03',amnt,0)) m_3
7 ,sum(decode(month,'04',amnt,0)) m_4
8 ,sum(decode(month,'05',amnt,0)) m_5
9 ,sum(decode(month,'06',amnt,0)) m_6
10 from y
11 group by key;
K LOC M_1 M_2 M_3
M_4 M_5 M_6
A 1 2,5 4,5 0
0 0 0
4 0 0 0 0
2,5 0
3 2,5 2,5 2,5 2,5
2,5 2,5Nicolas.
This should be more a question for SQL and PL/SQL
Forum :
PL/SQL
start=0
Message was edited by:
N. GasparottoPerfect..... many thanks... and i am sorry i put this in this forum rather than in SQL/PLSQL... but you are the best!!
thanks to all of you.. -
Hi friends need some help in IDoc !
i have created the following function module for IDOC outbound.. What will be the value of the exporting parameters and tables When i will call it ?
FUNCTION Z_IDOC_OUTPUT_CREDIT .
""Local interface:
*" IMPORTING
*" VALUE(CONTROL_RECORD_IN) LIKE EDIDC STRUCTURE EDIDC
*" VALUE(OBJECT) LIKE NAST STRUCTURE NAST
*" EXPORTING
*" VALUE(OBJECT_TYPE) LIKE WFAS1-ASGTP
*" VALUE(CONTROL_RECORD_OUT) LIKE EDIDC STRUCTURE EDIDC
*" TABLES
*" INT_EDIDD STRUCTURE EDIDD
*" EXCEPTIONS
*" ERROR_MESSAGE_RECEIVED
*" E003
*INTERNAL TABLE FOR ITEM DATA
ranges: r_matkl for vbap-matkl.
r_matkl-sign = 'I'.
r_matkl-option = 'BT'.
r_matkl-low = '000000300'.
r_matkl-high = '000000399'.
append r_matkl.
data : flag type i value 0.
DATA: S_VBELN LIKE VBRP-AUBEL.
DATA: BEGIN OF I_ITEM OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
VKAUS LIKE VBAP-VKAUS,
SPART LIKE VBAP-SPART,
NETWR LIKE VBAP-NETWR,
WAERK LIKE VBAP-WAERK,
KWMENG LIKE VBAP-KWMENG,
KONDM LIKE VBAP-KONDM,
MVGR1 LIKE VBAP-MVGR1,
MVGR2 LIKE VBAP-MVGR2,
MVGR3 LIKE VBAP-MVGR3,
MVGR4 LIKE VBAP-MVGR4,
MVGR5 LIKE VBAP-MVGR5,
KONDA LIKE VBKD-KONDA,
BSTDK LIKE VBKD-BSTDK,
BSTDK_E LIKE VBKD-BSTDK_E,
KDKG2 LIKE VBKD-KDKG2,
BEZEI1 LIKE TVLVT-BEZEI,
BEZEI2 LIKE TVM1T-BEZEI,
BEZEI3 LIKE TVM2T-BEZEI,
BEZEI4 LIKE TVM3T-BEZEI,
BEZEI5 LIKE TVM4T-BEZEI,
BEZEI6 LIKE TVM5T-BEZEI,
VTEXT1 LIKE V_T178-VTEXT,
VTEXT2 LIKE V_T188-VTEXT,
VTEXT3 LIKE TVKGGT-VTEXT,
END OF I_ITEM.
*Declaring constants
DATA:
*SEGMENT NAMES
C_SALES_ORDER_NUMBER LIKE EDIDD-SEGNAM VALUE 'Z1SONUMBER',
C_MATERIAL_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MATERIAL',
C_PRODUCT_LINE LIKE EDIDD-SEGNAM VALUE 'Z1MVGR1',
C_PRODUCT_NAME LIKE EDIDD-SEGNAM VALUE 'Z1MVGR2',
C_PRODUCT_VERSION_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR3',
C_PRODUCT_PLATFORM_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR4',
C_PRODUCT_APPSERVER_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR5',
C_COMPILER_CODE LIKE EDIDD-SEGNAM VALUE 'Z1KONDM',
C_LANGUAGE_CODE LIKE EDIDD-SEGNAM VALUE 'Z1KONDA',
C_RUNTIME_BANDCODE LIKE EDIDD-SEGNAM VALUE 'Z1VKAUS',
C_SUPPORT LIKE EDIDD-SEGNAM VALUE 'Z1SUPPORT',
C_AMOUNT LIKE EDIDD-SEGNAM VALUE 'Z1AMOUNT'.
DATA :
C_CREDIT_IDOITY LIKE EDIDC-IDOCTP VALUE 'Z_CREDIT_MEMO_IDOC',
C_CREDIT_MSGTYPE LIKE EDIDC-MESTYP VALUE 'Z_CREDIT_MESSAGE'.
*data declaration
*idoc control record
*data : control_record_out like edidc.
*other data declaration
DATA:W_SALES_ORDER LIKE Z1SONUMBER.
DATA:W_MATERIAL LIKE Z1MATERIAL.
DATA:W_MVGR1 LIKE Z1MVGR1.
DATA:W_MVGR2 LIKE Z1MVGR2.
DATA:W_MVGR3 LIKE Z1MVGR3.
DATA:W_MVGR4 LIKE Z1MVGR4.
DATA:W_MVGR5 LIKE Z1MVGR5.
DATA:W_KONDM LIKE Z1KONDM.
DATA:W_KONDA LIKE Z1KONDA.
DATA:W_VKAUS LIKE Z1VKAUS.
DATA:W_SUPPORT LIKE Z1SUPPORT.
DATA:W_AMOUNT LIKE Z1AMOUNT.
DATA:FS_INT_EDIDD LIKE EDIDD.
DATA:
IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE.
*POPULATING THE ITEM DATA
S_VBELN = OBJECT-OBJKY.
SELECT
VBAP~VBELN
VBAP~POSNR
VBAP~MATNR
VBAP~VKAUS
VBAP~SPART
VBAP~NETWR
VBAP~WAERK
VBAP~KWMENG
VBAP~KONDM
VBAP~MVGR1
VBAP~MVGR2
VBAP~MVGR3
VBAP~MVGR4
VBAP~MVGR5
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE I_ITEM
WHERE VBAP~VBELN EQ S_VBELN
and vbap~matkl NOT IN r_matkl.
LOOP AT I_ITEM.
data: ITEMWORKAREA like line of I_ITEM.
select single
KONDA
BSTDK
BSTDK_E
KDKG2
FROM VBKD INTO corresponding fields of ITEMWORKAREA
WHERE vbkd~vbeln eq I_item-vbeln
AND vbkd~posnr EQ '000'.
select single
KONDA
BSTDK
BSTDK_E
KDKG2
FROM VBKD INTO corresponding fields of ITEMWORKAREA
WHERE vbkd~vbeln eq I_item-vbeln
AND vbkd~posnr EQ I_item-posnr.
select single
bezei
FROM tvm1t
INTO ITEMWORKAREA-BEZEI2
WHERE spras EQ sy-langu
AND mvgr1 EQ I_ITEM-mvgr1.
select single
bezei
FROM tvm2t
INTO ITEMWORKAREA-BEZEI3
WHERE spras EQ sy-langu
AND mvgr2 EQ I_ITEM-mvgr2.
select single
bezei
FROM tvm3t
INTO ITEMWORKAREA-BEZEI4
WHERE spras EQ sy-langu
AND mvgr3 EQ I_ITEM-mvgr3.
select single
bezei
FROM tvm4t
INTO ITEMWORKAREA-BEZEI5
WHERE spras EQ sy-langu
AND mvgr4 EQ I_ITEM-mvgr4.
select single
bezei
FROM tvm5t
INTO ITEMWORKAREA-BEZEI6
WHERE spras EQ sy-langu
AND mvgr5 EQ I_ITEM-mvgr5.
SELECT SINGLE
VTEXT
FROM T178T
INTO ITEMWORKAREA-VTEXT1
WHERE SPRAS EQ SY-LANGU
AND KONDM EQ I_ITEM-KONDM.
SELECT SINGLE
VTEXT
FROM T188T
INTO ITEMWORKAREA-VTEXT2
WHERE SPRAS EQ SY-LANGU
AND KONDA EQ ITEMWORKAREA-KONDA.
SELECT SINGLE
bezei
FROM TVLVT
INTO ITEMWORKAREA-BEZEI1
WHERE ABRVW = I_ITEM-VKAUS.
SELECT SINGLE
vtext
FROM TVKGGT
INTO ITEMWORKAREA-VTEXT3
WHERE KDKGR = ITEMWORKAREA-kdkg2.
ITEMWORKAREA-VBELN = I_ITEM-VBELN.
ITEMWORKAREA-POSNR = I_ITEM-POSNR.
ITEMWORKAREA-MATNR = I_ITEM-MATNR.
ITEMWORKAREA-VKAUS = I_ITEM-VKAUS.
ITEMWORKAREA-SPART = I_ITEM-SPART.
ITEMWORKAREA-NETWR = I_ITEM-NETWR.
ITEMWORKAREA-WAERK = I_ITEM-WAERK.
ITEMWORKAREA-KWMENG = I_ITEM-KWMENG.
ITEMWORKAREA-KONDM = I_ITEM-KONDM.
ITEMWORKAREA-MVGR1 = I_ITEM-MVGR1.
ITEMWORKAREA-MVGR2 = I_ITEM-MVGR2.
ITEMWORKAREA-MVGR3 = I_ITEM-MVGR3.
ITEMWORKAREA-MVGR4 = I_ITEM-MVGR4.
ITEMWORKAREA-MVGR5 = I_ITEM-MVGR5.
modify I_ITEM from ITEMWORKAREA.
CLEAR ITEMWORKAREA.
ENDLOOP.
Fill the control record Information.
CLEAR CONTROL_RECORD_OUT.
MOVE CONTROL_RECORD_IN TO CONTROL_RECORD_OUT.
CONTROL_RECORD_OUT-DIRECT ='1'.
control_record_out-MESTYP = C_CREDIT_MSGTYPE.
control_record_out-IDOCTP = C_CREDIT_IDOITY.
control_record_out-RCVPRT = 'LS'.
control_record_out-RCVPRN = 'EXTERNAL'.
Checking whether there is support item
LOOP AT i_item.
IF
NOT i_item-bstdk IS INITIAL OR
NOT i_item-mvgr1 IS INITIAL OR
NOT i_item-mvgr2 IS INITIAL OR
NOT i_item-mvgr3 IS INITIAL OR
NOT i_item-mvgr4 IS INITIAL OR
NOT i_item-mvgr5 IS INITIAL OR
NOT i_item-konda IS INITIAL OR
NOT i_item-kondm IS INITIAL OR
NOT i_item-bstdk_e IS INITIAL OR
NOT i_item-kdkg2 IS INITIAL OR
NOT i_item-vtext1 IS INITIAL OR
NOT i_item-vtext2 IS INITIAL OR
NOT i_item-vtext3 IS INITIAL OR
NOT i_item-bezei1 IS INITIAL OR
NOT i_item-bezei2 IS INITIAL OR
NOT i_item-bezei3 IS INITIAL OR
NOT i_item-bezei4 IS INITIAL OR
NOT i_item-bezei5 IS INITIAL OR
NOT i_item-bezei6 IS INITIAL.
flag = 1.
ELSE.
flag = 0.
ENDIF.
endloop.
if flag = 1.
FILL THE DATA RECORD
W_SALES_ORDER-VBELN = I_ITEM-VBELN.
FS_INT_EDIDD-SEGNAM = C_SALES_ORDER_NUMBER.
FS_INT_EDIDD-SDATA = W_SALES_ORDER-VBELN.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_MATERIAL-MATNR = I_ITEM-MATNR.
W_MATERIAL-SPART = I_ITEM-SPART.
FS_INT_EDIDD-SEGNAM = C_MATERIAL_DETAILS.
FS_INT_EDIDD-SDATA = W_MATERIAL.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_MVGR1-MVGR1 = I_ITEM-MVGR1.
W_MVGR1-BEZEI = I_ITEM-BEZEI2.
FS_INT_EDIDD-SEGNAM = C_PRODUCT_LINE.
FS_INT_EDIDD-SDATA = W_MVGR1.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_MVGR2-MVGR2 = I_ITEM-MVGR2.
W_MVGR2-BEZEI = I_ITEM-BEZEI3.
FS_INT_EDIDD-SEGNAM = C_PRODUCT_NAME.
FS_INT_EDIDD-SDATA = W_MVGR2.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_MVGR3-MVGR3 = I_ITEM-MVGR3.
W_MVGR3-BEZEI = I_ITEM-BEZEI4.
FS_INT_EDIDD-SEGNAM = C_PRODUCT_VERSION_DETAILS.
FS_INT_EDIDD-SDATA = W_MVGR3.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_MVGR4-MVGR4 = I_ITEM-MVGR4.
W_MVGR4-BEZEI = I_ITEM-BEZEI5.
FS_INT_EDIDD-SEGNAM = C_PRODUCT_PLATFORM_DETAILS.
FS_INT_EDIDD-SDATA = W_MVGR4.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_MVGR5-MVGR5 = I_ITEM-MVGR5.
W_MVGR5-BEZEI = I_ITEM-BEZEI6.
FS_INT_EDIDD-SEGNAM = C_PRODUCT_APPSERVER_DETAILS.
FS_INT_EDIDD-SDATA = W_MVGR5.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_KONDM-KONDM = I_ITEM-KONDM.
W_KONDM-VTEXT = I_ITEM-VTEXT2.
FS_INT_EDIDD-SEGNAM = C_COMPILER_CODE.
FS_INT_EDIDD-SDATA = W_KONDM.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_KONDA-KONDA = I_ITEM-KONDA.
W_KONDA-VTEXT = I_ITEM-VTEXT1.
FS_INT_EDIDD-SEGNAM = C_LANGUAGE_CODE .
FS_INT_EDIDD-SDATA = W_KONDA.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_VKAUS-VKAUS = I_ITEM-VKAUS.
W_VKAUS-BEZEI = I_ITEM-BEZEI1.
FS_INT_EDIDD-SEGNAM = C_RUNTIME_BANDCODE .
FS_INT_EDIDD-SDATA = W_VKAUS.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_SUPPORT-BSTDK = I_ITEM-BSTDK.
W_SUPPORT-BSTDK_E = I_ITEM-BSTDK_E.
W_SUPPORT-KDKG2 = I_ITEM-KDKG2.
W_SUPPORT-VTEXT = I_ITEM-VTEXT3.
FS_INT_EDIDD-SEGNAM = C_SUPPORT.
FS_INT_EDIDD-SDATA = W_SUPPORT.
APPEND FS_INT_EDIDD TO INT_EDIDD.
W_AMOUNT-NETWR = I_ITEM-NETWR.
W_AMOUNT-KWMENG = I_ITEM-KWMENG.
W_AMOUNT-WAERK = I_ITEM-WAERK.
FS_INT_EDIDD-SEGNAM = C_AMOUNT.
FS_INT_EDIDD-SDATA = W_AMOUNT.
APPEND FS_INT_EDIDD TO INT_EDIDD.
ENDIF.
IF FLAG = 0.
*MESSAGE E003 WITH I_ITEM-vbeln.
RAISE E003.
ENDIF.
ENDFUNCTION.There are 2 kinds of parameters.
IMPORT and EXPORT.
Importing parameters - Values passed from calling program to FM
Exporting parameters - Results from FM passed back to calling program.
In your case the calling program will be the user exit.
In the calling program the interface will be reverse. It will define the import and export parameters from the calling program perspective.
In your FM there are 2 import parameters according to the FM.
IMPORTING
*" VALUE(CONTROL_RECORD_IN) LIKE EDIDC STRUCTURE EDIDC
*" VALUE(OBJECT) LIKE NAST STRUCTURE NAST
The FM needs these values from the calling program.
When you call the program the interface will look like this.
CALL FUNCTION 'Z_IDOC_OUTPUT_CREDIT'
Exporting
CONTROL_RECORD_IN = control_record
OBJECT = nast
........etc
control_record and nast are declared in your user-exit. there values will be exported to the FM. FM will import these values.
You can insert this FM call using pattern. Position the cursor where you want to include the FM and click on pattern on the application tool bar and give the FM name. It will give the interface. You can simply populate that.
Thanks and Regards,
Lakshmi. -
Hi friends need some help while creating background job
I need to run a batch report in background in SM36 when any cancellation of sales order is done in VL09.
i.e when a cancellation of sales order is done i have to run a batch report which will call an IDOC outbound generation function module that will create the IDOC.....
Please tell me how to do this.....Hi,
To submit backgroud jobs.
Call Function 'Job_Open'.
SUBMIT <report name>
WITH <input variants>
USER sy-uname
VIA JOB <job name>
AND RETURN.
If sysubrc eq 0.
Call Function 'Job_Close'.
Reward if helpfull. -
Hey friends need some help !
I have to create an IDOC when the credit memo is created.
I have the outbound idoc generation code and also the ale configured .Shall I use a user exit for VF01 and paste the IDoc generation code there ?Hi
For transaction data, like Orders, Billing documents, Delivery Documents, Shipments etc., issuing an output is controlled thru Output types. The control type is normally dependent on the processing mode and media like EDI Output, PRINT, FAX etc., and transfer immediately etc., setting.
I am not sure if you are using SAP Standard output type.
First of all you need to know the output types to be used for triggering the billing outputs.
Here are the settings I am using.
1. Output type : RD00
2. Application Key : V3 (billing)
3. Outbound process code :SD09.
4. IDOC Type: INVOIC01, Extension: ZINVOIC01,
5. Message Type: INVOIC.
Set all these at partner profile WE20. Make sure you have the customer, RFC port etc., created in advance to be used herewith inthe partner profile to define.
Further configuration in R/3 for SD output types, use transation V/31 to see the output types and other stuff. It may not be possible to explain how to configure the output types, processing routines.
Even, if the config is in place, As soon as the Billing document is generated and issued an ouput (for EDI processing), you will see the IDOC generated. To get the IDOC number, refer to PROCESS LOG in the transaction.
Regards
Jitesh -
Dears,
i want to create a report which shall work on OU basis, and the output should be as:
ORG_NAME SUB_INVENTORY_CODE SUB_INVENTORY_NAME CUSTOMER_NUMBER CUSTOMER_NAME ORDER_TYPE_NAME
any help ?Dears,
i want to create a report which shall work on OU basis, and the output should be as:
ORG_NAME SUB_INVENTORY_CODE SUB_INVENTORY_NAME CUSTOMER_NUMBER CUSTOMER_NAME ORDER_TYPE_NAME
any help ? -
hello all,
{code}
create table balance
(open_balance number(4)
,qty_in number(4)
,qty_out number(4)
insert into balance values (200,1,0);
insert into balance values ('',0,-25);
insert into balance values ('',0,-20);
{code}
i need a result like this
{code}
OPEN_BALANCE QTY_IN QTY_OUT RESULT
200 1 0 201
0 -25 185
0 -20 165
{code}Hi,
u0597684 wrote:
hello all,
{code}
create table balance
(open_balance number(4)
,qty_in number(4)
,qty_out number(4)
insert into balance values (200,1,0);
insert into balance values ('',0,-25);
insert into balance values ('',0,-20);
{code}
i need a result like this
{code}
OPEN_BALANCE QTY_IN QTY_OUT RESULT
200 1 0 201
0 -25 185
0 -20 165
{code}
There is no built-in order to rows in a relational table. I assume you have some other column that tells what order the rows are in, like this:
CREATE TABLE balance
( open_balance NUMBER (4)
, qty_in NUMBER (4)
, qty_out NUMBER (4)
, trans_dt DATE
insert into balance (open_balance, qty_in, qty_out, trans_dt) values (200, 1, 0, DATE '2013-05-31');
insert into balance (open_balance, qty_in, qty_out, trans_dt) values (NULL, 0, -25, DATE '2013-06-07');
insert into balance (open_balance, qty_in, qty_out, trans_dt) values (NULL ,0, -20, DATE '2013-06-14');
This looks like a job for the analytic SUM function.
Here's one way:
SELECT b.*
, SUM ( NVL (open_balance, 0)
+ qty_in
+ qty_out
) OVER (ORDER BY trans_dt) AS result
FROM balance b
ORDER BY trans_dt
The results are slightly different from what you posted:
OPEN_BALANCE QTY_IN QTY_OUT TRANS_DT RESULT
200 1 0 31-May-2013 201
0 -25 07-Jun-2013 176
0 -20 14-Jun-2013 156
If you really want the results you requested, please explain how you get them. -
Hi,
Cancel the request. i have resolved its my own.
Thanks for all your help...
Edited by: user586 on Oct 31, 2011 7:42 PMLearn about the Workspace Management functions ... demo here:
http://www.morganslibrary.org/reference/wm_functions.html
It is best to not reinvent the wheel. -
Hi friends need some help !
i want to recreate a custom program which will give the output same as VF01. i did the same for VL09 .it worked fine and
I just copied the program going to the System-->status
into my zreport..
but incase of VF01 when i am copying the SAPMV60A AND EXECUTING i am getting some error....
How to copy it...Is there any simple wayHi,
To copy a module pool program go to se80 and enter the program name and copy the program to the zprogram.
After that go to SCREENS tab and double click on the first screen.
Go to Layout.In Screen Painter EDIT - Select All.
Go to Utilities - Upload / download and then click on Download which will download the screen data into a file.
Go to your Zprogram .create the same screen number and go the screen painter .
Utilities - Upload and select the downloaded file.
In the Select File Window select the Encoding as Default (ANSI for Unicode Systems) and upload.in the same way you have to upload all the screens from the Standard Program to ZProgram.
Reward Points if useful..
Regards
R Adarsh -
Hi friends need your help for the following !
How to populate an idoc type.
Is it only by writting a report program like
"master idoc distribute" or also by NACE.
When i am using NACE then i must have the baic idoc type cretaed with ALE configured ??Hi,
It is not always by using NACE. If ur making use of standard IDOC types Like
ORDERS05
MATMAS06
DEBMAS etc for the salesorder and purchase orders etc then u can go for the
T.codes : BD10 for MATMAS05,
BD12 for CREMAS06,
BD14 for DEBMAS04 for the MM01, VD01 and MK01/XK01 T.codes Respectively.
If u r dealing with NACE then u should know the basic idoc for which u r using NACE and Messgae type .
There u will cofigure and assign the OUTPUTYPE and assign those outputtype to the respective T.code.
Regards.
Maybe you are looking for
-
Why does ical on icloud have a different lay out than on my mac
Why does iCal on my MacBook Pro have a different lay out than on iCloud? I like the iCloud layout better, the only missing niceties is the year calendar. How do I get both iCals to look the same? The ideal iCal? The one from iCloud WITH the year cale
-
Can I make photo DVD with Photoshop Elements 8?
I was just wondering if I could take my photos and create a "movie" with different songs and transition effects and burn it to a DVD with this software, and also export it to different sites such as YouTube... Thanks!
-
RSTXPDFT4- Pdf file is not opening
Hi, From sales order an output 'Pick List' is being generated. The user now want to generate this output in pdf format. What I tried doing is use SAP standard program RSTXPDFT4 to convert the spool to a pdf file. But the problem is the downloaded pdf
-
How to insert more than one row in an Oracle table in one go
Hi All, I am working on a file-XI(BPM)-Oracle scenario. I am sending an xml file to XI via a file adapter. On the receiver end i am using a jdbc adapter to insert the row in the database. There is a transformation step within the BPM which is convert
-
I was getting the security prompt each time I tried to run acrobat pro xi so I uninstalled and reinstalled. Now when it launches, I have to pick english from the window since Italian is picked. However, after I pick english, it still tries to make