Help needed in  bapi _requistion _create

Hi all,
I want to assign a delivery address and unloading point to a purchase requistion i got the delvery address but iam not able to figure out the unloading point.
I want you guys to let me know from which table i have to retrieve the unloading point and assign to which part of BAPI.
Iam sending my code please take a look at it and let me know if iam wrong any where and what i need to add for unloading point.
data: begin of itab_bapiebkn occurs 100.
include structure bapiebkn.
data: end of itab_bapiebkn.
data : I_BAPIMERQADDRDELIVERY TYPE TABLE OF BAPIMERQADDRDELIVERY,
W_BAPIMERQADDRDELIVERY TYPE BAPIMERQADDRDELIVERY.
w_quantity = itab-multiple * itab-bstrf.
w_item_no = w_item_no + 1.
itab_bapiebanc-preq_item = w_item_no.
itab_bapiebanc-doc_type = c_doc_type.
itab_bapiebanc-created_by = sy-uname.
itab_bapiebanc-material = itab-matnr.
itab_bapiebanc-plant = itab-werks.
itab_bapiebanc-quantity = w_quantity.
itab_bapiebanc-deliv_date = sy-datum + 1.
itab_bapiebanc-trackingno = w_bednr.
append itab_bapiebanc.
w_bapimerqaddrdelivery-PREQ_ITEM = w_item_no.
IF S_GROUP = '2'.
SELECT SINGLE * FROM TVARV WHERE NAME EQ 'ZGRP1'.
IF SY-SUBRC EQ 0.
SELECT SINGLE ADDRNUMBER FROM ADRC INTO w_bapimerqaddrdelivery-ADDR_NO
WHERE ADDRNUMBER = TVARV-LOW.
ENDIF.
Thanks in advance
Suchitra

Hi,
Check the sample code.
REPORT  ZTEST_BAPI_PR                             .
DATA:WA_EBAN LIKE EBAN.
DATA: BEGIN OF ITAB OCCURS 0,
            BSART(4),
*            ."Purchase requisition document type
            WERKS(4),
*             Plant
            TXZ01(40),
*            ."Short text
            MENGE(13),
*            ."Purchase requisition quantity
            MEINS(3),
*            ."Purchase requisition unit of measure
            EEIND(10),
*            ."Item delivery date
            WGBEZ(9),
*            ."Material Group
            NAME1(4),
*            ."Plant
            EKGRP(3),
*            ."Purchasing Group
            AFNAM(12),
*            ."Name of requisitioner/requester
            BEDNR(10),
*            ."Requirement Tracking Number
            KNTTP(1),
*            ."Account assignment category
            SAKTO(10),
*            ."G/L Account Number
            PS_POSID(8),
*            ."Work Breakdown Structure Element (WBS Element)
            EDITOR(132),
*            ."Text line
      END OF ITAB.
DATA: ITAB_BAPIEBANC  LIKE BAPIEBANC  OCCURS 0 WITH HEADER LINE.
DATA: ITAB_BAPIEBKN   LIKE BAPIEBKN   OCCURS 0 WITH HEADER LINE.
DATA: ITAB_BAPIEBANTX LIKE BAPIEBANTX OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF ERRMSG OCCURS 10.
        INCLUDE STRUCTURE BAPIRET2.
DATA: END OF ERRMSG.
DATA: ERRFLAG.
SELECT SINGLE * FROM EBAN
                INTO WA_EBAN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING WA_EBAN TO ITAB.
