How to use variant for diffrent output?

Hi,
I have created one report with ALV_grid_display.
when i execute this report it would show output with less detail.
I have a one checkbox at selection-screen also. My requirement is when i select this checkbox then report should show output with more detail i.e different output.
I have heared we can create variant for this.
Pls tell me how can i do this.
Correct answear will be rewarded by maximum points.
Thanks & Regards,
Gaurav.

Hi Gaurav,
leave ur id i will send u the screen shot how to create the variant after getting the output list.
This is the sample programe
just go through the bold one in the coding and do modifications in ur programe,
REPORT ZVRI4E04 LINE-SIZE 250 NO STANDARD PAGE HEADING
                                              MESSAGE-ID MSG.
TYPE-POOLS : SLIS.
                       TABLES DECLARATION                            *
TABLES: VBRK, VBRP, VBKD, KONV, KNA1.
                       V A R I A B L E S                             *
DATA : W_FIELD TYPE SLIS_FIELDCAT_ALV.
DATA : F_FIELD TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA : V_POS TYPE I,
       LS_SORT TYPE SLIS_T_SORTINFO_ALV,
       W_SORT TYPE SLIS_SORTINFO_ALV.
<b>DATA : IS_VARIANT LIKE DISVARIANT.</b>
<b>IS_VARIANT-REPORT = SY-CPROG.</b>
DATA : BEGIN OF T_VBRK OCCURS 0,
       VBELN LIKE VBRK-VBELN,
       FKDAT LIKE VBRK-FKDAT,
       KNUMV LIKE VBRK-KNUMV,
       KUNAG LIKE VBRK-KUNAG,
       VKORG LIKE VBRK-VKORG,
       VTWEG LIKE VBRK-VTWEG,
       SPART LIKE VBRK-SPART,
      END OF T_VBRK.
DATA : BEGIN OF T_VBRP OCCURS 0,
       VBELN LIKE VBRP-VBELN,
       POSNR LIKE VBRP-POSNR,
       FKIMG LIKE VBRP-FKIMG,
       NTGEW LIKE VBRP-NTGEW,
       BRGEW LIKE VBRP-BRGEW,
       VOLUM LIKE VBRP-VOLUM,
       AUBEL LIKE VBRP-AUBEL,
      END OF T_VBRP.
DATA : BEGIN OF T_VBKD OCCURS 0,
       VBELN LIKE VBKD-VBELN,
       BSTKD LIKE VBKD-BSTKD,
      END OF T_VBKD.
DATA : BEGIN OF T_KONV OCCURS 0,
       KNUMV LIKE KONV-KNUMV,
       KPOSN LIKE KONV-KPOSN,
       STUNR LIKE KONV-STUNR,
       KSCHL LIKE KONV-KSCHL,
       KBETR LIKE KONV-KBETR,
       KWERT LIKE KONV-KWERT,
      END OF T_KONV.
DATA : BEGIN OF T_KNA1 OCCURS 0,
       KUNNR LIKE KNA1-KUNNR,
       NAME1 LIKE KNA1-NAME1,
      END OF T_KNA1.
DATA : BEGIN OF T_FINAL OCCURS 0,
       VKORG LIKE VBRK-VKORG,
       VTWEG LIKE VBRK-VTWEG,
       SPART LIKE VBRK-SPART,
       FKDAT LIKE VBRK-FKDAT,
       VBELN LIKE VBRK-VBELN,
       POSNR LIKE VBRP-POSNR,
       NAME1 LIKE KNA1-NAME1,
       BSTKD LIKE VBKD-BSTKD,
       FKIMG LIKE VBRP-FKIMG,
       NTGEW LIKE VBRP-NTGEW,
       BRGEW LIKE VBRP-BRGEW,
       VOLUM LIKE VBRP-VOLUM,
       BASIC LIKE KONV-KWERT,
       EXDUTY LIKE KONV-KWERT,
       ED LIKE KONV-KWERT,
       CST LIKE KONV-KWERT,
       VAT LIKE KONV-KWERT,
       SALTAX LIKE KONV-KWERT,
       FREIGHT LIKE KONV-KWERT,
       TCS LIKE KONV-KWERT,
       SRG LIKE KONV-KWERT,
       RATE LIKE KONV-KBETR,
      END OF T_FINAL.
                    S E L E C T I O N - S C R E E N                  *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS: S_KUNAG FOR T_VBRK-KUNAG,
                S_FKDAT FOR T_VBRK-FKDAT,
                S_VKORG FOR T_VBRK-VKORG,
                S_VTWEG FOR T_VBRK-VTWEG,
                S_SPART FOR T_VBRK-SPART.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN .
  SELECT SINGLE KUNAG FKDAT VKORG VTWEG SPART FROM VBRK INTO T_VBRK
                                        WHERE KUNAG IN S_KUNAG
                                          AND FKDAT IN S_FKDAT
                                          AND VKORG IN S_VKORG
                                          AND VTWEG IN S_VTWEG
                                          AND SPART IN S_SPART.
  IF SY-SUBRC <> 0.
    MESSAGE E000 WITH 'THERE IS NO RECORDS FOR THIS SELECTION CRITERIA'.
  ENDIF.
