Isse withGET statement

Hi All,
I have a reports using LDB PNPCE. It's a custom report.
The contrl is not going to GET statement in this. It's directly going to END-OF-SELECTION reading everything before GET statement.
Tables: PERNR.
NODES: PERAS.
START-OF-SELECTION.
**--Get first date & last date of month
  PERFORM get_first_last_date_month CHANGING w_strdate
                                             w_enddate.
**--Get Employees data
GET peras.
**--Code
END-OF-SELECTION
Please suggest.

Hi again,
I just tried, and it is working fine.
The event sequence is;
start-of-selection.
get peras. -
multiple times
end-of-selection.
Just copy paste to get a feel of it.
report abc.
tables : pernr.
nodes : peras.
start-of-selection.
write :/ 'start of selection'.
get peras.
write 'peras event '.
end-of-selection.
write :/ 'end of selection'.
regards,
amit m.

Similar Messages

  • Report for stock statement

    hi guy's,
       i am doing report for the stock statement .... my issue is in MB5B if i reverse some document it shows as it move's to issue QTY and my receipt is same but my closing stock is correct ...is there any std report avalible ....
    thank's in advance

    Use this code :
    TABLES : MSEG,MKPF,MARA,MAKT,BEWART,MSLB,BSIM.
    TYPE-POOLS : SLIS.
    DATA : IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
           IT_LIST_HEADER TYPE SLIS_T_LISTHEADER,
           IT_EVENTS TYPE SLIS_T_EVENT,
           GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
           WA_SORT TYPE SLIS_SORTINFO_ALV,
           IT_SORT TYPE SLIS_T_SORTINFO_ALV,
           REPID LIKE SY-REPID,
           FRM_DATE(10),TO_DATE(10),
           DISPTEXT(255),DISPTEXT2(255).
    TYPES : BEGIN OF ST_OPBAL,
             MATNR LIKE MSEG-MATNR,
             MAKTX LIKE MAKT-MAKTX,
             BATCH LIKE MSEG-CHARG,
             BWART LIKE MSEG-BWART,
             MENGE LIKE MSEG-MENGE,
             ZEILE LIKE MSEG-ZEILE,
             WERKS LIKE MSEG-WERKS,
             SOBKZ LIKE MSEG-SOBKZ,
             BUDAT LIKE MKPF-BUDAT,
             SHKZG LIKE MSEG-SHKZG,
             DMBTR LIKE MSEG-DMBTR,
             MBLNR LIKE MSEG-MBLNR,
             LGORT LIKE MSEG-LGORT,
           END OF ST_OPBAL.
    DATA : OPBAL TYPE ST_OPBAL OCCURS 0 WITH HEADER LINE,
           TMP_OPBAL TYPE ST_OPBAL OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF BAL_NOREF OCCURS 0,
              MATNR LIKE MARA-MATNR,
              SHKZG LIKE MSEG-SHKZG,
              DMBTR LIKE MSEG-DMBTR,
           END OF BAL_NOREF.
    DATA : BEGIN OF OPBAL2 OCCURS 0,
             SNO(3)      TYPE N,
             MATNR       LIKE MSEG-MATNR,
             MAKTX       LIKE MAKT-MAKTX,
             OP_BAL      LIKE MSEG-MENGE,
             OP_STKVAL   LIKE MSEG-DMBTR,   "NEW
             REC         LIKE MSEG-MENGE,
             T_OPBAL_REC LIKE MSEG-MENGE,
             REC_STKVAL  LIKE MSEG-DMBTR,   "NEW
             ISS         LIKE MSEG-MENGE,
             ISS_STKVAL  LIKE MSEG-DMBTR,   "NEW
             SALES       LIKE MSEG-MENGE,
             T_ISS       LIKE MSEG-MENGE,
             CL_BAL      LIKE MSEG-MENGE,
             BATCH       LIKE MSEG-CHARG,
             SUBCON      LIKE MSEG-MENGE,
             CL_STKVAL   LIKE MSEG-DMBTR,
           END OF OPBAL2.
    DATA  SERNO(4) TYPE C.
    DATA OPTOT  TYPE P DECIMALS 3.
    DATA RECTOT TYPE P DECIMALS 3.
    DATA ISSTOT TYPE P DECIMALS 3.
    DATA TOTALL TYPE P DECIMALS 3.
    DATA FLG        TYPE N.
    DATA FLAG       TYPE N.
    DATA STOCKVAL        TYPE MSEG-DMBTR.
    DATA REC_STOCKVAL    TYPE MSEG-DMBTR.
    DATA ISS_STOCKVAL    TYPE MSEG-DMBTR.
    DATA CL_STKVAL       TYPE MSEG-DMBTR.
    SELECTION-SCREEN BEGIN OF BLOCK X WITH FRAME.
         SELECT-OPTIONS: P_MATNR FOR MSEG-MATNR,
                         P_MGRP  FOR MARA-MATKL,
                         P_DATE FOR MKPF-BUDAT,
         P_PLANT FOR MSEG-WERKS DEFAULT  'NB01' OBLIGATORY NO INTERVALS
                                                    NO-EXTENSION .
         SELECT-OPTIONS: P_STLOC FOR MSEG-LGORT NO INTERVALS NO-EXTENSION.
    SELECTION-SCREEN END OF BLOCK X.
    INITIALIZATION.
       REPID = SY-REPID.
       PERFORM FILL_FLDCAT USING IT_FLDCAT.
       PERFORM FILL_EVENTS USING IT_EVENTS.
       PERFORM FILL_LAYOUT USING GS_LAYOUT.
    START-OF-SELECTION.
      CONCATENATE P_DATE-LOW6(2) '.' P_DATE-LOW4(2) '.' P_DATE-LOW+0(4)
      INTO FRM_DATE.
      CONCATENATE P_DATE-HIGH6(2) '.' P_DATE-HIGH4(2) '.' P_DATE-HIGH+0(4)
      INTO TO_DATE.
      CONCATENATE TEXT-003 FRM_DATE' TO : ' TO_DATE INTO DISPTEXT.
      CONCATENATE TEXT-004 P_PLANT-LOW ' Storage Location : ' P_STLOC-LOW
      INTO DISPTEXT2.
      PERFORM FILL_HEADER USING IT_LIST_HEADER.
      SELECT  A~MATNR
              F~MAKTX
              A~CHARG
              A~BWART
              A~MENGE
              A~ZEILE
              A~WERKS
              A~SOBKZ
              D~BUDAT
              A~SHKZG
              A~DMBTR
              A~MBLNR
              A~LGORT
              INTO TABLE OPBAL
       FROM MKPF AS D JOIN MSEG AS A
               ON DMBLNR = AMBLNR  AND
                  DMJAHR = AMJAHR
            JOIN MARA AS E
               ON EMATNR = AMATNR
            JOIN MAKT AS F
               ON FMATNR = AMATNR
       WHERE   A~MATNR IN P_MATNR
         AND   A~WERKS IN P_PLANT
         AND   A~KZBEW IN (' ','B')
         AND   E~MATKL IN P_MGRP
         AND   A~BWART NOT IN ('541','542','321','322','121')
         AND   A~KZVBR NOT IN ('A')
         AND   D~BUDAT LE P_DATE-HIGH.
    LOOP AT OPBAL WHERE BWART EQ '544' AND LGORT EQ ''.
       TMP_OPBAL = OPBAL.
       APPEND TMP_OPBAL.
    ENDLOOP.
    DELETE OPBAL WHERE ( BWART EQ '309' AND DMBTR EQ 0  ).
    DELETE OPBAL WHERE ( BWART NE '543' AND LGORT EQ '' ).
    LOOP AT TMP_OPBAL.
       OPBAL = TMP_OPBAL.
       APPEND OPBAL.
    ENDLOOP.
    STOCKVAL = 0.
    SORT OPBAL BY MATNR BATCH BUDAT.
    LOOP AT OPBAL.
      SELECT SINGLE LBLAB INTO MSLB-LBLAB FROM MSLB
                            WHERE MATNR = OPBAL-MATNR.
      IF OPBAL-BUDAT LT P_DATE-LOW.
         IF OPBAL-SHKZG = 'H'.
            OPTOT = OPTOT - OPBAL-MENGE.
         ELSEIF OPBAL-SHKZG = 'S'.
            OPTOT = OPTOT + OPBAL-MENGE.
         ENDIF.
    For the duration   II part  *****************
      ELSEIF OPBAL-BUDAT IN P_DATE.
         IF OPBAL-SHKZG = 'H'.
            ISSTOT      = ISSTOT + OPBAL-MENGE.
         ELSEIF OPBAL-SHKZG = 'S'.
            RECTOT = RECTOT + OPBAL-MENGE.
         ENDIF.
      ENDIF.
    AT END OF BATCH. " modified for chek
       READ TABLE OPBAL INDEX SY-TABIX.
       CLEAR BAL_NOREF. REFRESH BAL_NOREF.
       SELECT MATNR SHKZG SUM( DMBTR )
         INTO TABLE BAL_NOREF
         FROM BSIM
        WHERE BUDAT LT P_DATE-LOW  AND
              MATNR EQ OPBAL-MATNR AND
              BWTAR EQ OPBAL-BATCH AND
              BWKEY IN P_PLANT     AND
              BLART IN ('RE','WE','WA','PR')
        GROUP BY MATNR SHKZG.
       LOOP AT BAL_NOREF.
          IF BAL_NOREF-SHKZG = 'H'.
             STOCKVAL = STOCKVAL - BAL_NOREF-DMBTR.
          ELSE.
             STOCKVAL = STOCKVAL + BAL_NOREF-DMBTR.
          ENDIF.
       ENDLOOP.
       CLEAR BAL_NOREF. REFRESH BAL_NOREF.
       SELECT MATNR SHKZG SUM( DMBTR )
         INTO TABLE BAL_NOREF
         FROM BSIM
        WHERE BUDAT IN P_DATE AND
              MATNR EQ OPBAL-MATNR AND
              BWTAR EQ OPBAL-BATCH AND
              BWKEY IN P_PLANT     AND
              BLART IN ('RE','WE','WA','PR')
        GROUP BY MATNR SHKZG.
       LOOP AT BAL_NOREF.
          IF BAL_NOREF-SHKZG = 'H'.
             ISS_STOCKVAL = ISS_STOCKVAL + BAL_NOREF-DMBTR.
          ELSE.
             REC_STOCKVAL = REC_STOCKVAL + BAL_NOREF-DMBTR.
          ENDIF.
       ENDLOOP.
       " MSLB-LBLAB (STOCK WITH SUBCONTRACTOR).
       CL_STKVAL       = STOCKVAL + REC_STOCKVAL - ISS_STOCKVAL.
       TOTALL =  OPTOT + RECTOT - ISSTOT.
       IF OPTOT = '0'   AND RECTOT = '0'  AND ISSTOT = '0'.
          FLG = 1.
       ENDIF.
       IF FLG = 1.
          CLEAR FLG.
       ELSE.
          SERNO = SERNO + 1.
          OPBAL2-SNO         = SERNO.
          OPBAL2-MATNR       = OPBAL-MATNR.
          OPBAL2-MAKTX       = OPBAL-MAKTX.
          OPBAL2-OP_BAL      = OPTOT.
          OPBAL2-REC         = RECTOT.
          OPBAL2-T_OPBAL_REC = OPTOT + RECTOT.
          OPBAL2-ISS         = ISSTOT.
          OPBAL2-T_ISS       = ISSTOT.
          OPBAL2-CL_BAL      = TOTALL.
          OPBAL2-BATCH       = OPBAL-BATCH.
          OPBAL2-SUBCON      = MSLB-LBLAB.
          OPBAL2-OP_STKVAL   = STOCKVAL.
          OPBAL2-ISS_STKVAL  = ISS_STOCKVAL.
          OPBAL2-REC_STKVAL  = REC_STOCKVAL.
          OPBAL2-CL_STKVAL   = CL_STKVAL.
          APPEND OPBAL2.
       ENDIF.
      OPTOT = 0.
      RECTOT = 0.
      ISSTOT = 0.
      STOCKVAL = 0.
      ISS_STOCKVAL = 0.
      REC_STOCKVAL = 0.
      CL_STKVAL    = 0.
    ENDAT.
    ENDLOOP.
      WA_SORT-SPOS = 1.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = REPID
          IT_FIELDCAT        = IT_FLDCAT
          IT_EVENTS          = IT_EVENTS
          IS_LAYOUT          = GS_LAYOUT
          IT_SORT            = IT_SORT
        TABLES
          T_OUTTAB           = OPBAL2.
    FORM FILL_FLDCAT USING P_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
       PERFORM FILL_PARAM_FLDCAT USING  1 'SNo'          'SNO'       ' ' 'X'
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  2 'Material No.' 'MATNR'     ' ' 'X'
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  3 'Description'  'MAKTX'     ' ' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  4 'Op.Bal'      'OP_BAL'     'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  5 'Op.Stock Val' 'OP_STKVAL' 'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  6 'Receipts'     'REC'       'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  7 'Total'     'T_OPBAL_REC'  'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  8 'Rect.Val.' 'REC_STKVAL'   'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  9 'Issues'    'ISS'          'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 10 'Iss. Val.' 'ISS_STKVAL'   'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 11 'Cl. Bal.'     'CL_BAL'    'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 12 'Cl.Stock Val' 'CL_STKVAL' 'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 13 'BATCH '       'BATCH'     ' ' ' '
       'OPBAL2' P_FLDCAT.
    ENDFORM.
    FORM FILL_PARAM_FLDCAT USING VALUE(P_COL) VALUE(P_TEXT) VALUE(P_FLDNAME)
                           VALUE(P_DOSUM) VALUE(P_NOZERO) VALUE(P_TABNAME)
                           PP_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
       DATA : WA_FLDCAT TYPE SLIS_FIELDCAT_ALV.
       CLEAR WA_FLDCAT.
         WA_FLDCAT-COL_POS   = P_COL.
         WA_FLDCAT-SELTEXT_M = P_TEXT.
         WA_FLDCAT-FIELDNAME = P_FLDNAME.
         WA_FLDCAT-TABNAME   = P_TABNAME.
         WA_FLDCAT-DO_SUM    = P_DOSUM.
         WA_FLDCAT-NO_ZERO   = P_NOZERO.
       APPEND WA_FLDCAT TO PP_FLDCAT.
    ENDFORM.
    FORM FILL_HEADER USING P_IT_LIST_HEADER TYPE SLIS_T_LISTHEADER.
      DATA: LS_LINE TYPE SLIS_LISTHEADER.
      CLEAR LS_LINE.
      LS_LINE-TYP = 'S'.
      LS_LINE-INFO = TEXT-002.
      APPEND LS_LINE TO P_IT_LIST_HEADER.
      CLEAR LS_LINE.
      LS_LINE-TYP = 'S'.
      LS_LINE-INFO = DISPTEXT.
      APPEND LS_LINE TO P_IT_LIST_HEADER.
      CLEAR LS_LINE.
      LS_LINE-TYP = 'S'.
      LS_LINE-INFO = DISPTEXT2.
      APPEND LS_LINE TO P_IT_LIST_HEADER.
    ENDFORM.
    FORM FILL_EVENTS USING P_IT_EVENTS TYPE SLIS_T_EVENT.
       DATA LS_EVENT TYPE SLIS_ALV_EVENT.
       MOVE 'TOP_OF_PAGE' TO LS_EVENT-FORM.
       MOVE 'TOP_OF_PAGE' TO LS_EVENT-NAME.
       APPEND LS_EVENT TO P_IT_EVENTS.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
         IT_LIST_COMMENTARY       = IT_LIST_HEADER.
    ENDFORM.
    FORM FILL_LAYOUT USING P_GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
       P_GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
       P_GS_LAYOUT-ZEBRA             = 'X'.
       P_GS_LAYOUT-FLEXIBLE_KEY      = 'X'.
    ENDFORM.
    FOR TESTING PURPOSE.
    *SORT OPBAL BY BUDAT.
    *CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM = REPID
         IT_FIELDCAT        = IT_FLDCAT
         IT_EVENTS          = IT_EVENTS
       TABLES
         T_OUTTAB           = OPBAL.
    *FORM FILL_FLDCAT USING P_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
      PERFORM FILL_PARAM_FLDCAT USING  1 'MBLNR'        'MBLNR'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  2 'CREDIT/DEBIT' 'SHKZG'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  3 'MOV.TYP.'     'BWART'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  4 'ST.LOC.'     'LGORT'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  5 'STOCK VAL'    'DMBTR'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  6 'POS.DATE'     'BUDAT'
      'OPBAL' P_FLDCAT.
    *ENDFORM.

  • JDBC , UPDATE STATEMENT

    I am writing a Update Statement as fllows
    String sql= "update users_login set user_temp_pass='"+null_value+"' and user_pass='" + inputPwd + "'where user_id='"+inputUserid"';";
    But is still showing error saying that
    the statement has to be terminated by a ';'
    Please help me writing the statement correctly.

    Thank you, I have one more question.
    I am writing the following code to erase the temporary password and put the user choosen password.Somehow this is returning TRUE but the same changes are not appearing in the database.Please help me solving that.
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Connection con = DriverManager.getConnection("jdbc:oracle:thin:@wdcorcl01dev:1521:USAD", "osis", "iss");
    con = DriverManager.getConnection("jdbc:oracle:thin:@wdcon01dev:1521:USAD", "osis", "iss");
    if (con == null) {
    System.out.println("Connection not found");
    stmt = con.createStatement();
    con.setAutoCommit(false);
    String sql= "update isis_users_login set user_temp_pass='"+null_value+"',user_pass='" + inputPwd + "'where user_id='" inputUserid "'";
    stmt.executeUpdate(sql);
    con.commit();
    returnString= true;
    } catch(SQLException sqlex) {
    sqlex.printStackTrace();
    returnString=false;
    } catch(Exception ex) {
    ex.printStackTrace();
    } finally {
    stmt.close();
    con.close();
    stmt = null;
    rs = null;
    con = null;
    return returnString;

  • [svn] 1190: Clean the flex-sdk-description. xml during the clean stage of the build so the build starts from a "clean" state.

    Revision: 1190
    Author: [email protected]
    Date: 2008-04-11 07:06:59 -0700 (Fri, 11 Apr 2008)
    Log Message:
    Clean the flex-sdk-description.xml during the clean stage of the build so the build starts from a "clean" state.
    -Set the antTasks.compiled property if the flexTasks have already been compiled to avoid having a failure when calling ant main checkintests package
    Modified Paths:
    flex/sdk/branches/3.0.x/build.xml

    Somewhere in your pom.xml where you are configuring your build dependancies there will be a line <scope>caching</scope> this line is configuring the build to use a flex runtime shared library. This line is generating the error because caching is not a valid dependancy scope in maven 3 however mojos uses it anyway. There was a defect opened against flexmojos; I've linked it below. Froeder's response to the issue was that it was not fixable, that the warning is expected and that we'll have to live with it for now.
    https://issues.sonatype.org/browse/FLEXMOJOS-363?page=com.atlassian.jira.plugin.system.iss uetabpanels%3Achangehistory-tabpanel

  • Standard program on good received statement

    Hi all,
    can anyone tell me any standard program on good received statement .

    Hi
    check this code
    report zmmgnrep0001
           line-count 58
           line-size 234
           no standard page heading
           message-id zpp.
    TABLES *********************************
    tables : mseg,
             mkpf,
             bkpf,
             ekbe,
             bseg,
             rseg,
             rbkp.
    DATA DECLARATION ****************************
    *data xekbe like ekbe occurs 0 with header line.
    *data zxekbe like ekbe occurs 0 with header line.
    *data :mirodoc like ekbe-belnr,
         mbudat like ekbe-budat.
    data xekbe like ekbe occurs 0 with header line.
    data zxrbkp like rbkp occurs 0 with header line.
    data zrseg like rseg  occurs 0 with header line.
    data :mirodoc like rseg-belnr,
          mbudat like rbkp-budat.
    data : begin of icheck occurs 0,
             checkdoc like rseg-belnr,
           end of icheck.
    data: begin of itab occurs 0,
            mblnr  like mkpf-mblnr,
            mjahr  like mkpf-mjahr,
            budat  like mkpf-budat,
            bldat  like mkpf-bldat,
            xblnr  like mkpf-xblnr,
            zeile  like mseg-zeile,
            bwart  like mseg-bwart,
            ebeln  like mseg-ebeln,
            ebelp  like mseg-ebelp,
            lifnr  like mseg-lifnr,
            lfbnr  like mseg-lfbnr,
            lfbja  like mseg-lfbja,
            lfpos  like mseg-lfpos,
            belnr  like bkpf-belnr,
            bxblnr like bkpf-xblnr,
            bbudat like bkpf-budat,
            wrbtr  like bseg-wrbtr,
            dmbtr  like bseg-dmbtr,
            kursf  like bkpf-kursf,
            grri   like bseg-hkont,
            accn   like bkpf-belnr,
           mirodoc like ekbe-belnr,
           mbudat  like ekbe-budat,
            mirodoc like rseg-belnr,
            mbudat  like rbkp-budat,
          end of itab.
    data : xmseg like mseg occurs 0 with header line,
           xmkpf like mkpf occurs 0 with header line.
    Modifed  by Raja Robinson,TTIL pune *****************************
    data: counter(10),
          counter1(10),
          flag,
          belnr like bkpf-belnr,
          xblnr like bkpf-xblnr,
          budat like bkpf-budat,
          totlc like bseg-dmbtr,
          totfc like bseg-wrbtr,
          kursf like bkpf-kursf,
          grri like bseg-hkont,
          nilcount(5).
    data: begin of hdg occurs 10,
            f1          type c   value '|',
            line(232),
            f2          type c   value '|',
          end of hdg.
    SELECTION SCREEN ****************************
    selection-screen begin of block input with frame.
    select-options: pos_date for mkpf-budat,
                    mat_no   for mseg-matnr,
                    mv_type  for mseg-bwart,
                    vend_cd  for mseg-lifnr,
                    po_no    for mseg-ebeln,
                    hkont    for bseg-hkont.
    selection-screen end of block input.
    BEGIN OF CODE ******************************
    BEGIN OF MAIN CODE ***************************
    start-of-selection.
      perform initialization.
      perform get_data_for_input.
      perform filter_data.
      perform getmirodata.
      perform format_data.
      perform print_data.
    *&      Form  INITIALIZATION
          text
    -->  p1        text
    <--  p2        text
    form initialization.
    endform.                               " INITIALIZATION
    *&      Form  GET_DATA_FOR_INPUT
          text
    -->  p1        text
    <--  p2        text
    form get_data_for_input.
      select a~mblnr                       " Material Document (GRN No.)
             a~mjahr                       " Material Document Year
             a~budat                       " Material Document Posting Date
             a~bldat                       " Material Document Date
             a~xblnr       " Reference Document (Invoice No.)
             b~zeile                       " Material Document Item No.
             b~bwart       " Movement Type (101 - GR Iss., 102 - GR Reverse)
             b~ebeln                       " Purchase Order
             b~ebelp                       " Purchase Order Line Number
             b~lifnr                       " Vendor Code
             b~lfbnr " Reference Document No(Contains 101 No in case of 102)
             b~lfbja                       " Reference Document Year
             b~lfpos                       " Reference Document Item No.
             into corresponding fields of table itab
             from mkpf as a
             inner join mseg as b
             on  amblnr = bmblnr
             and amjahr = bmjahr
             where a~budat in pos_date
             and   b~bwart in mv_type
             and   b~ebeln in po_no
             and   b~matnr in mat_no
             and   b~lifnr in vend_cd.
      if sy-subrc <> 0.
        message e000(zpp) with 'No Data Found for the Input Criteria.'.
      endif.
    endform.                               " GET_DATA_FOR_INPUT
    *&      Form  GETMIRODATA
    form getmirodata.
    select * from rseg into table zrseg for all entries in itab
                  where  ebeln = itab-ebeln
                     and ebelp = itab-ebelp.
    select * from rbkp into table zxrbkp for all entries in zrseg
                   where  belnr = zrseg-belnr.
    endform.
    *&      Form  FILTER_DATA
          text
    -->  p1        text
    <--  p2        text
    form filter_data.
      sort itab by lifnr mblnr ebeln.
      loop at itab.
        if itab-bwart = '102'.
          delete itab where mblnr = itab-lfbnr
                      and   mjahr = itab-lfbja
                      and   zeile = itab-lfpos.
          delete itab.
        endif.
      endloop.
    endform.                               " FILTER_DATA
    *&      Form  FORMAT_DATA
          text
    -->  p1        text
    <--  p2        text
    form format_data.
      loop at itab.
        clear : ekbe,bkpf.
    *select * from ekbe
                into corresponding fields of table zxekbe
               where ebeln = itab-ebeln   "xmseg-ebeln
               and   ebelp = itab-ebelp   "xmseg-ebelp
               and   bewtp  in ('R', 'Q').
        select * from ekbe
                 into corresponding fields of table xekbe
                where ebeln = itab-ebeln   "xmseg-ebeln
                and   ebelp = itab-ebelp   "xmseg-ebelp
                and   lfbnr = itab-mblnr   "xmseg-mblnr
                and   lfgja = itab-mjahr   "xmseg-mjahr
                and   lfpos = itab-zeile   "xmseg-zeile
                and   bewtp in ('E', 'R').
        if sy-subrc = 0.
          loop at xekbe.
            case xekbe-bewtp.
              when 'E'.
                select single * from bkpf
                               where bukrs = 'GMI'
                              and   belnr like '%'
                              and   gjahr like '%'
                               and   bstat = space
                               and   xblnr = xekbe-xblnr
                               and   blart = 'WE'.
                              and   budat = xekbe-budat
                              and   bldat = xekbe-bldat and  blart = 'WE'.
                itab-wrbtr = xekbe-wrbtr.
                itab-dmbtr = xekbe-dmbtr.
                itab-kursf = bkpf-kursf.
                itab-accn = bkpf-belnr.
              when 'R'.
                select single * from bkpf
                               where bukrs = 'GMI'
                               and   belnr = xekbe-belnr
                               and   gjahr = xekbe-gjahr.
                move bkpf-belnr to itab-belnr.
                move bkpf-xblnr to itab-bxblnr.
                move bkpf-budat to itab-bbudat.
            endcase.
            select single * from bseg where bukrs = bkpf-bukrs and gjahr =
            bkpf-gjahr and belnr = bkpf-belnr and buzid = 'W'.
            itab-grri = bseg-hkont.
            clear bkpf.
          endloop.
        endif.
      read table zrseg with key  ebeln = itab-ebeln
                                 ebelp = itab-ebelp.
               on change of zrseg-belnr.
              if not icheck[] is initial.
              read table icheck with key checkdoc = zrseg-belnr.
                if sy-subrc <> 0.
                icheck-checkdoc = zrseg-belnr.
                 append icheck.
               move zrseg-belnr to itab-mirodoc.
               read table zxrbkp with key belnr = zrseg-belnr.
               if zxrbkp-budat >= itab-budat.
                  move zxrbkp-budat to itab-mbudat.
                endif.
               endif.
             else.
              move zrseg-belnr to itab-mirodoc.
               icheck-checkdoc = zrseg-belnr.
                 append icheck.
                endif.
                read table zxrbkp with key belnr = zrseg-belnr.
               if zxrbkp-budat >= itab-budat.
                  move zxrbkp-budat to itab-mbudat.
                endif.
               endon.
    read table zxekbe with key ebeln = itab-ebeln
                                       ebelp = itab-ebelp.
              move zxekbe-belnr to itab-mirodoc.
              move zxekbe-budat to itab-mbudat.
           clear: zxekbe.
    ********- SZ398R on 22.04.2008
        modify itab.
      endloop.
      sort itab by mblnr.
      counter = 0.
    endform.                               " FORMAT_DATA
    *&      Form  PRINT_DATA
          text
    -->  p1        text
    <--  p2        text
    form print_data.
      if hkont <> ''.
        delete  itab where not  grri in hkont.
      endif.
      loop at itab.
        clear flag.
        mirodoc = itab-mirodoc.
        mbudat  = itab-mbudat.
        on change of itab-mblnr.
          counter = counter + 1.
          write:/0(12)  itab-lifnr,        " to out-line+0(12).
                 13(10) itab-mblnr,        " to out-line+13(10).
                 24(10) itab-budat,        " to out-line+24(10).
                 36(16) itab-xblnr,        " to out-line+36(16).
                 53(10) itab-bldat,        " to out-line+53(10).
                 64(10) itab-ebeln,        " to out-line+64(10),
                 160(12) itab-accn,
                180(15) itab-grri.
          flag = 1.
        endon.
        if belnr = '   '.
          belnr = itab-belnr.
          xblnr = itab-bxblnr.
          budat = itab-bbudat.
          kursf = itab-kursf.
        endif.
        totlc = totlc + itab-dmbtr.
        totfc = totfc + itab-wrbtr.
        counter1 = counter1 + 1.
        at end of mblnr.
          if belnr = '   '.
            belnr = 'Nil'.
            nilcount = nilcount + 1.
          endif.
          write: 75(16)  totlc no-zero,
                 92(16)  totfc no-zero,
                 109(8)  kursf no-zero,
                 118(10) belnr,
                 129(16) xblnr,
                 146(10) budat,
                 198 mirodoc,
                 215 mbudat.
               CLEAR:mirodoc,mbudat  .
          clear: totlc, totfc, belnr, xblnr, budat.
        endat.
      endloop.
      uline.
      write : / counter, 'GRNs Selected'.
    write : / counter1, 'records selected.'.
      write : / nilcount, 'GRNs have no JV attached'.
      write : 69 '***END OF REPORT*****'.
    endform.                               " PRINT_DATA
    TOP OF PAGE *******************************
    top-of-page.
      uline.
      clear hdg-line.
      write : 'General Motors India Confidential' to hdg-line+90.
      write : hdg color col_heading intensified.
      clear hdg-line.
      write : 'Report : ZMM4' to hdg-line+1.
      write : hdg color col_heading intensified.
      clear hdg-line.
      write : 'Date   :' to hdg-line+10.
      write : sy-datum to hdg-line+20.
      write : sy-uzeit to hdg-line+39.
      write : 'Requested By :' to hdg-line+55.
      write : sy-uname to hdg-line+70.
      write : hdg color col_heading intensified.
      clear hdg-line.
      write :  'Goods Receiving Report' to hdg-line+45,
               'Page No.     : '    to hdg-line+75,
               sy-pagno             to hdg-line+91(3).
      write : hdg color col_heading intensified off.
      uline.
      clear hdg-line.
      write :/0(12)   'Vendor',            "          to hdg-line+0,
              13(10)  'GRN No.',           "          to hdg-line+13,
              24(10)  'GRN Date',          "          to hdg-line+24,
              36(16)  'Invoice No.',       "          to hdg-line+36,
              53(10)  'Inv. Dt.',          "          to hdg-line+53,
              64(10)  'PO No.',            "          to hdg-line+64,
              75(16)  'Amount in LC' right-justified, " to hdg-line+153,
              92(16)  'Amount in FC' right-justified, " to hdg-line+179,
              109(8)  'Exchg Rt' right-justified,     " to hdg-line+167,
              118(10) 'JV No.',            "          to hdg-line+193,
              129(16) 'JV.Reference',      "          to hdg-line+204,
              146(10) 'Post.date',         "          to hdg-line+221.
              160     'Account No',
              180     'Acc Post',
             198     'MIRO Document',
             215     'MIRO Post'.
    END OF CODE *******************************
    thanks
    sitaram

  • Stock statement query--- help

    Have any one got the stock statement query report in the folowing format....
    1.ItemCode
    2.Item Description
    3.Item Price
    4.Opening
    5.Receipts
    6.Issues
    7.Closing
    8. Value
    The selection criteria are:
    3.Posting Date
    from wh
    to wh
    help me in making stock statement query
    regards,
    Vignesh

    Hi
    Check This
    select w0.itemcode, i0.docdate, w0.whscode, w0.onhand - isnull (sum (i0.inqty - i0.outqty), 0), 0
    from oitw w0 left outer join oinm i0 on w0.itemcode = i0.itemcode and w0.whscode = i0.warehouse
    where i0.docduedate >= [%0]
    group by w0.itemcode, w0.whscode, w0.onhand, i0.docdate
    having w0.itemcode = [%1] and w0.onhand - isnull (sum (i0.inqty - i0.outqty), 0) >= 0
    union
    select w0.itemcode, i0.docdate, w0.whscode, 0, -(w0.onhand - isnull (sum (i0.inqty - i0.outqty), 0))
    from oitw w0 left outer join oinm i0 on w0.itemcode = i0.itemcode and w0.whscode = i0.warehouse
    where i0.docduedate >= [%0]
    group by w0.itemcode, w0.whscode, w0.onhand, i0.docdate
    having w0.itemcode = [%1] and w0.onhand - isnull (sum (i0.inqty - i0.outqty), 0) < 0
    or
    SELECT T0.ITEMCODE, T0.DSCRIPTION,T0.OPENQTY, T0.OPENVALUE, T0.INQTY, T0.INQTY*T0.PRICE AS 'RCPT VAL', T0.OUTQTY,T0.OUTQTY*T0.PRICE AS 'ISS. VAL', T0.INQTY-T0.OUTQTY AS 'CLOSING STOCK QTY',((T0.INQTY-T0.OUTQTY)*(T0.CALCPRICE)) AS 'CLOSING STOCK VAL' FROM OINM T0 WHERE T0.DOCDATE >=[%0] AND T0.DOCDATE <=[%1]
    Thanks
    Kevin
    Edited by: Kevin Shah on Oct 23, 2010 5:37 PM

  • ANM web services - Get operational state of an SfRserver

    Is there any way to obtain the operational state of a serverfarm realserver via the ANM (4.1) web services API?  The SfRserver data type includes the admin state (i.e. IS, ISS, or OOS) but I dont see a field for the operational state.  The ANM web GUI displays both an admin state and an operational state for a serverfarm realserver -- with the operational state indicating the latest probe status for the real server (e.g. "Up" or "Probe Failed") and I would like to obtain the same information but using the ANM web services interface.

    Hello Andrew,
    The API for ANM is purely for configuration, it does not return anything other than configuration.  The state of "inservice" or "out of service" relates to the command under the rserver:
    rserver host Server05
    ip address 172.16.35.14
    inservice <======= **Here**
    The probe states don't relate to the configuration, so the API doesn't have a plugin to that information.
    However - You could use SNMP seperately to gathter that probe state directly from the ACE and intigrate that into the page you are executing the API for.
    Regards,
    Chris Higgins

  • And/or if statement in rtf templates.

    Hi all,
    I'm using XML Publisher 4.5.
    I have created a word template file (rtf) for my reports. I need to be able to show some content in the template file by using and and/or if statement.
    fx. <?if:doc_type='STANDARD'?> OR <?if:doc_type='DEFAULT'?>
    How can I do this?
    In advance thank you.
    Best regards
    Kenneth

    Hi D,
    Thank you for your answer.
    I have seriously thought about that solution; but I don't think it's a smart way to do it.
    If i do it like that, i need to copy the whole table and paste it inside the if statements.
    I have two xml elements that I need to make the decisions on. POH_PO_TYPE & CP_RELEASE_NUM.
    POH_PO_TYPE can be: STANDARD, RELEASE or BLANKET.
    CP_RELEASE_NUM can be: '' or N
    If POH_PO_TYPE is RELEASE AND CP_RELEASE_NUM is not ''
    OR POH_PO_TYPE is STANDARD
    OR POH_PO_TYPE is BLANKET AND CP_RELEASE_NUM is ''
    THEN show table (which contains the whole PO).
    It shall show the content of the PO in any of these cases.
    BR Kenneth

  • Filename in import statement

    Hi srinivas bobbala,
    Thank you for your response.But I think my quesition was not clear.My ques... is for suppose there is one datafile for importing like.. "datafile_21" Here my intention is it takes file from datafile_21 only but it appears in import statement like datafile_21<<curmon>>.
    import database sample.sample data from data_file "c:\\ABC\datafile_21_AUG.txt" using server rules_file datafile on error abort;
    In this it takes datafile from datafile_21.But it appears like datafile_21_AUG in import statement.This AUG coming from batch file.
    Essmsh c:\\ABC\loadmxl.mxl %curmon%

    No it is not possible.
    I assume the data file "datafile_21" is first renamed to datafile_21_${CurrMth} in the batchscript.
    After that this data file *datafile_21_${CurrMth}* is pointed in the import statement.
    In the logs you will see this file as datafile_21_Aug.

  • Help with if statement in cursor and for loop to get output

    I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
    I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
    Here is my cursor:
    /*Cursor for Email procedure. It is working Shows userid and the string
    You need to update these folders*/
    DECLARE
    a_user varchar2(200) := null;
    v_assigneduser varchar2(20);
    v_folderrsn varchar2(200);
    v_emailaddress varchar2(60);
    v_subject varchar2(200);
    Cursor c IS
    SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
    MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
    trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
    --MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
    FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
    WHERE f.foldertype = 'HJ'
    AND f.statuscode NOT IN (20, 40)
    AND f.folderrsn = fp.folderrsn
    AND fp.processrsn = fpa.processrsn
    AND vu.userid = fp.assigneduser
    AND vu.statuscode = 1
    GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
    ORDER BY fp.assigneduser;
    BEGIN
    FOR c1 IN c LOOP
    IF (c1.assigneduser = v_assigneduser) THEN
    dbms_output.put_line(' ' || c1.folderrsn);
    else
    dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
    END IF;
    a_user := c1.assigneduser;
    v_assigneduser := c1.assigneduser;
    v_folderrsn := c1.folderrsn;
    v_emailaddress := c1.emailaddress;
    v_subject := 'Subject: Project for';
    END LOOP;
    END;
    The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
    emailaddress
    Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
    v_folderrsn
    v_folderrsn
    etc
    [email protected]......
    Subject: 'Project for: ' Jim...'not updated in the last 30 days'
    284087
    292709
    [email protected].....
    Subject: 'Project for: ' Kim...'not updated in the last 30 days'
    185083
    190121
    190132
    190133
    190159
    190237
    284109
    286647
    294631
    322922
    [email protected]....
    Subject: 'Project for: Joe...'not updated in the last 30 days'
    183332
    183336
    [email protected]......
    Subject: 'Project for: Sam...'not updated in the last 30 days'
    183876
    183877
    183879
    183880
    183881
    183882
    183883
    183884
    183886
    183887
    183888
    This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
    Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
    JIM.........      jim@ aol.com.... 284087.............     9/28/2006.......10/5/2006...........690
    JIM.........      jim@ aol.com.... 292709.............     3/20/2007.......3/28/2007............516
    KIM.........      kim@ aol.com.... 185083.............     8/31/2004.......2/9/2006.............     928
    KIM...........kim@ aol.com.... 190121.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190132.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190133.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190159.............     2/13/2006.......2/14/2006............923
    KIM...........kim@ aol.com.... 190237.............     2/23/2006.......2/23/2006............914
    KIM...........kim@ aol.com.... 284109.............     9/28/2006.......9/28/2006............697
    KIM...........kim@ aol.com.... 286647.............     11/7/2006.......12/5/2006............629
    KIM...........kim@ aol.com.... 294631.............     4/2/2007.........3/4/2008.............174
    KIM...........kim@ aol.com.... 322922.............     7/29/2008.......7/29/2008............27
    JOE...........joe@ aol.com.... 183332.............     1/28/2004.......4/23/2004............1585
    JOE...........joe@ aol.com.... 183336.............     1/28/2004.......3/9/2004.............1630
    SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............     1631
    PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............     48
    PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
    NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
    NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
    NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
    NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
    NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
    NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
    NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
    NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
    NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............     175
    NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
    NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
    NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
    NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
    NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
    NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
    MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
    [email protected]/27/2004.......3/8/2004............1631
    How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
    Edited by: user4653174 on Aug 25, 2008 2:40 PM

    analytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
    CASE
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
    Incorporating either of these into your query should assist you in returning the desired results.

  • When would I use an if, for or while statement in Small Basic and what is the difference between the three?

    I have a Y9 Computer Science Exam next week and I know that this will probably be one of the questions on it so I need to know the answer. What is the difference?

    An If statement executes once IF the statement is true:
    If 1 = 2/2 Then
    Textwindow.writeline("True")
    EndIf
    A While statement executes WHILE the statement is true:
    While 4 = 2+2
    'Will keep looping while it is true
    EndWhile
    A For statement loops a number in increment:
    For i = 1 to 10
    'Every time through, i gets bigger by one until it equals 10
    EndFor
    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

  • If statement in sql

    regarding the following sql:
    SELECT a.lname, a.fname, a.user_id, c.address, c.city,
    c.zip, c.addresstypeid, d.descriptor as state
    FROM users a, address c, maintstatetype d
    WHERE a.user_id = c.user_id(+)
    AND c.statetypeid = d.statetypeid(+)
    AND c.addresstypeid in (1,2,3,4)
    I have a database of users and addresses. Each user can
    have multiple addresses and the addresses are
    designated by addresstypeid. In plain english, what I want
    to pull is "If they have an addresstypeid of 1, pull that one
    only, if not, check if they have a 2 and use that, if not, check
    for a 3, etc..".
    Any help with this?

    What you want, then, is to pull the address with the minimum addresstypeid ..
    SELECT a.lname, a.fname, a.user_id, c.address, c.city,
    c.zip, c.addresstypeid, d.descriptor as state
    FROM users a, address c, maintstatetype d
    WHERE a.user_id = c.user_id(+)
    AND c.statetypeid = d.statetypeid(+)
    AND c.addresstypeid =
    (select min(c2.addresstypeid)
    from address c2
    where c2.userid=a.userid
    I'm not sure what this will do to your outerjoin, though. You might have to get funky with a union ...
    SELECT a.lname, a.fname, a.user_id, c.address, c.city,
    c.zip, c.addresstypeid, d.descriptor as state
    FROM users a, address c, maintstatetype d
    WHERE a.user_id = c.user_id
    AND c.statetypeid = d.statetypeid
    AND c.addresstypeid =
    (select min(c2.addresstypeid)
    from address c2
    where c2.userid=a.userid
    Union all
    SELECT a.lname, a.fname, a.user_id, to_char(null), to_char(null),
    to_char(null), to_char(null), to_char(null)
    FROM users a
    WHERE not exists
    (select 1
    from address c
    where c.userid=a.userid
    )

  • 'IF' statement in a select statment?

    I have the following cursor in a package specification;
    cursor c_sales_code is
    select sales_condition||' MC '||sales_option
    from sales;This will return something like: 'T300 MC 9'
    MC means 'multiple choice' for when there are multiple options. Although, sales_option is sometimes null and in this case I just want 'T300' to be returned, not 'T300 MC'.
    How would I go about doing this?
    Thanks,
    fakelvis

    Use
    CASE and DECODE
    to add the functoinality of Conditional Statements in Your SQL Statements..
    These two CASE / DECODE will help you to get your desired output

  • IF Statement in Select

    I need to choose between value1 and value2 within a select statement.
    TableA
    Flag (char)
    Value1
    Value2
    ItemDesc
    pseudo code
    select ItemDesc, (if Flag = 'y' then Value1 else Value2) as Price from TableA;
    How can this be done?

    select   itemdesc,
             sum (case
                     when flag = 'y'
                        then (case
                                 when value1 < 10
                                    then value1 * 1.2
                                 else value1
                              end)
                     else value2
                  end
                 ) as price
        from tablea
    group by itemdesc;

  • If statement in select statement alias

    I have the following select statement. It has the alias Survivors, Deaths and "All Cases". Is it posible to use :P_LANGUAGE variable to say that -- IF :P_LANGUAGE = FRENCH THEN alias are Survivants for survivors, Décès for Deaths, Tous_les_cas for All Cases. Please advise
    SELECT ALL T_NTR_MULTIBAR.CAT, T_NTR_MULTIBAR.NUM_CASES_LEFTBAR AS Survivors,
    T_NTR_MULTIBAR.NUM_CASES_MIDDLEBAR AS Deaths, T_NTR_MULTIBAR.NUM_CASES_RIGHTBAR AS "All Cases"
    FROM T_NTR_MULTIBAR
    WHERE INSTANCE_NUM = :P_INSTANCENUM
    order by ORDERS

    You may not be able to add this condition inside the SQL Statement. But you can add this condition outside the statement, if you're using PL/SQL...
    IF :p_language = french THEN
    SELECT ALL t_ntr_multibar.cat,
      t_ntr_multibar.num_cases_leftbar AS survivors,
      t_ntr_multibar.num_cases_middlebar AS deaths,
      t_ntr_multibar.num_cases_rightbar AS "All Cases"
    ELSE
    END IF;

Maybe you are looking for

  • How to synchronize PI service registry and IBM WSRR

    Hello All, In our current project we have developed one web service which resides in SAP CE and is registered in SAP PI Service Registry. But our client has IBM websphere that acts as a middleware for all ther services (interfaces/web services) Now,

  • Disable tablet pen pressure for eraser tool in PSE 10?

    Hi, I recently bought PSE 10. I have an Intuos 3 Wacom tablet and whenever I switch to the Eraser tool, in the brush preview icon (top left corner) I see this ~ type of a shape with narrow-pointy edges, indicating that the size-pen-pressure feature i

  • Remove "click to play"

    I used the "Export for Web" function in QuickTime Pro to post a movie to a website. How can I remove the 'click to play' icon? Even if I remove all the text from 'click to play' I still have a gray circle in the middle of the movie. Just looking for

  • Deleting original apps

    I just received a new iPod Touch. It came with the Stocks app and a few others I'm not really into. How do I delete an app that is already on my iPod? There is no delete circle like there is on apps I have added myself. Thanks!!

  • I can't install any apps on my iPad.

    I don't think it's an Internet problem as I can still use Safari and the Store, but when I attempt to install any apps, it starts to download then when the blue bar is almost full it starts again and it's so annoying because it just does it over and