APPEND ITAB.
CLEAR ITAB.
ENDIF.
*CALL FUNCTION 'UPLOAD'
*  EXPORTING
*    filename = 'C:Documents and SettingssapDesktopNew Text Document (2).txt'
*    filetype = 'DAT'
*  TABLES
*    data_tab = itab.
*if sy-subrc <> 0.
*  message id sy-msgid type sy-msgty number sy-msgno
*          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*  exit.
*endif.
LOOP AT ITAB.
  ITAB_BAPIEBANC-DOC_TYPE       =    ITAB-BSART.
  ITAB_BAPIEBANC-SHORT_TEXT     =    ITAB-TXZ01.
  ITAB_BAPIEBANC-QUANTITY       =    ITAB-MENGE.
  ITAB_BAPIEBANC-UNIT           =    ITAB-MEINS.
  IF NOT ITAB-EEIND IS INITIAL.
    ITAB_BAPIEBANC-DELIV_DATE     =    ITAB-EEIND.
  ELSE.
    ITAB_BAPIEBANC-DELIV_DATE     =  SY-DATUM + 30.
  ENDIF.
  ITAB_BAPIEBANC-PLANT          =    ITAB-WERKS.
  ITAB_BAPIEBANC-PUR_GROUP      =    ITAB-EKGRP.
  ITAB_BAPIEBANC-PREQ_NAME      =    ITAB-AFNAM.
  ITAB_BAPIEBANC-TRACKINGNO     =    ITAB-BEDNR.
  ITAB_BAPIEBANC-MAT_GRP        =    ITAB-WGBEZ.
  ITAB_BAPIEBANC-ACCTASSCAT     =    ITAB-KNTTP.
    ITAB_BAPIEBANC-ACCTASSCAT     =    'A'.
  ITAB_BAPIEBKN-G_L_ACCT        =    ITAB-SAKTO.
  ITAB_BAPIEBKN-WBS_ELEM        =    ITAB-PS_POSID.
*  itab_bapiebantx-text_line     =    itab-editor.
ITAB_BAPIEBANTX-TEXT_LINE     =    'Test for Purchase requisiton'.
  APPEND ITAB_BAPIEBKN.
  APPEND ITAB_BAPIEBANC.
  APPEND ITAB_BAPIEBANTX.
ENDLOOP.
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
  TABLES
    REQUISITION_ITEMS              = ITAB_BAPIEBANC
    REQUISITION_ACCOUNT_ASSIGNMENT = ITAB_BAPIEBKN
    REQUISITION_ITEM_TEXT          = ITAB_BAPIEBANTX
    RETURN                         = ERRMSG.
LOOP AT ERRMSG.
  IF ERRMSG-TYPE EQ 'E'.
    WRITE:/'Error in function', ERRMSG-MESSAGE.
    ERRFLAG = 'X'.
  ELSEif ERRMSG-TYPE = 'S' .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    WRITE:/ ERRMSG-MESSAGE.
  ENDIF.
ENDLOOP.
Regards
vijay