START-OF-SELECTION.
  SELECT VBELN FKDAT KNUMV KUNAG VKORG VTWEG SPART
                  FROM VBRK INTO TABLE T_VBRK
                  WHERE KUNAG IN S_KUNAG
                  AND FKDAT IN S_FKDAT
                  AND VKORG IN S_VKORG
                  AND VTWEG IN S_VTWEG
                  AND SPART IN S_SPART.
  IF NOT T_VBRK[] IS INITIAL.
    SELECT VBELN POSNR FKIMG NTGEW BRGEW VOLUM AUBEL
                                  FROM VBRP INTO TABLE T_VBRP
                                  FOR ALL ENTRIES IN T_VBRK
                                  WHERE VBELN = T_VBRK-VBELN.
  ENDIF.
  IF NOT T_VBRP[] IS INITIAL .
    SELECT VBELN BSTKD FROM VBKD
                      INTO TABLE T_VBKD
                      FOR ALL ENTRIES IN T_VBRP
                      WHERE VBELN = T_VBRP-AUBEL.
  ENDIF.
  IF NOT T_VBRK[] IS INITIAL.
    SELECT KNUMV KPOSN STUNR KSCHL KBETR KWERT
                                          FROM KONV
                                          INTO TABLE T_KONV
                                          FOR ALL ENTRIES IN T_VBRK
                                          WHERE KNUMV = T_VBRK-KNUMV.
  ENDIF.
  IF NOT T_VBRK[] IS INITIAL.
    SELECT KUNNR NAME1 FROM KNA1 INTO TABLE T_KNA1
                                      FOR ALL ENTRIES IN T_VBRK
                                      WHERE KUNNR = T_VBRK-KUNAG.
  ENDIF.
                    Populating the final data                        *
  LOOP AT T_VBRP.
    READ TABLE T_VBRK WITH KEY VBELN = T_VBRP-VBELN.
    READ TABLE T_VBKD WITH KEY VBELN = T_VBRP-AUBEL.
    READ TABLE T_KNA1 WITH KEY KUNNR = T_VBRK-KUNAG.
    T_FINAL-VKORG = T_VBRK-VKORG.
    T_FINAL-VTWEG = T_VBRK-VTWEG.
    T_FINAL-SPART = T_VBRK-SPART.
    T_FINAL-FKDAT = T_VBRK-FKDAT.
    T_FINAL-VBELN = T_VBRK-VBELN.
    T_FINAL-POSNR = T_VBRP-POSNR.
    T_FINAL-NAME1 = T_KNA1-NAME1.
    T_FINAL-BSTKD = T_VBKD-BSTKD.
    T_FINAL-FKIMG = T_VBRP-FKIMG.
    T_FINAL-NTGEW = T_VBRP-NTGEW.
    T_FINAL-BRGEW = T_VBRP-BRGEW.
    T_FINAL-VOLUM = T_VBRP-VOLUM.
    LOOP AT T_KONV WHERE KNUMV = T_VBRK-KNUMV AND
    KPOSN = T_VBRP-POSNR.
      IF T_KONV-KSCHL = 'ZIBP' OR T_KONV-KSCHL = 'ZIPR'.
        T_FINAL-BASIC = T_FINAL-BASIC + T_KONV-KWERT.
        IF NOT T_KONV-KBETR IS INITIAL.
          T_FINAL-RATE =  T_KONV-KBETR.
        ENDIF.
      ENDIF.
      IF T_KONV-KSCHL = 'ZIED'.
        T_FINAL-EXDUTY = T_FINAL-EXDUTY + T_KONV-KWERT.
      ENDIF.
      IF T_KONV-KSCHL = 'ZIEC'.
        T_FINAL-ED = T_FINAL-ED + T_KONV-KWERT.
      ENDIF.
      IF T_KONV-KSCHL = 'ZIVA'.
        T_FINAL-SALTAX = T_FINAL-SALTAX + T_KONV-KWERT.
      ENDIF.
      IF T_KONV-KSCHL = 'ZIFD' OR T_KONV-KSCHL = 'ZID0'.
        T_FINAL-FREIGHT = T_FINAL-FREIGHT + T_KONV-KWERT.
      ENDIF.
      IF T_KONV-KSCHL = 'ZITC'.
        T_FINAL-TCS = T_FINAL-TCS + T_KONV-KWERT.
      ENDIF.
      IF T_KONV-KSCHL = 'ZITS'.
        T_FINAL-SRG = T_FINAL-SRG + T_KONV-KWERT.
      ENDIF.
      IF T_KONV-KSCHL = 'ZICS'.
        T_FINAL-CST = T_FINAL-CST + T_KONV-KWERT.
      ENDIF.
      IF T_KONV-KSCHL = 'ZIVA'.
        T_FINAL-VAT = T_FINAL-VAT + T_KONV-KWERT.
      ENDIF.
    ENDLOOP.
    APPEND T_FINAL.
    CLEAR T_FINAL.
    CLEAR T_KONV.
    CLEAR : T_VBRK, T_VBRP, T_VBKD, T_KNA1.
  ENDLOOP.
                    POSITION DECLARATION FOR ALV OUTPUT              *
  V_POS = 0.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'VKORG' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'SORG'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'VTWEG' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'DCHL'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'SPART' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'DVS'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'FKDAT' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'Date'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'VBELN' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'Inv No'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'POSNR' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'Item No'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'NAME1' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'Name'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'BSTKD' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-SELTEXT_M = 'PO No'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'FKIMG' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'Quantity'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'NTGEW' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'NT WG'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'BRGEW' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'GR WG'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'VOLUM' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'Volume'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'RATE'.
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'Rate'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'BASIC'.
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'BASIC'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'EXDUTY'.
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'EX Duty'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'ED' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'EDUCATION'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'SALTAX'.
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'SALTAX'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'CST'.
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'CST'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'VAT'.
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'VAT'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'FREIGHT' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'FREIGHT'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'TCS' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'TCS'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  V_POS = V_POS + 1.
  W_FIELD-COL_POS = V_POS.
  W_FIELD-FIELDNAME = 'SRG' .
  W_FIELD-TABNAME = 'T_FINAL'.
  W_FIELD-DO_SUM = 'X'.
  W_FIELD-SELTEXT_M = 'SRG'.
  APPEND W_FIELD TO F_FIELD.
  CLEAR W_FIELD.
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         <b>   I_CALLBACK_PROGRAM = SY-CPROG</b>
           I_STRUCTURE_NAME
            IS_LAYOUT     = WA_LAYOUT
            IT_FIELDCAT   = F_FIELD
      <b>      IS_VARIANT = IS_VARIANT</b>
          <b>  I_SAVE = 'X'</b>
           IT_SORT       = LS_SORT
       TABLES
            T_OUTTAB      = T_FINAL
       EXCEPTIONS
            PROGRAM_ERROR = 1
            OTHERS        = 2.
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
Reward points if helpful
Thanks
Message was edited by:
        Pattan Naveen

