Friends need sql help

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,
Vishal

Vishal,
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.

Similar Messages

  • Need SQL help in select data from 2 table..

    hi,
    i need some help here as i am new to sql statement
    I have 3 tables.
    Table1 :- TeamID, Team_Name, Team_Logo
    Table2:- TeamID, PlayerID
    Table3:- PlayerID, Player_Name
    How do i do a single select statement that select all information from table1 and the count of playerID from table2?
    My MS access table has relationships.
    One team can have many players. So how do it get the numbers of player in my team?
    Thanks.

    Thanks.
    but may i know why i have to max (a.team_name)???Actually there is no need of max() here, but it must be an aggregate function to use in this context. There is no harm in using it like this. This is a work around, I didn't get enough time to work on it.
    But as long as it gives correct result, don't worry about it.
    btw, how do i assign duke $$ to u?
    i am new to this forum.You can read at http://forum.java.sun.com/rewardFaq.jsp#assign
    Have a nice weekend.
    Sudha

  • Need Sql Help

    Hi , I need some help !
    I have X table and some 1000 records .
    Some example :Each record has ID , firstname ,lastname ,Monday,tuesday,Wed,Thurs,Fri,Sat,Sunday .
    Now , Employer who works for Monday to Friday - has values in the record and Saturday ,Sunday - null values (due to off)
    Now, i need sql query logic . For all the employers , Sat and Sunday values should be changed by Monday values .
    Please,its kind of urgent .Hopefully my question clear .
    Thanks :)

    For this type of question, it is always a good idea to post:
    1) CREATE TABLE statements for your table(s).
    2) INSERT statements with sample data.
    3) The desired result given the sample.
    4) A short description of the business rules which explains why want that particular result.
    5) Which version of SQL Server you are using.
    This helps to clarify ambuiguities in your post and makes it simple to copy and paste into a query window to develop a tested query.
    Since you said that this is urgent, I really recommend that you compose test data that covers all aspect of the problem, so that you can get a solution quickly.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Need SQL help to pull the accounts

    I have a table with account and publications(300 to 305). Each account is associated with more 1 to 5 publications. Now i want accounts that are associated with greater than or equal to 2 publications. I need your help with the SQL. Thanks.

    Maybe
    select account
      from accounts
    group by account
    having count(publication) > 1Regards
    Etbin
    Edited by: Etbin on 1.11.2011 21:59
    or
    select a.account
      from accounts a,publications p
    where a.account = p.account
    group by a.account
    having count(p.publication) > 1

  • 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().

  • 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

  • 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

  • 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 way

    Hi,
    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.

  • I need urgent help! I may have accidentally deleted everything on my friends computer!

    Okay so my friend asked me to watch his house while he was away. He told me that I was welcome to use his computer or anything else in there. I went to log on to his iMac, but all the accounts were locked! So I searched for a way to get in (with my phone, online) and I found a process with the following steps:
    1. Reboot
    2. Hold apple + s down after you hear the chime.
    3. When you get text prompt enter in these terminal commands to create a brand new admin account (hitting return after each line):
    * mount -uw /
    * rm /var/db/.AppleSetupDone
    * shutdown -h now
    4. After rebooting you should have a brand new admin account. When you login as the new admin you can simply delete the old one and you’re good to go again!
    I did not plan on deleting the old one, I just wanted to create a new one. But after following these steps the computer went into setup mode as if it was just being started for the first time out of the box! Please, I really need your help because e has important files on the computer that he did not back up anywhere and I hope I didn't delete everything! He is upset with me already, but said we would be alright if I found a way to fix it. I really need your help, please answer as fast as possible!!

    I think you're OK actually...
    Reset OS X Password Without an OS X CD...
    http://theappleblog.com/2008/06/22/reset-os-x-password-without-an-os-x-cd/
    Admin Hack...
    http://www.hackmac.org/?q=node/4
    Starts up like the first time you buy a new Mac, but after filling in all that info again, you should have access to the computer and the other Users & files will still be there... give the new User a different name than an existing one.

  • Need a help in SQL query

    Hi,
    I need a help in writing an SQL query . I am actually confused how to write a query. Below is the scenario.
    CREATE TABLE demand_tmp
    ( item_id  NUMBER,
      org_id   NUMBER,
      order_line_id NUMBER,
      quantity NUMBER,
      order_type NUMBER
    CREATE TABLE order_tmp
    ( item_id  NUMBER,
       org_id   NUMBER,
       order_line_id NUMBER,
       open_flag  VARCHAR2(10)
    INSERT INTO demand_tmp
    SELECT 12438,82,821,100,30 FROM dual;
    INSERT INTO demand_tmp
    SELECT 12438,82,849,350,30 FROM dual;
    INSERT INTO demand_tmp
    SELECT 12438,82,NULL,150,29 FROM dual;
    INSERT INTO demand_tmp
    SELECT 12438,82,0,50,-1 FROM dual;
    INSERT INTO order_tmp
    SELECT 12438,82,821,'Y' FROM dual;
    INSERT INTO order_tmp
    SELECT 12438,82,849,'N' FROM dual;
    Demand_tmp:
    Item_id        org_id   order_line_id       quantity       order_type     
    12438     82                 821                 100       30     
    12438     82                 849                 350       30     
    12438     82              NULL                 150       29     
    12438     82                    0                  50       -1     
    Order_tmp :
    Item_id        org_id        order_line_id      open_flag     
    12438     82                  821                Y     
    12438     82                  849                N     I need to fetch the records from demand_tmp table whose order_line_id is present in order_tmp and having open_flag as 'Y' or if order_type in demand_tmp table is 29.
    The below query will give the records whose order line id is present in order_tmp. But, If i need records which are having order_type=29 the below query wont return any records as order_line_id is NULL. If I place outer join I will get other records also (In this example order_type -1 records) . Please help me how can we write a query for this. Expected o/p is below.
    Query :
    Select item_id,org_id,order_line_id,quantity,order_type,open_flag
    from demand_tmp dt , order_tmp ot
    where dt.order_line_id = ot.order_line_id
    AND dt.item_id=ot.item_id
    AND dt.org_id = ot.org_id
    AND ot.open_flag = 'Y';
    Expected Output :                         
    item_id     org_id     order_line_id     quantity     order_type   open_flag
    12438     82                 821               100                    30             Y
    12438     82              NULL               150                29         NULL Thanks in advance,
    Rakesh
    Edited by: Venkat Rakesh on Oct 7, 2012 6:32 PM
    Edited by: Venkat Rakesh on Oct 7, 2012 8:39 PM

    Hi Rakesh,
    the query is not working as you would like ( but IS working as expected ) since your trying to compare null to another value.
    Comparing null always results in FALSE, also if you compare null to null. This is because null means undefined.
    select 1 from dual where null=null results in no data found.
    I would suggest using a non natural key to join the tables.
    For example include a column ID in the master table which is filled with a sequence and include that field as a foreign key in the detail table.
    This way you can easily join master and detail on ID = ID, and you don't have to worry about null values in this column since it's always filled with data.
    Regards,
    Bas
    btw, using the INNER JOIN and OUTER JOIN syntax in your SQL makes it better readable, since you're separating join conditions from the where clause, just a tip ;)

  • Friends need help desperate-- Second page not printing from the beginning

    Hi Friends,
    I have a large layout whose main-section is 8.5x20 (Width&height) which has 2 frames each having 2 repeating frames and about 20 fields in each repeating frame. When I run the report it shows the report right, but when I print, it prints only the first half since the report is long. When I change the property of the second frame of 'Page break before' to 'yes' it prints the second frame on the second page but print it at the same position as it printed on the first, and top of second page is all blank. How do I make to print from the beginning of the second page. Need your help.
    Thanks
    Joe.

    Hello,
    Most of the times, these problem are solved by "enclosing" the "Repeating frames" in frames with "Vertical Eleasticity" set to "Variable"
    Regards

  • Need urgent help! - I accidentally sycn my friend's iphone account to my company's phone. I could not swich back to my own icloud account because of the icloud password i enter was incorrect. My friend does not use this icloud account since age.

    Need urgent help! - I accidentally sync my friend's iphone account to my company's iphone. I could not switch back to my own icloud account because of the icloud password i enter was incorrect. My friend does not use this icloud account since age only remember 1 password which i already try but iphone shown that " incorrect password" I checked on icloud ID and try to log in but it shown as " You Apple ID was disable for security reason. To enable your account must reset password" but so bad again, the email address that he used to create icloud ID also lock for security reason. May Apple Supporter please help reset it ASAP? I can verify that I am the iphone's owner, as it belong to company's phone.

    Have your company IT department get proof that the company was the
    original purchaser of the iPhone and visit a physical Apple store with
    proof of original purchase, proof that person is company representative,
    and the iPhone - Apple may be able to help. If no physical Apple store,
    contact Apple - you will still need the same items of proof.

Maybe you are looking for

  • IPod First Generation Song Order Problem

    Equipment Specs: IPOD -- First Generation, 1 G size, Firmware ver # 1.1.5 ITunes -- Ver # 7.2.0.34 Problem I recently updated to the above version of ITunes. I also recently reset/erased all my songs (no podcasts or nothing else)from my IPOD. I then

  • AS3: organized text blocks

    Hey, I have a problem regarding text appearence on screen. I have few TFL dynamic text fields in CS5.5 that update each time according to users choises (a dictionary, in hebrew if it matters). As a text field I can't break lines or organize the text

  • Adding a second Nano

    My son has had a Nano for six months. Now I just got one and am trying to set it up for use. When I insert the CD software I get a message that states, "Another version of this product is already installed. Installation of this version cannot continu

  • Voice Over : Mouse pointer moves VO cursor Question

    Hi!! I have low vision, and i want to use the voice over with my mouse and/or trackpad. Im able to see where the text is but i cant read it well. When I enable the Voice Over I select "Mouse pointer moves Voice Over cursor in the preferences. This wo

  • Voip softphone behind a linksys home router - one way voice

    Either a softphone or a 7960 works when connected directly to a users DSL modem, but behind this particular linksys router it results in no inbound voice stream. I have to assume that this particular linksys router/fw is firewalling off the returned