Similar Messages

  • Help needed in BAPI for uploading data in FB01 -  Urgent!!!

    Hi,
        i need to post a document in FB01.
    i am getting the following details from the user in a .CSV file.
    Vendor no, vendor name, amount, document date, posting datem reference vendor line item text and Gl account line item text.
    i am using BAPI BAPI_ACC_DOCUMENT_POST to post the document.
    Now my req is if the amount is in negative then
       use posting key 31 against the vendor and 40 for GL account
    if its positive amounts
      use posting key of 24 against vendor and 50 against the GL account.
    Now by default, when the amount is negative the function is working fine.
                    but when its is positive its posting 21 against vendor and 50 against GL account. but i need 24 against vendor
    can any one tel me, where should i pass these value in the BAPI?
    or is there any other way of doing it?
    Regards,
    Niyaz

    Hi,
    the posting keys 31/21 (01/11 and 40/50) are hard coded and cannot be populated from the  interface. This is because a different posting key could have a different posting logic from what is implemented in the BAPI.
    So unless you want to do some modifications here, you have to use the fixed PKs. Pls. let me know if you are interested in where exactly the PKs are defined (hardcoded). I have this noticed for myself earlier but my notices are on another PC
    Hope that helps, points welcome
    Csaba

  • Help needed on bapi

    hi,
    I would be extremely gratefull if anyone could guid me how to upload & post excel data sheet in sap using bapi or bapi active X control.Also how data coversion are to be carried off ?
    Scenario :
    Excel sheet:
    Name1 Name2 Age
    joe   dave  24
    smith S     26
    I want to upload this using bapi & then post the document in transaction zf12.

    Amna,
    You can upload the file from the
    Presentation Server - CL_GUI_FRONTEND_UTILITIES->GUI_UPLOAD
    Application Server - OPEN DATASET.
    However, you have not mentioned what data you are uploading as the BAPI will change depending on that. Look at the BAPI transaction and you will find a list of BAPI's classified according to the business functionality.
    Once the data is internal table, you need to pass that to the BAPI function module.
    Regards,
    Ravi
    Note : Please mark the helpful answers.

  • Logic needed and help needed in BAPI..

    Hi,
    I am looking 2 BAPI's for posting an accounting doc in GL.
    BAPI_ACC_DOCUMENT_POST
    BAPI_ACC_GL_POSTING_POST
    But in the above mentioned BAPI's I dont find any posting key field.
    Here my scenario is to use the posting keys 40 and 50 for posting's.
    Can any body suggest me how to approach for this.
    Thanks in Advance.
    Message was edited by: KDeepak
    Message was edited by: KDeepak
    Message was edited by: KDeepak

    Hi
    I changed my code to create three documents:
    TABLES: bapiache09, mard.
    DATA: t_items  LIKE STANDARD TABLE OF bapiacgl09 WITH HEADER LINE,
          t_amount LIKE STANDARD TABLE OF bapiaccr09 WITH HEADER LINE,
          t_result LIKE STANDARD TABLE OF bapiret2   WITH HEADER LINE.
    DATA: belnr TYPE belnr_d,
          gjahr TYPE gjahr.
    DATA times TYPE n.
    DO 3 TIMES.
    Header Data
      bapiache09-comp_code   = 'ZN01'.
      bapiache09-doc_date    = sy-datum.
      bapiache09-pstng_date  = sy-datum.
      bapiache09-doc_type    = 'PV'.
    bapiache09-ref_doc_no  = 'BAPI Test'.
      bapiache09-username    = sy-uname.
      bapiache09-bus_act     = 'RFBU'.
      MOVE sy-index TO times.
      CONCATENATE 'BAPI TEST N.' times INTO bapiache09-ref_doc_no.
      REFRESH t_items.
    First Item
      MOVE 1 TO t_items-itemno_acc.
    Account number
      t_items-gl_account = '0012440130'.
    The posting key are 40/50 by default, if you need different keys, set
    the transaction business code here: check hits of table T030B to see
    the link between transaction and posting keys
    *accountgl-acct_key   = 'ACC'. <----
      APPEND t_items.
    Second Item
      MOVE 2 TO t_items-itemno_acc.
    Account number
      t_items-gl_account = '0012440140'.
    The posting key are 40/50 by default, if you need different keys, set
    the transaction business code here: check hits of table T030B to see
    the link between transaction and posting keys
    *accountgl-acct_key   = 'ACC'. <----
      APPEND t_items.
      REFRESH t_amount.
    Set amount
      MOVE 1 TO t_amount-itemno_acc.
      t_amount-currency = 'EUR'.
      MOVE 1000 TO t_amount-amt_doccur.
      APPEND t_amount.
      MOVE 2 TO t_amount-itemno_acc.
      t_amount-currency = 'EUR'.
      MOVE 1000 TO t_amount-amt_doccur.
      t_amount-amt_doccur = t_amount-amt_doccur * -1.
      APPEND t_amount.
      REFRESH t_result.
    check posting
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
        EXPORTING
          documentheader = bapiache09
        TABLES
          accountgl      = t_items
          currencyamount = t_amount
          return         = t_result.
      LOOP AT t_result WHERE ( type = 'E' OR
                               type = 'A' ).
        EXIT.
      ENDLOOP.
      IF sy-subrc <> 0.
        REFRESH t_result.
        CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
          EXPORTING
            documentheader = bapiache09
          TABLES
            accountgl      = t_items
            currencyamount = t_amount
            return         = t_result.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    Print Message
      LOOP AT t_result.
        WRITE: t_result-message.
    Get Number
        IF t_result-id     = 'RW' AND
           t_result-number = '605'.
          belnr = t_result-message_v2(10).
          gjahr = t_result-message_v2+14(4).
        ENDIF.
      ENDLOOP.
    ENDDO.
    Just as you can see, I insert my code into DO/ENDO cycle and so I re-call the BAPI three times.
    In this situazione I posted document 3 documents and the field AWKEY is correctly filled.
    Max

  • Help needed with BAPI

    Hi experts,
    I am trying to implement BAPI for simulating tcode. FBS1.
    As a first step, I have implemented the BAPI -> BAPI_ACC_GL_POSTING_POST
    I did not find any holder where i can give the reversal date. But I could find reason_rev for reversal reason.
    Now as a second step. I am trying to use the BAPI -> BAPI_ACC_GL_POSTING_REV_POST.
    I am trying to pass the following values from the first BAPI
        reversal-obj_type       = obj_type.
        reversal-obj_key        = obj_key.
        reversal-obj_sys        = obj_sys.
        reversal-obj_key_r      = 'AWREF_REV'.
    I am not sure if i have to pass the reversal date in reversal-pstng_date
    Can some one please let me know if I am missing something here.
    Also please let me know if I am going in the correct way to implement BAPI for FBS1
    thanks alot.

    hi
    you can try out bapi's like
    BAPI_ACC_GL_POSTING_POST and BAPI_ACC_GL_POSTING_REV_POST.
    you can use FM as well which is POSTING_INTERFACE_DOCUMENT
    you can check out this link for all the bapi's -http://planetsap.com/Bapi_main_page.htm
    hope this helps
    regards
    Aakash Banga

  • Help need with bapi for mb1a

    Hi all,
    iam creating a good movement with 201 using bapi. I created manually with the data in the t code MB1A. LATER I TRIED WITH THE SAME DATA IN PROGRAM BY PASSING THROOUGH bAPI
    BUT FOR SOME REASON IAM GETTING AN ERROR SAYING
    EKI                  222Cost center ABCD/12345 does not exist on 03/28/2007.
    but this cost center is valid till 9999. I never passed ABCD what is that?
    I TRIED WITH SAME COST CENTER IT WORKED WHILE CREATE MANUALLY WITHT THE SAME DATA IN mb1a T-CODE.
    tHIS IS MY CODE LET ME IF IAM MISSING ANYTHING
    data: gm_header  type bapi2017_gm_head_01.
    data: gm_code    type bapi2017_gm_code.
    data: gm_headret type bapi2017_gm_head_ret.
    data: gm_item    type table of
                     bapi2017_gm_item_create with header line.
    data: gm_return  type bapiret2 occurs 0 with header line.
    data: gm_retmtd  type bapi2017_gm_head_ret-mat_doc.
    clear: gm_return, gm_retmtd. refresh gm_return.
    Setup BAPI header data.
    gm_header-pstng_date = sy-datum.
    gm_header-doc_date   = sy-datum.
    gm_code-gm_code      = '03'.                                " MB1A
    Write 971 movement to table
    clear gm_item.
    move '201'                 to gm_item-move_type     .
    move '90998'  to gm_item-material.
    move '1'     to gm_item-entry_qnt.
    MOVE 'EA'    TO GM_ITEM-ENTRY_UOM.
    move 'PNT'  to gm_item-plant.
    move 'PPNT'  to gm_item-stge_loc.
    *MOVE '0901'   TO GM_ITEM-MOVE_REAS.
    move '12345' to gm_item-COSTCENTER.
    append gm_item.
    Call goods movement BAPI
    call function 'BAPI_GOODSMVT_CREATE'
         exporting
              goodsmvt_header  = gm_header
              goodsmvt_code    = gm_code
         importing
              goodsmvt_headret = gm_headret
              materialdocument = gm_retmtd
         tables
              goodsmvt_item    = gm_item
              return           = gm_return.
    if not gm_retmtd is initial.
      commit work and wait.
      call function 'DEQUEUE_ALL'.
    else.
      commit work and wait.
      call function 'DEQUEUE_ALL'.
    endif.
    write:/ gm_retmtd.
    loop at gm_return.
      write:/ gm_return.
    endloop.
    Thanks

    Hi,
    Iam abale to create a goods issue with the same data.
    The only difference i see when i create through MB1A, in the initial screen i see the collective slip has been selected and in the second when i give the cost center and hit enter it brings up the buisness area and then when i save it it creates a document number.
    I tried passing the buisness area but iam getting same error.
    If it work through mB1A then it should work through the BAPI RIGHT?
    tAKE A LOOK AT MY BAPI CODE AND LET ME KNOW IF IA M MISSING ANYTHING IN HERE
    tHANKS

  • Need a bapi or table for GL Report

    Hi experts,
    I need a bapi or table for generating report period balance for GL accounts. i found one bapi BAPI_GL_GETGLACCPERIODBALANCES which is closer to my requirement. But i want to get the balances for cost center and particular material. As Cost center and product ranges are in my selection fields.
    Can anyone tell me table or BAPI?

    SAP standard infoset query provides a report STDCOST for this.
    May be this will suit your requirement. It will give material wise costing.
    hope this helps.
    reward if helpful.

  • I need a BAPI or function that can create a PO without the purchase req.

    I need a BAPI or function that can create a PO without the reference to a purchase requisition. We are creating "direct POs" (with no reference to PR) manually. And we have a large amount of documents to create. I can't figure out if BAPI_PO_CREATE and BAPI_PO_CREATE1 can help us by doing this, because I've understood this BAPIs creates POs only with the reference to a purchase requisition.
    Thanks in advance!!
    Sebastian

    Sorry I'm late guys, I couldn't replay your posts because I was busy.
    Charlie,
    ...just because we have the data already in the SAP system.
    My client doesn't want purchase requisitions to be created from the PM orders. Instead he asked us to create the purchase workflow by generating direct purchase orders from the PM orders, basically taking the information from the purchase agreement within the order's tasks. Maybe you don't understand a bit what I'm saying, but let me get this straight: we can't use LSMW because data doesn't come from a legacy.
    Ian,
    ...after all, and like you've said, we're gonna use BAPI_PO_CREATE1 for creating the POs. Today I finally realized that, purchase requisitions aren't mandatory for the bapi to perform the process. If something goes wrong, I'll let you know.
    Thanks anyway for your attention.
    Sebastian

  • I need a bapi  for workdownstructure elements

    i need a bapi  for workdownstructure elements 
    •     WBS number
    •     WBS descriptions
    •     WBS start date
    •     WBS end date
    •     Status
    thanks and regards,
    jameer.p
    Edited by: Jameer P on Jan 30, 2008 12:59 PM

    Hai.
    It may help you.
    can use WS_DOWNLOAD like this:
    L_T_HEADERS TYPE TABLE OF TEXT40.
    IF SP_LOCAL = 'X'.
    Headings: TEXT-U01 ... TEXT-U28
        DO 28 TIMES.
          CLEAR: L_F_INDEX,L_F_NAME,L_F_HEADERS.
          L_F_INDEX = SY-INDEX.
          CONCATENATE 'TEXT-U' L_F_INDEX INTO L_F_NAME.
          ASSIGN (L_F_NAME) TO <FS_HEADER>.
          L_F_HEADERS = <FS_HEADER>.
          APPEND L_F_HEADERS TO L_T_HEADERS.
        ENDDO.
        CALL FUNCTION 'WS_DOWNLOAD'
             EXPORTING
                  FILENAME                = SP_FILE
                  FILETYPE                = 'DAT'
             TABLES
                  DATA_TAB                = L_T_OUT
                  FIELDNAMES              = L_T_HEADERS
             EXCEPTIONS
                  FILE_OPEN_ERROR         = 1
                  FILE_WRITE_ERROR        = 2
                  INVALID_FILESIZE        = 3
                  INVALID_TYPE            = 4
                  NO_BATCH                = 5
                  UNKNOWN_ERROR           = 6
                  INVALID_TABLE_WIDTH     = 7
                  GUI_REFUSE_FILETRANSFER = 8
                  CUSTOMER_ERROR          = 9
                  OTHERS                  = 10.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          LEAVE PROGRAM.
        ELSE.
          DESCRIBE TABLE L_T_OUT LINES L_F_COUNT.
          MESSAGE I145 WITH L_F_COUNT SP_FILE.
        ENDIF.
    Regards.
    Sowjanya.b.

  • I need a bapi documentation

    hi all,
      this is siva. i need a bapi documentation.
    how to create the RFC using bapi fucntion modules to extract the data from particular master tables.
    pls send the demo also how to create the RFC.
    with regards,
    siva.
    9985774578

    HI Siva,
    chk these links.
    http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
      Reward points if it helps.
    Manish

  • Need a BAPI to upload "Number of packages" for outbound delivery in VL02N

    Hi,
    I need a BAPI which can change data into field LIKP-ANZPK (Number of packages) for outbound delivery with tcode VL02N.
    I saw BAPI_OUTB_DELIVERY_CHANGE but don't know what to parameter to fill.
    Can anyone help me?
    Tarick.

    This solution is in kzapk and kzntg.
    Example:
    CLEAR ls_vbkok.
         ls_vbkok-vbeln_vl  = <ls_created>-document_numb.
         ls_vbkok-vbtyp_vl  = <ls_created>-document_category_sd.
         ls_vbkok-anzpk     = id_volum.
         ls_vbkok-kzapk  = 'X'.
         ls_vbkok-kzntg  = 'X'.
         ls_vbkok-wabuc  = 'X'.
         CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
           EXPORTING
             vbkok_wa       = ls_vbkok
             update_picking = 'X'
             synchron       = 'X'
             commit         = 'X'
             delivery       = <ls_created>-document_numb
           IMPORTING
             ef_error_any   = ld_error.

  • Need about bapi's

    Hi,
    i need the BAPI's material with theory.
    Regards,
    Roshan.

    Hi,
    try this link.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/7e/5e114a4a1611d1894c0000e829fbbd/frameset.htm
    reward if it helps.
    Best regards,
    Kenny

  • Need std Bapi to make work MSS functionality

    Hi Friends,
    We are doing a portal which contains functionalities of MSS .
    I need Std Bapis to connect from outside SAP.
    Functionalities are :
    1. Intra company transfer/promotion
    2.Create /Maintain organization
    3. Payroll data change
    4.Individual termination.
    Please guide me to get Bapis or any other way to achieve these functionalities.
    Best answers will be rewarded.
    Thanks for your help.
    Cheers,
    Raj.

    Dear John,
    Even it it is a bit late, I think I'm facing same issue.
    My target is to use QM notification combined with functional location object (normally part of PM/CS modules).
    I did customised my own QM notification with link to functional location.
    It is working fine within SAP ERP 6.
    Now I want to use BAPI to create notification : BAPI_QUALNOT_CREATE.
    Unfortunatly, import parameters based on structure BAPI2078_NOTHDRI does not contain filed TPLNR for functional location.
    Within the BAPi a call to function QQM_MAP_EXT_TO_INT is done.
    Within this function, mapping between RIQS5 and BAPI2078_NOTHDRI is done.
    Structure already RIQS5 contains filed TPLNR Functional location ; if field TPLNR is filled then the BAPI is taking care of the update.
    I think I need to :
    1) Add field TPLNR functional location to BAPI2078_NOTHDRI
    2) Generate mapping MAP2I_BAPI2078NOTHDRI_RIQS5 using transaction BDBD
    And then it should work fine.
    What do you think ?
    Rgds
    Gilles

  • Troubleshoting help needed:  My iMac keeps crashing and restarting with a report detail: "spinlock application timed out"  What can I do to fix this?timed out"

    Troubleshooting help needed:  My iMac keeps crashing and restarting with a notice: "Spinlock application timed out"  What can I do?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the page that opens.
    Select the most recent panic log under System Diagnostic Reports. Post the contents — the text, please, not a screenshot. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header and body of the report, if it’s present (it may not be.) Please don't post shutdownStall, spin, or hang reports.

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

Maybe you are looking for