Similar Messages

  • How to create variant for table/view ?

    Hi,
    When I go through SM30, I find a radio button called variant. I don't know the effect.
    Can anyone tell me how to create variant for table / view ?
    I want to know when we need to create variant for table/view.
    Best regards,
    Chris Gu

    hi ,
    Whenever you start a program in which selection screens are defined, the system displays a set of input fields for database-specific and program-specific selections. To select a certain set of data, you enter an appropriate range of values.
    For further information about selection screens, refer to Selection Screens in the ABAP User's Guide.
    If you often run the same program with the same set of selections (for example, to create a monthly statistical report), you can save the values in a selection set called a variant
    Procedure
    To create a new variant:
           1.      On the ABAP Editor initial screen, enter the name of the program for which you want to create a variant, select Variants, and choose Change.
           2.      On the variant maintenance initial screen, enter the name of the variant to be created.
    Note the naming convention for variants (see below).
           3.      Choose Create.
    If the program has more than one selection screen, a dialog box for screen assignment appears. The dialog box does not appear if the program only has one selection screen. The selection screen appears in this case.
           4.      If there is more than one selection screen, select the screens for which you want to create the variant
    5.      Choose Continue.
    The (first) selection screen for the report appears.
    If your program has more than one selection screen, use the scroll buttons in the left-hand corner of the application toolbar to navigate between them and to fill the fields with values. If you keep scrolling forwards, the Continue button appears on the last selection screen.
           6.      Enter the desired selection values, including multiple selection and dynamic selection.
           7.      Choose Continue.

  • How to use parathesis for OR and AND OPERATOR...

    oracle 10g
    Hi
    Guys please help how to use parathesis for this below query its giving same output values for all my similar queries
    select count(balance) from balanace_tb
    where kk_code in(111,112,113)
    or
    kk_code in(111,1124,115,116) and sec_id in(50,51,52,53)
    or
    kk_code in(100,164,215,161) and sec_id in(53,51,52,59)
    or
    kk_code not in(100,164,215,162,134) and sec_id in(53,51,52,59)
    or
    kk_code in(100,164,215,16) and sec_id in(53,51,52,59)
    and
    open_date=20130331

    I assume you're looking for something like this?
    select count(balance) from balanace_tb
    where (   kk_code in(111,112,113)
           or (kk_code in(111,1124,115,116) and sec_id in(50,51,52,53))
           or (kk_code in(100,164,215,161) and sec_id in(53,51,52,59))
           or (kk_code not in(100,164,215,162,134) and sec_id in(53,51,52,59))
           or (kk_code in(100,164,215,16) and sec_id in(53,51,52,59))
    and open_date=20130331
    If not, please post some example data, the expected output from that data, and the logic you are expecting to use, as well as posting your database version.
    Re: 2. How do I ask a question on the forums?

  • Use soundcard for analog output

    Is it possible to use soundcard for analog output with LabView6?

    nicke wrote:
    > Is it possible to use soundcard for analog output with LabView6?
    Have a look in the examples under Hardware Input and Output|Sound (LV6.1)
    Dunno where it is under 6i, but the files are there.
    Impressed the crap out of some Fortran hackers by showing them how
    easy I could turn my laptop into a spectrum analyser.
    Remove "spamkill." when replying to this message

  • How to Use 'uid' for AD Users Without Domain Name For User Log in OAM

    How to Use 'uid' for synchronized Active Directory (AD) Users into Oracle Internet Directory (OID) Without Domain Name For User Logins in OIDDAS and OAM
    We successfully integrated OAM 11g with EBS R12.1.3 Now all the AD user id's stored in fnd_users table as [email protected]
    How can we remove @abc.com
    We are using OID 11g and OAM 11g
    Found the similar note for OID 10G: How to Use 'uid' for AD Users Without Domain Name For User Logins in OIDDAS and SSO [ID 580480.1]
    We are in OID 11g.
    Any help on this greatly appreciated.

    I couldn't find any reference that could be helpful -- Please log a SR and see if this is supported and if the steps are available.
    Thanks,
    Hussein

  • How to use webcam for Yahoo Messenger on MacBook Pro, How to use webcam for Yahoo Messenger on MacBook Pro

    How to use webcam for Yahoo Messenger on MacBook Pro, How to use webcam for Yahoo Messenger on MacBook Pro because it's not working =(

    The cheap & easy way is to just drag the app to the Trash.
    If you want to get all of the associated files use an app deleting app like the free AppCleaner;
    http://www.freemacsoft.net/appcleaner/
    Just drag an app and drop it on the AppCleaner icon in the Dock and it will find and present to you all the files it thinks are associated with the app. You can uncheck any that you want to keep and then let AppCleaner Trash the rest.

  • How to use i for if condition in a for i in loop?

    Hi friends,
    I have a question on how to use i for IF condition in a loop, in order to get an efficient programming and results. Here is outlined SQL:
    cursor is
    select c1,c2,c3 from table1; -- 100 rows returned.
    open cursor
    loop
    fetch c1,c2,c3 into v1,v2,v3;
    for i in 1..3 loop
    if 'v'||i between 90 and 100 then
    v_grade := 'Excellent';
    elsif 'v'||i between 80 and 89 then
    elsif 'v'||i between 50 and 59 then
    end if;
    end loop;
    close cursor;
    This way, I don't need to use a lot of if..then for hard code v1,v2,v3,.... actually I have more v..
    But Oracle gave an error of this usage of 'if 'v'||i' or 'v'||to_char(i).
    Thanks for any advice in advance!

    user508774 wrote:
    Thanks for comments and advices. But I didn't get your inputs clearly. Are you saying I don't need to use PL/SQL to achieve this?Correct. Ronel and John showed you the basic approaches. SQL is not a mere I/O language for making read and write calls. It is a very capable, flexible and powerful language. One can solve a problem with a few lines of SQL code, that will take 100's of lines of PL/SQL or Java code.
    So do not underestimate what can be done in SQL.
    v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
    EXECUTE IMMEDIATE v_cmd;This code is also wrong. Besides the fact that there is no need for dynamic SQL, this approach creates a brand new SQL statement each loop iteration.
    SQL is source code. It needs to be parsed (compiled). The end result is an executable program that is called a cursor. This cursor needs to be stored in server memory (the SQL Shared Pool in the SGA).
    The problem with your code is that it is slow and expensive - it generates lots of unique SQL statements that need CPU for parsing and server memory for storage.
    These add up to a very significant performance overhead. That is the wrong approach. The correct approach is the same one that you would use in any other programming language.
    Let's say you need to use Java to process a bunch of CSV files - exact same CSV layout used by each file. A file needs to be read, processed, and a log file created.
    Will you write a Java program that loops through the files, for each file found, write a Java program for processing that file, compile it, then execute it?
    Or would you write a Java program that takes the name of the file as input, and then process that file and writes the log file?
    The 2nd approach provides a program that can process any of those CSV files - one simply needs to pass the filename as an input parameter.
    Your code and approach use the 1st method. Not the 2nd. And that is why it is wrong.
    To create a SQL program with parameters is done by using bind variables. Instead of
    v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
    The following SQL source code should be created:
    v_cmd := 'UPDATE parts_categ_counts SET w1=:v1, w2=:v2 ..., w9=:v9 WHERE seq= :vseq';
    The tokens with the colon prefix (such as :v1), are bind variables. Think of these as the parameters to the SQL cursor.
    The server parses this SQL into a cursor. You can now execute the same cursor over and over again, using different bind variables. (just like the 2nd approach above that one would use in Java)
    In PL/SQL, this is made even easier as you can code native SQL code with PL/SQL code and use PL/SQL variables in it. The PL/SQL compiler is clever enough to do the SQL parsing, variable binding, and cursor execution for you. So in PL/SQL, you would use:
    UPDATE parts_categ_counts SET w1=v1, w2=v2 ..., w9=v9 WHERE seq= vseq;
    Where v1 and the others are PL/SQL variables.
    That all said - PL/SQL is only used for data crunching, when the processing of data is too complex for the SQL language to deal with. And this is very seldom the case.
    The main reason for using PL/SQL it to provide processing flow control, conditional processing and error handling, for SQL code. As the SQL language does not have these features.

  • HOW TO Create  variants for transaction MASS on LFA1 object?

    hOW TO Create  variants for transaction MASS on LFA1 object?
    Edited by: cheppalliakr on Nov 10, 2011 1:09 PM
    Moderator message: please do more research before asking, show what you have done yourself and provide more information when asking.
    Edited by: Thomas Zloch on Nov 10, 2011 3:10 PM

    Hi Oscar ,
    You need to create optional date prompt variable  in BW which fills your requirement .
    Ex : If you require report should always run for 1st of the month to last of month .Then create Optional date variable in BW with interval .write customer exit ,
    if from date is left blank it should take 1st of the month and if todate is left blank it should take last of the month .
    when creating webi schedules , leave prompts as blank.

  • Install Sun ONE Directory Server 5,2 & how to use it for authenticate user

    Good afternoon, Excuse, are newbie in the scope I am learning and putting desire to him, this in my situation I am trying to install Sun ONE Directory Server 5,2 since I understand that this it is application LDAP for Solaris, ok I want to install it to authenticate user against the system, that is to say, to be able to acces the server entering with a created user from the data base of LDAP and make think user that his created in the system. But the documentation that I finds indicates the installation of Sun ONE Directory Server 5,2 but it not clearly about how to use it for authentication. Some one have any manual step by step of Sun ONE Directory Server 5,2 installation and how to make it for authentication systems users.
    I read the forum seeking for anwser and i get confuse
    Thanks for the help and sorry for any inconvenient
    Message was edited by:
    Aku_28
    Message was edited by:
    Aku_28

    I think that I found the Sun endorsed book locations for using LDAP accounts that don't use authentication besides "crypt". I now can use an account with a "ssha" password. It can be more than 8 characters long.
    Chapter 14 System Administration Guide: Naming and Directory Services
    Read page 201 which is the pam.conf file pam_ldap setups. I edited my "/etc/pam.conf" file to reflect this
    Chapter 7 Directory Server 5.2 2005Q4 - Administration Guide
    Read page 316-318 which has a graphical technique to specify password syntax. I set it up and then tried the password by running "su - brahms". It now requires a longer password than 8 characters and it is set up to use "ssha" for that UID entry "brahms".

  • How to Use BAPI_OUTB_DELIVERY_CHANGE for Batch Split

    Hi Experts, I have the follow delivery:
    Item        Material   Deliv.Qty    Un
    10     739911     2     PQT
    And I want to obtain this:
    Item        Material   Deliv.Qty    Un                            Batch
    10     739911     0     PQT
    900001     739911     1     PQT          ZZ00060
    900002     739911     1     PQT          ZZ00061
    But, after using the Bapi I obtained this:
    Item        Material   Deliv.Qty    Un                            Batch
    10     739911     1,372     PQT
    900001     739911     0,314     PQT          ZZ00060
    900002     739911     0,314     PQT          ZZ00061
    So as you can see the problem is with the "Deliv.Qty". I expected:
    Item        Deliv.Qty
    10            0
    900001     1     
    900002     1     
    But I obtained:
    Item        Deliv.Qty
    10     1,372
    900001     0,314
    900002     0,314
    The parameters that I am using in the Bapi are:
    HEADER_DATA                                   
    DELIV_NUMB = 801174646
    HEADER_CONTROL                                
    DELIV_NUMB = 801174646
    DELIVERY = 801174646
    TECHN_CONTROL
    UPD_IND = U
    ITEM_DATA (three records):   
    DELIV_NUMB = 801174646
    DELIV_ITEM = 000010  
    MATERIAL = 739911  
    FACT_UNIT_NOM = 1   
    FACT_UNIT_DENOM = 1   
    DELIV_NUMB = 801174646  
    DELIV_ITEM = 900001     
    MATERIAL = 739911     
    BATCH = ZZ00060    
    HIERARITEM = 000010     
    USEHIERITM = 1          
    DLV_QTY = 1
    DLV_QTY_IMUNIT = 1
    FACT_UNIT_NOM = 1      
    FACT_UNIT_DENOM = 1      
    DELIV_NUMB = 801174646  
    DELIV_ITEM = 900002     
    MATERIAL = 739911     
    BATCH = ZZ00061    
    HIERARITEM = 000010     
    USEHIERITM = 1          
    DLV_QTY = 1
    DLV_QTY_IMUNIT = 1
    FACT_UNIT_NOM = 1      
    FACT_UNIT_DENOM = 1
    ITEM_CONTROL (three records):
    DELIV_NUMB = 801174646
    DELIV_ITEM = 000010  
    CHG_DELQTY = X
    DELIV_NUMB = 801174646
    DELIV_ITEM = 900001  
    CHG_DELQTY = X
    DELIV_NUMB = 801174646
    DELIV_ITEM = 900002  
    CHG_DELQTY = X
    So I am missing something but I don't know what.
    Can any one help me with this please?
    PD: I have looked the following forums in order to use the Bapi:
    How to Use BAPI_OUTB_DELIVERY_CHANGE for Batch Split
    batch split using BAPI_OUTB_DELIVERY_CHANGE
    Re: Help in BAPI_OUTB_DELIVERY_CHANGE(batch-split)
    BAPI_OUTB_DELIVERY_CHANGE - Batch Splits don't work
    Help for BAPI_OUTB_DELIVERY_CHANGE

    Hey,
    My code is for the inbound delivery but it should work the same.
    Give this a try.
    REPORT  z_delivery_batch_split.
    DATA:header_data  LIKE  bapiibdlvhdrchg,
    header_control  LIKE  bapiibdlvhdrctrlchg,
    delivery  LIKE  bapiibdlvhdrchg-deliv_numb,
    ls_return LIKE bapiret2,
    item_data  TYPE TABLE OF  bapiibdlvitemchg,
    item_control  TYPE TABLE OF bapiibdlvitemctrlchg,
    ls_item_data  LIKE  bapiibdlvitemchg,
    ls_item_control LIKE  bapiibdlvitemctrlchg,
    return TYPE TABLE OF bapiret2 WITH NON-UNIQUE KEY type.
    header_data-deliv_numb = '1800005005'.
    header_control-deliv_numb = '1800005005'.
    delivery = '1800005005'.
    ls_item_data-deliv_numb = '1800005005'.
    ls_item_data-deliv_item = '900001'.
    ls_item_data-material = '000000000020067722'.
    PERFORM create_batch CHANGING ls_item_data-batch.
    ls_item_data-hieraritem = '000010'.
    ls_item_data-usehieritm = '1'.
    ls_item_data-dlv_qty = 80.
    ls_item_data-dlv_qty_imunit = 80.
    ls_item_data-fact_unit_nom = '1'.
    ls_item_data-fact_unit_denom = '1'.
    ls_item_data-sales_unit = 'EA'.
    ls_item_data-base_uom = 'EA'.
    APPEND ls_item_data TO item_data.
    ls_item_data-deliv_numb = '1800005005'.
    ls_item_data-deliv_item = '900002'.
    ls_item_data-material = '000000000020067722'.
    PERFORM create_batch CHANGING ls_item_data-batch.
    ls_item_data-hieraritem = '000010'.
    ls_item_data-usehieritm = '1'.
    ls_item_data-dlv_qty = 60.
    ls_item_data-dlv_qty_imunit = 60.
    ls_item_data-fact_unit_nom = '1'.
    ls_item_data-fact_unit_denom = '1'.
    ls_item_data-sales_unit = 'EA'.
    ls_item_data-base_uom = 'EA'.
    APPEND ls_item_data TO item_data.
    ls_item_control-deliv_numb = '1800005005'.
    ls_item_control-deliv_item = '900001'.
    ls_item_control-chg_delqty = 'X'.
    APPEND ls_item_control TO item_control.
    ls_item_control-deliv_numb = '1800005005'.
    ls_item_control-deliv_item = '900002'.
    ls_item_control-chg_delqty = 'X'.
    APPEND ls_item_control TO item_control.
    break cgavin.
    CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'
       EXPORTING
         header_data          = header_data
         header_control       = header_control
         delivery             = delivery
    *   TECHN_CONTROL        = TECHN_CONTROL
       TABLES
    *   HEADER_PARTNER       = HEADER_PARTNER
    *   HEADER_PARTNER_ADDR  = HEADER_PARTNER_ADDR
    *   HEADER_DEADLINES     = HEADER_DEADLINES
         item_data            = item_data
         item_control         = item_control
    *   ITEM_SERIAL_NO       = ITEM_SERIAL_NO
    *   EXTENSION1           = EXTENSION1
    *   EXTENSION2           = EXTENSION2
         return               = return
    *   TOKENREFERENCE       = TOKENREFERENCE
    *   HANDLING_UNIT_HEADER = HANDLING_UNIT_HEADER
    *   HANDLING_UNIT_ITEM   = HANDLING_UNIT_ITEM
    *   PARTIAL_GR_OBJECTS   =          PARTIAL_GR_OBJECTS
    READ TABLE return
    INTO ls_return
    WITH TABLE KEY type = 'E'.
    IF sy-subrc = 0.
       MESSAGE ID ls_return-id TYPE ls_return-type NUMBER ls_return-number WITH ls_return-message_v1 ls_return-message_v2
       ls_return-message_v3 ls_return-message_v4.
    ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait          = 'X'.
    break cgavin.
    *&      Form  CREATE_BATCH
    *       text
    *      <--P_LS_ITEM_DATA_BATCH  text
    FORM create_batch  CHANGING p_ls_item_data_batch.
       DATA: ls_bncom TYPE bncom.
       ls_bncom-matnr = ls_item_data-material.
       ls_bncom-werks = 'C333'.
       ls_bncom-lgort = '3000'.
       SELECT SINGLE mtart
         FROM mara
         INTO ls_bncom-mtart
         WHERE matnr = ls_bncom-matnr.
       CALL FUNCTION 'VB_NEXT_BATCH_NUMBER'
         EXPORTING
           matnr                          = ls_bncom-matnr
           werks                          = ls_bncom-werks
           check_batch                    = 'X'
           check_material                 = ''
           message_when_auto              = ' '
           x_bncom                        = ls_bncom
           lock_batch                     = ' '
         IMPORTING
           new_charg                      = p_ls_item_data_batch
         EXCEPTIONS
           no_material                    = 1
           no_plant                       = 2
           material_not_found             = 3
           plant_not_found                = 4
           no_batch_handling              = 5
           batch_exist                    = 6
           no_number                      = 7
           illegal_batch_number           = 8
           interval_not_found             = 9
           object_not_found               = 10
           interval_overflow              = 11
           error_automatic_batch_number   = 12
           cancelled                      = 13
           automatic_batch_num_not_active = 14
           OTHERS                         = 15.
       IF sy-subrc = 0.
         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             wait = 'X'.
       ENDIF.
    ENDFORM.                    " CREATE_BATCH

  • Need documents for how to use OAM for APPS DBAs

    Hi All,
    Need documents/pdfs, how to use OAM for APPS DBAs.
    Thanks a lot in advance

    Hi,
    For R12 ,refer the Oracle E-Business Suite System Administrator's Guide - Configuration part no:E12893-03 (http://download.oracle.com/docs/cd/B53825_04/current/acrobat/121sacg.pdf)
    For 11i version pls chk :
    Oracle Applications System Administrator's Guide - Configuration (zipped)      B13925-06 (http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115sacg.zip)
    --Rk                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to setup variants for webdynpro report in ABAP? Help!

    Hi Experts,
       I have a webdynpro for ABAP report with selection screen. 
       How to setup variants for webdynpro report in ABAP?
    Thanks
    Gopal

    Hi Gopal,
      There is no concept of Variant in Webdynpro ABAP. But in our project we have some tool to do that. Its not release to the client I think. In my scenarieo, We create the Screen variant and program name will be supplied to the tool that will generate the ouput in PDF and Selection screen in One view. But the same is not avilable .
    If you want the same concept in Webdynpro ABAP, you need to go for Dynamic programming only. This is the only option is avilable.
    Warm Regards,
    Vijay

  • How to use offset for select-option parameter ?

    Hi experts
    could anybody please let me know how to use offset for select-option parameter. i can able to use offset for table fields, variabiles and all , but don't know how to use for parameters.
    following is my code
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    here "prctr"  length is 10.
    i'm using two tables  1. vbsegd-bupla
                                    2. vbsegs-prctr
    here prctr+6(4) = bupla.
    "Bupla" length is 4
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                 WHERE belnr = it_vbkpf-belnr
                                                                   AND gjahr = it_vbkpf-gjahr
                                                                   AND bukrs = it_vbkpf-bukrs
                                                                   AND bupla IN s_prctr.  
    the above statement is not working as prctr and bupla lenths are different. here i want to use offset.
    SELECT belnr gjahr bukrs prctr sgtxt buzei FROM vbsegs INTO CORRESPONDING FIELDS OF TABLE it_vbsegs FOR ALL ENTRIES IN it_vbkpf
                                                                WHERE belnr = it_vbkpf-belnr
                                                                  AND gjahr = it_vbkpf-gjahr
                                                                  AND bukrs = it_vbkpf-bukrs
                                                                  AND prctr IN s_prctr.
    this is working as prctr and s_prctr lengths are equal.
    could anybody please help me out in this.
    Thanks in advance.
    regards
    satish

    Below code will work for you.
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    RANGES: s_bupla FOR vbsegd-bupla.
    s_bupla[] = s_prctr[].
    DELETE ADJACENT DUPLICATES FROM s_bupla.
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                  WHERE belnr = it_vbkpf-belnr
                                                                    AND gjahr = it_vbkpf-gjahr
                                                                    AND bukrs = it_vbkpf-bukrs
                                                                    AND bupla IN s_bupla.

  • How to use stysheet for Swing components?

    Hi,
    Give me a guidence abt how to use Stylesheet for Swing components to crate good looking GUI...........thnx

    thank you for your reply,
    I want to know how many times a component is refreshed. I'm asumming the RefreshCondition attribute gets called everytime a component gets refreshed, hence it could be counted.
    I'm just not sure how to use it.

  • How to use multithreading for asynchronous operation

    hi! i am really new to java, i want to improve the performance of my code, some suggested to implement asynchronous operation using multithreading. Please help me how to use multithreading for asynchronous operation. thanks in advance.

    http://java.sun.com/docs/books/tutorial/essential/threads/
    Note, however, that just making something multithreaded won't necessarily improve performance. You either need multiple CPUs or there needs to be some I/O going on that blocks while something else could be done--other I/O or computing.

Maybe you are looking for

  • Need help on downloading apps that are more than 20MB in size

    I can only download apps less than 20MB in size. If i want to download others that are larger than 20MB, i have to use wifi... But after I connected my phone to my home network and clicked on the app, I am still unable to download it... The only mess

  • Payments are going in two separate for one account

    The payment for vendors in Payment Proposal (F110) are going in two separate transactions for once account. Say for vendor 1011274 the payment amount should be 741  whereas the payment is going in two separate transactions (two payment documents) of

  • Reading file structure and path from other local system share in jsp

    Hi, I have a requirement where I need to list all the file and folder structure from other shared folder from different path. \\tempx\\test , here test is the folder thats shared on tempx folder. if I copy and paste the path "\\tempx\\test" in start-

  • Demantra - can it run with two Data Models in parallel?

    Hello, we face the following situation: we have items that have to planned on a daily basis; many other items, however, only need weekly planning. Demantra only allows one base time unit in its data model. If we choose "daily" for all products, the s

  • Calculate age from a date on numbers

    I am trying to calculate age from a given date in the application numbers. The dates are all in the same column but i need to convert them to ages. I have not been able to find any formulas! Thanks