How to use a logical database's selection screen elements

Hi all,
I have used the logical db, pnp, in my report, however when I want to select data about a personel , ie. her name surname plans-positions, how will I join the two tables pa0001 and logical db? and the table t528t - text for plans?
Thanks.

Hi Deniz,
First of all give Logical database PNP in program attributes(Goto->Attributes).
In program write the following code.
Infotypes : 0000,
                0001.
start-of-selection.
get pernr.
rp-provide-from-last p0000 space pn-begda pn-endda.
if pnp-sw-found =  '1'.
w_itab-pernr = p0001-pernr.
else.
reject.
endif.
rp-provide-from-last p0001 space pn-begda pn-endda.
if pnp-sw-found =  '1'.
w_itab-vorna = p0001-plans.--->position
else.
reject.
endif.
rp-provide-from-last p0002 space pn-begda pn-endda.
if pnp-sw-found =  '1'.
w_itab-vorna = p0002-vorna. -
>first name
w_itab-nachn = p0001-nachn.--->last name
else.
reject.
endif.
append w_itab to t_itab.
end-of-selection.
Dont forget to reward points if found useful.
Thanks,
Satyesh

Similar Messages

  • Logical Database (PNPCE) , selection screen hide.

    Hi Gurus,
             i have couple of questions related to logical database pnpce.
    1.Since i know logical database has there own selection screen , my requirement is i want to add my custom fields to the selection screen other than what is provided is it possible or not.
    2. i want to hide the selection screen of the logical database, but i do want to create my own in which i will be declaring some select options of the standard logical database screen has, like pernr, organisation unit, etc, how do i communicate the entered data with the logical database if i dont use the logical database standard selection screen, hope i could able to explain my problem, please see into my problem and let me know thanks in advance,
    hussaini

    Hussain,
    LDB have standard selection screens, if at all you want to customize those standard selection screen you would have to define a report category for your program. You`ll have to configure in the spro settings for your corresponding report category.
    If you would like to declare your own selection criteria, you can very well do it and these criteria are visible below the standard selection criteria. You can process these elements in your program and not in the LDB standard program. Use the normal selection screen events in your program for processing your selection criteria.
    Hope this info is helpful, reward points if convinced.
    Regards

  • How to use a Logical Database in Function Module.

    Hi Experts,
    I want to use a logical database in a Function Module to fetch data from a standard SAP table into a Internal table for certain filter conditions.
    How can I get get this done????
    I called LDB_PROCESS FM in my FM, but I could not figure out how to store the extract in my IT table since we cant use GET in FM.
    Please provide me a sample code if possible.
    Thanks in Advance,
    Alex.

    Hi,
    i had an example program like this ,in this i want to get the data using pnp logical database with 5 fields in an interface program.
    data: begin of it_final occurs 0,
            pernr like pa0002-pernr,
            vorna like pa0002-vorna,
            nachn like pa0002-nachn,
           usrid like pa0105-usrid,
           usrid_long like pa0105-usrid_long,
           end of it_final.
    get pernr.
      clear : p0000,p0002,p0105.
      rp-provide-from-last p0000 space p_date p_date.
      if p0000-stat2 = '3'.
        v_pernr = pnppernr-low.
      else.
        reject.
      endif.
    *---Get employee pernr, First name ,Last name into final table
      rp-provide-from-last p0002 space p_date p_date.
      if pnp-sw-found = '1'.
       it_final-pernr = p0002-pernr.
       it_final-vorna = p0002-vorna.
       it_final-nachn = p0002-nachn.
      else.
    *---Error message if not infotype 0002 maintained
      T_ERROR-PERNR   = pnppernr-low.
      CONCATENATE TEXT-EMI '0002'
      INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
      APPEND T_ERROR.
      CLEAR T_ERROR.
      endif.
    **--Get SYSTEM USERNAME to final table
      rp-provide-from-last p0105 0001 p_date p_date.
      if pnp-sw-found = '1'.
        it_final-usrid = p0105-usrid.
      else.
    *---Error message if not SYSTEM USERNAME maintained
        T_ERROR-PERNR   = pnppernr-low.
        CONCATENATE TEXT-003 '0105'
        INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
        APPEND T_ERROR.
        CLEAR T_ERROR.
      endif.
    **--Get Email ID to final table
      rp-provide-from-last p0105 0010 p_date p_date.
      if pnp-sw-found = '1'.
        it_final-usrid_long = p0105-usrid_long.
      else.
    *---Error message if not Email ID maintained
        T_ERROR-PERNR   = pnppernr-low.
        CONCATENATE TEXT-004 '0105'
        INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
        APPEND T_ERROR.
        CLEAR T_ERROR.
      endif.
       append it_final.
        clear it_final.
    reward points if useful,
    venkat.

  • How to use OWN logical database

    Hi all,
    hope somebody can help me.
    I copied a standard logical database (FPMF). The program which I use and have modified is also copied from standard.
    How can I assure that the program use MY logical database instead of the SAP-One?
    In my case I have some get statements. And these get statements all refer to FPMF and not to my copied database.
    Do anybody what's the probelm?
    Cheers
    Philip

    Yes, I know. And I am not happy with this solution.
    But I didn't see another way for my issue.
    Thank you very much.
    Philip

  • FBL5N - Logical databases - Dyanamic selection screen fields

    I am trying to insert "Profit center" from BSEG table of Logical database DDF into the dynamic selection screen of FBL5N.
    Procedure I followed:
    Program -> Attributes -> Logical database -> Extras -> Selection views.
    Interestingly when I add "Profit center" from BSID table instead of BSEG, it appears on dynamic selection screen. But this is not working for BSEG. I have no clue why this is so? If someone can help me in this regard, that would be great.
    P.S: I can not insert Profit center from BSID table as BSEG contains profit center values and BSID is not storing the same info.

    Rob,
    Below is the BSEG contents:
    Company code Document Number Customer     Profit Center
    1000         1800001111      0000100006
    1000         1800001111                   0000000401
    BSID contents:
    Company code Customer     Document Number Profit Center
    1000         0000100006   1800001111                  
    As BSID stores customer info, I believe only line item that has customer info is stored here.
    I guess, that is the reason.
    I will try the option told by prev post. Will keep you guys posted.
    Thanks,
    Phani

  • How to use MODIF ID at a SELECTION-SCREEN

    Hello,
    how can use a SELECTION-SCREEN block with MODIF ID? My SELECTION-SCREEN definition looks like the example below and I want to combine it with a MODIF ID - how can I do this?
    SELECTION-SCREEN BEGIN OF BLOCK par3 WITH FRAME TITLE text-003.
    PARAMETERS:    p_pfadn  LIKE rlgrap-filename
                   DEFAULT    '/home/dsbftp/due_test/konditionen_avs3.txt'.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS:    p_trans  TYPE tcode DEFAULT 'JC03',
                   p_appl   TYPE kappl DEFAULT 'J0'.
    SELECTION-SCREEN END OF BLOCK par3.
    thx

    Hi Mike,
    To modify the appearance of an input field on the selection screen, you must assign the parameter to a modification group as follows:
    PARAMETERS <p> ...... MODIF ID <key> ......
    The name of modification group <key> should be a three-character variable name without quotation marks.
    The MODIF ID addition always assigns <key> to the SCREEN-GROUP1 column of internal table SCREEN.
    Parameters assigned to a modification group can be processed as an entire group with the LOOP AT SCREEN and MODIFY SCREEN statements during the AT SELECTION-SCREEN OUTPUT event.
    You can do the following modifications to the selection screen elements:
    1) REQUIRED: When you set REQUIRED = 1, a field that is ready for input is made mandatory
    2) INPUT: When you set INPUT = 1,  Ready for input, even if Input is not set statically.
    3) OUTPUT: When you set OUTPUT = 1, Field is for display only
    4) INTENSIFIED: When you set OUTPUT = 1, Field is highlighted
    4) INVISIBLE: When you set INVISIBLE = 1, Screen field is not displayed, regardless of the static attributes.
    5) ACTIVE: When you set ACTIVE = 1, At the beginning of the PBO, ACTIVE is always set to 1, regardless of the static attribute settings. Setting ACTIVE to 0 automatically sets INPUT = 0, OUTPUT = 0, and INVISIBLE = 1. 
    Here is the sample code:
    REPORT modif_example.
    PARAMETERS: FIELD1(10) MODIF ID FL1,
                FIELD2(12) MODIF ID FL2,
                FIELD3(15) MODIF ID FL3,
                FIELD4(20) MODIF ID FL3.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'FL1'.
        SCREEN-INPUT = '1'.
        MODIFY SCREEN.
        CONTINUE.
      ENDIF.
      IF SCREEN-GROUP1 = 'FL2'.
        SCREEN-INPUT = '0'.
        MODIFY SCREEN.
        CONTINUE.
      ENDIF.
      IF SCREEN-GROUP1 = 'FL3'.
        SCREEN-REQUIRED = '1'.
        MODIFY SCREEN.
        CONTINUE.
      ENDIF.
    ENDLOOP.
    Hope it helps.
    Regards,
    Neeraj Gupta

  • How to pass a default value in selection screen of logical database pnpce

    Dear All,
    Can any one tell me how to pass a default value in selection screen of logical database pnpce .
    Regards
    Rakesh Singh

    Hi Rakesh,
    Go to SE36 (logical database Builder).First enter PNPCE in Logical Database and press documentation,here you will get the details of exactly what is PNPCE and how it works.After that select selections in subojects in se36 only and enter display ,there you have the include from where you acn get the idea.
    Regards,
    Rahul

  • How to display selection screen of logical database on a screen

    Hi Experts,
    I create a screen 100, how do I display a selection screen of logical database on this screen.
    Thanks!
    Anthony

    hi
    if u are making HR report then goto attribute -> Logical database -> write PNPCE to create in build selection scree.
    regards,
    Abhilash

  • How to deal with dynamic selection screen elements when macros are used?

    Hello experts,
    This is regarding the dynamic selection screen elements. Actually the requirement is to modify the existing standard report program RFUMSV00 by copying it into a Z report, adding a few selection screen elements and new fields in the output. I actually did everything required except for the one thing that is going out of my reach.
    There are a certain fields which are coming when they are not supposed to get displayed. I don't understand the code because of its obsoleteness. Neither can I debug it because it is just data declaration.
    This is the code where there is a fault. If I copy the entire code into a new Z report, I'm getting new fields like Entry Date, Document Type, Reference Transaction,  Reference key, Logical system.
      DEFINE selection_screen_line.
      selection-screen: begin of line.
      parameters &3 like &4 default 'X' modif id mc4.
      selection-screen: comment (30) &1 for field &3 modif id mc4.
      selection-screen: comment pos_low(10) text-019
                        for field &2 modif id mc4.  "neu
      parameters &2 like rfums_alv-variante modif id mc4.
      selection-screen:
          position pos_high.
      selection-screen: pushbutton (15) text-028
                        user-command &5 modif id mc4.
      selection-screen end of line.
    END-OF-DEFINITION.
    Kindly, suggest me the right solution.

    In the program attributes ( SE38 > RFUMSV00 > GOTO > Properties ), you will find a logical database BRF declared. The include DBBRFSEL is part of the selection screen of this logical database.
    The selection screen is actually the selection screen of this logical database.
    Under the Logical Database field, there is a Selection screen field where you can input which selection screen of the logical database to be used.
    But, this is just to change the selection screen that is displayed. To completely suppress it you need to remove logical database declaration from the properties of the program and call it inside your program through function module.
    You cannot just remove it from the declaration because many of its variables are used in the program.
    So call it using function module as the first step in INITIALIZATION section of the program.
    The syntax and function module to call it in your program can be found in the following thread :
    How to hide the selection screen of a Logical datebase?
    Regards,
    Ashish

  • How to create a logical database?

    Hi,
    Can anyone tell me how to create a logical database? I am curious about it.
    Thanks.
    Awards will be provided.
    Best regards,
    Chris Gu

    Transaction code for creating Logical db is se36.
    Give the name as <ldbname>..
    Specify the table names and the sub nodes according to your heirarchy.The root node used is zxxx_product and child node is zxxx_orders
    The heirarchy used is ZXXX_PRODUCT---->ZXXX_ORDERS
    write the below code under selections ...
    Enable DYNAMIC SELECTIONS for selected nodes :
    SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE zxxx_product.
    SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE zxxx_orders.
    Enable FIELD SELECTION for selected nodes :
    SELECTION-SCREEN FIELD SELECTION FOR TABLE zxxx_product.
    SELECTION-SCREEN FIELD SELECTION FOR TABLE zxxx_orders.
    ***User defined blocks :
    ****Root node
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
    SELECT-OPTIONS :
    so_pname FOR zxxx_product-prname ,
    so_pdelv FOR zxxx_product-prdeldate .
    SELECTION-SCREEN END OF BLOCK b1 .
    ****Child node
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .
    SELECT-OPTIONS :
    so_odate FOR zxxx_orders-orddate ,
    so_oqty FOR zxxx_orders-ordqty .
    SELECTION-SCREEN END OF BLOCK b2 .
    write the below code under include include DBZXX_PRODUCTTOP
    TABLES : ZXXX_product, ZXXX_orders.
    DATA : gt_root TYPE table of ZXXX_product ,
    gt_chld TYPE table of ZXXX_orders .
    write the below code under source code...
    Call event GET Zxxx_PRODUCT
    FORM put_zxxx_product.
    TYPES : BEGIN OF ls_pid ,
    prodid TYPE zxxx_product-prodid,
    END OF ls_pid .
    DATA : lt_pid TYPE ls_pid OCCURS 0 ,
    lt_pid_tmp TYPE ls_pid OCCURS 0 .
    STATICS lv_first_time VALUE 'X'.
    STATICS ls_isroot_fields TYPE rsfs_tab_fields.
    STATICS ls_isroot_where TYPE rsds_where.
    STATICS ls_ischld_fields TYPE rsfs_tab_fields.
    STATICS ls_ischld_where TYPE rsds_where.
    IF lv_first_time EQ 'X'.
    CLEAR lv_first_time.
              o
                    + Declarations for field selection for node Zxxx_PRODUCT ***
    " move table name to the corresponding field
    MOVE 'Zxxx_PRODUCT' TO ls_isroot_fields-tablename.
    " Read values from selection screen
    READ TABLE select_fields WITH KEY ls_isroot_fields-tablename
    INTO ls_isroot_fields.
    " move table name to the corresponding field
    MOVE 'Zxxx_PRODUCT' TO ls_isroot_where-tablename.
    " Read values from dynamic selection screen
    READ TABLE dyn_sel-clauses WITH KEY ls_isroot_where-tablename
    INTO ls_isroot_where.
              o
                    + Declarations for field selection for child node Zxxx_ORDERS ***
    MOVE 'Zxxx_ORDERS' TO ls_ischld_fields-tablename.
    READ TABLE select_fields WITH KEY ls_ischld_fields-tablename
    INTO ls_ischld_fields.
    MOVE 'Zxxx_ORDERS' TO ls_ischld_where-tablename.
    READ TABLE dyn_sel-clauses WITH KEY ls_ischld_where-tablename
    INTO ls_ischld_where.
    "...Check whether entry is made in atleast one selection field:
    IF NOT so_pname IS INITIAL OR
    NOT so_pdelv IS INITIAL OR
    NOT so_odate IS INITIAL OR
    NOT so_oqty IS INITIAL OR
    NOT ls_isroot_where-where_tab IS INITIAL OR
    NOT ls_ischld_where-where_tab IS INITIAL .
    "...Check whether entry is made in atleast one field in root node :
    IF NOT so_pname IS INITIAL OR
    NOT so_pdelv IS INITIAL OR
    NOT ls_isroot_where-where_tab IS INITIAL .
    SELECT prodid FROM Zxxx__product
    INTO CORRESPONDING FIELDS OF TABLE lt_pid
    WHERE prname IN so_pname AND
    prdeldate IN so_pdelv AND
    (ls_isroot_where-where_tab).
    "...Check whether entry is made in atleast one field in child node:
    IF NOT so_odate IS INITIAL OR
    NOT so_oqty IS INITIAL OR
    NOT ls_ischld_where-where_tab IS INITIAL AND
    NOT lt_pid IS INITIAL.
    SELECT prodid FROM Zxxx_orders
    INTO CORRESPONDING FIELDS OF TABLE lt_pid_tmp
    FOR ALL ENTRIES IN lt_pid
    WHERE prodid = lt_pid-prodid AND
    orddate IN so_odate AND
    ordqty IN so_oqty AND
    (ls_ischld_where-where_tab).
    lt_pid = lt_pid_tmp.
    ENDIF.
    ELSEIF NOT so_odate IS INITIAL OR
    NOT so_oqty IS INITIAL OR
    NOT ls_ischld_where-where_tab IS INITIAL.
    SELECT prodid FROM Zxxx_orders
    INTO CORRESPONDING FIELDS OF TABLE lt_pid
    WHERE orddate IN so_odate AND
    ordqty IN so_oqty AND
    (ls_ischld_where-where_tab).
    ENDIF.
    ******lt_pid contains all the selections based product ids
    ******Now retrieve all the records with the corresponding product ids
    CHECK NOT lt_pid IS INITIAL.
    IF NOT ls_isroot_fields IS INITIAL.
    SELECT (ls_isroot_fields-fields) FROM Zxxx_product
    INTO CORRESPONDING FIELDS OF TABLE gt_root
    FOR ALL ENTRIES IN lt_pid WHERE prodid = lt_pid-prodid.
    ENDIF.
    IF NOT ls_ischld_fields IS INITIAL AND
    NOT gt_root IS INITIAL.
    SELECT (ls_ischld_fields-fields) FROM Zxxx_orders
    INTO CORRESPONDING FIELDS OF TABLE gt_chld
    FOR ALL ENTRIES IN gt_root WHERE prodid = gt_root-prodid.
    ENDIF.
    LOOP AT gt_root INTO Zxxx_product.
    PUT Zxxx_product.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDFORM.
    write the below code under
    include DBZXXX_PRODUCTNXXX -->
    include DBZXXX_PRODUCTN002 .
    form put_zxxx_orders
    LOOP AT gt_chld INTO zxxx_orders WHERE prodid = zxxx_product-prodid.
    PUT ZXXX_ORDERS.
    ENDLOOP.
    endform.
    now write a report program and call the ldb by its name using get
    get <ldbname>.
    Reward if this is useful.
    Regards,
    devi.
    Edited by: Devi Raju on Jul 15, 2008 9:13 AM

  • How to execute the logical database.

    how to execute the logical database.

    There are two ways of using a logical database - either by linking it with the executable program(specify the LDB name in the program attributes) or by using the function module LDB_PROCESS.
    1.Data read by the logical database is passed back to the program using the interface work areas.Use GET statements in the report.
    GET events are implemented internally as FORM routines.
    2.If you call the logical database using the above function module, the selection screen of LDB is not displayed.It uses special subroutines called callback routines, which are called by the function module and filled with the required data.
    Please refer the following link for more details.
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm

  • How to find Oudated Logical Database

    Hello,
    How to findout wheather a  Logical Database is outdated or not.
    Anyone have idea for replace LDB TIF with new LDB.
    Waiting for response,
    Reg

    There are two ways of using a logical database - either by linking it with the executable program(specify the LDB name in the program attributes) or by using the function module LDB_PROCESS.
    1.Data read by the logical database is passed back to the program using the interface work areas.Use GET statements in the report.
    GET events are implemented internally as FORM routines.
    2.If you call the logical database using the above function module, the selection screen of LDB is not displayed.It uses special subroutines called callback routines, which are called by the function module and filled with the required data.
    Please refer the following link for more details.
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm

  • In this report i have marked one line..if this width 30,i need to multiply by a number 0.3 and if the width =30,it multiplies by 0.37...how to use this logic here..??? anyone can help??

    In this report i have marked one line..if this width < 30,i need to multiply by a number 0.3 and if the width >=30,it multiplies by 0.37...how to use this logic here..??? anyone can help??
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @SCCode nvarchar(30)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    --Rcpt from PRDN (Condition checked for Return component exclusion also)
    SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
    T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'FG Item Code',
    T3.ItemName as 'FG Item Name',
    T2.PlannedQty as 'FG Planned Qty',
    T2.U_OD as 'OD',
    T2.U_ID as 'ID',
    T2.U_OD/25.4 as 'Inches',
    (T2.U_OD-T2.U_ID)/2 as 'Width',
    0 as 'FG Pending Qty',
    0 as 'FG Receipt Qty',
    '' as 'Issue Item Code',
    '' as 'Issue Item Name',
    Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
    0 as 'Issue Item - Return Quantity',
    '' as 'Return Doc No',
    SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
    SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
    from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
    INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
    LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)
    LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntry
    WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
    GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2
    UNION ALL
    SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
    T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'Item Code',
    T3.ItemName as 'Item Name',
    T2.PlannedQty as 'Planned Qty',
    T2.U_OD as 'OD',
    T2.U_ID as 'ID',
    T2.U_OD/25.4 as 'Inches',
    (T2.U_OD-T2.U_ID)/2 as 'Width',
    (Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',
    (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
    a.ItemCode as 'Issued Item Code',
    a.Dscription as 'Issued Item Name',
    Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
    (Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
    (ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
    SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
    SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
    from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
    INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
    LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
    LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry 
    WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
    GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription    order by T2.DocNum desc

    Hi,
    Try this:
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @SCCode nvarchar(30)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    --Rcpt from PRDN (Condition checked for Return component exclusion also)
    SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
    T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'FG Item Code',T3.ItemName as 'FG Item Name',T2.PlannedQty as 'FG Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) <30 then ((T2.U_OD-T2.U_ID)/2) *0.3 end, 0 as 'FG Pending Qty',0 as 'FG Receipt Qty','' as 'Issue Item Code','' as 'Issue Item Name',Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',0 as 'Issue Item - Return Quantity','' as 'Return Doc No',SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntryINNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCodeLEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntryWHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2UNION ALL SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'Item Code',T3.ItemName as 'Item Name',T2.PlannedQty as 'Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) >=30 then ((T2.U_OD-T2.U_ID)/2) *0.37 end, (Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',(Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
    a.ItemCode as 'Issued Item Code',
    a.Dscription as 'Issued Item Name',
    Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
    (Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry
    where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
    (ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
    SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
    SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
    from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
    INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
    LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
    LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry
    WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
    GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,
    T2.PlannedQty,T2.U_OD,
    T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription  
    order by T2.DocNum desc
    Thanks & Regards,
    Nagarajan

  • Regarding Logical database and  select statement..

    Hi
    Experts.
    i would  like to  know the  diff b/w logical data base & select statement  while using report.
    wt is the use of logical databases in R/3. is there   any   advantage  used in the  reports.
    Thanks & Regards..
    Spandana.

    Dear Spandana,
      Go through the below description of LDB. I hope you wil get a fair amount of idea.
    SAP comes loaded with all the extras. Among the extras that are most helpful to IT managers are all the access routines needed to pull any business object that managers can think of out of SAP databases. However, SAP has not thought of everything where your particular applications are concerned. SAP organizes its standard database tables to service business units based on conventional business applications. Itu2019s likely your business requires something new, perhaps even something exotic. In that case, you will need to create a new database, using information from different places. Basically, you need a logical database. You need to create a virtual business data object repository consisting of a new kind of record or table that suits your purposes. In addition, the repository should be composed of information that is actually stored in a number of different locations, none of them necessarily logically associated with one another. Letu2019s take a closer look at creating logical databases.
    A case for a logical database
    Suppose my company manufactures widgets of the most obscure variety, and they are components of other widgets. I sell my widgets as raw material for the more sophisticated widgets built by others, but in some cases I actually partner with other manufacturers in creating yet another class of widget. Now, in my world, I consequently have customers who are also partners. I sell to them and I partner with them in manufacturing and distribution. Also, I need an application that uses both of these dual-use relationships.
    Essentially, I have a customer database and a partner database. Neither contains records that are structured to contain the identifying particulars of the other. Thus, I need a hybrid database that gives me tables detailing these hybrid relationships. What can I do? I can go the long way around and write a new database, pulling information from both and creating new objects with a customized program that I write by hand. However, this process is cumbersome and contains maintenance issues. On the other hand, I can use SAPu2019s logical database facility, create my logical database in a couple of minutes, and have no maintenance issues at all.
    Logical database structures
    There are three defining entities in an SAP logical database. You must be clear on all three in order to create and use one.
    u2022     Table structure: Your logical database includes data from specified tables in SAP. There is a hierarchy among these tables defined by their foreign keys (all known to SAP), and you are going to define a customized relationship between select tables. This structure is unique and must be defined and saved.
    u2022     Data selection: You may not want or need every item in the referenced tables that contributes to your customized database. There is a selection screen that permits you to pick and choose.
    u2022     Database access programming: Once youu2019ve defined your logical database, SAP will generate the access subroutines needed to pull the data in the way you want it pulled.
    Creating your own logical database
    ABAP/4 (Advanced Business Application Programming language, version 4) is the language created by SAP for implementation and customization of its R/3 system. ABAP/4 comes loaded with many predefined logical databases that can construct and table just about any conventional business objects you might need in any canned SAP application. However, you can also create your own logical databases to construct any custom objects you care to define, as your application requires in ABAP/4. Hereu2019s a step-by-step guide:
    1.     Call up transaction SLDB (or transaction SE36). The path you want is Tools | ABAP Workbench | Development | Programming Environment | Logical Databases. This screen is called Logical Database Builder.
    2.     Enter an appropriate name in the logical database name field. You have three options on this screen: Create, Display, and Change. Choose Create.
    3.     Youu2019ll be prompted for a short text description of your new logical database. Enter one. Youu2019ll then be prompted to specify a development class.
    4.     Now comes the fun part! You must specify a root node, or a parent table, as the basis of your logical database structure. You can now place subsequent tables under the root table as needed to assemble the data object you want. You can access this tree from this point forward, to add additional tables, by selecting that root node and following the path Edit | Node | Create. Once youu2019ve saved the structure you define in this step, the system will generate the programming necessary to access your logical database. The best part is you donu2019t have to write a single line of code.
    Watch out!
    The use of very large tables will degrade the performance of a logical database, so be aware of that trade-off. Remember that some tables in SAP are very complex, so they will be problematic in any user-defined logical database.
    Declaring a logical database
    Hereu2019s another surprising feature of logical databases: You do not assign them in your ABAP/4 Code. Instead, the system requires that you specify logical databases as attributes. So when you are creating a report, have your logical database identifier (the name you gave it) on hand when you are defining its attributes on the Program Attributes screen. The Attributes section of the screen (the lower half) will include a Logical database field, where you can declare your logical database.
    Logical databases for increasing efficiency
    Why else would you want to create a logical database? Consider that the logical databases already available to you begin with a root node and proceed downward from there. If the data object you wish to construct consists of items that are all below the root node, you can use an existing logical database program to extract the data, then trim away what you donu2019t want using SELECT statementsu2014or you can increase the speed of the logical database program considerably by redefining the logical database for your object and starting with a table down in the chain. Either way, youu2019ll eliminate a great deal of overhead.
    Regards
    Arindam

  • Better alternative to header lines, use of logical database, field-symbols

    Hello experts,
    I am wondering if theres a better and faster alternative than declaring a header line for an itab. are work areas faster?
    What is the use of logical database? can you please give me an example on how to use it in reports.
    how do I use field-symbols? I am confused on how it works.
    P.S. I recently installed SAP netweaver preview abap edition
    in my home PC and I am wondering if I could practice BDC, user exits, etc. If so, how?
    Again, thanks for all your help since I'm kinda new to ABAP.

    I always use this...It uses header lines, but at least is smaller -:)
    <b>DATA: BEGIN OF MY_TAB TYPE STANDARD TABLE OF BKPF WITH HEADER LINE.</b>
    For logical databases, you can check my blog...I always use LDB for HR programs -:)
    <a href="/people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports:///people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
    LDB's provides a lot of information, because they gather it from a lot of different tables...
    A Field-Symbols is like a pointer in C++, like an alias for a variable...Here's a small example...
    REPORT Z_ATG_DUMMY.
    FIELD-SYMBOLS: <F1>, <F2> TYPE I.
    DATA: TEXT(20) TYPE C VALUE 'Hello, how are you?',
          NUM TYPE I VALUE 5,
          BEGIN OF LINE1,
          COL1 TYPE F VALUE '1.1e+10',
          COL2 TYPE I VALUE '1234',
          END OF LINE1,
          LINE2 LIKE LINE1.
    ASSIGN TEXT TO <F1>.
    ASSIGN NUM TO <F2>.
    DESCRIBE FIELD <F1> LENGTH <F2>.
    TEXT = 'CHAU'.
    WRITE: / <F1>, 'has length', NUM.
    WRITE: / TEXT, 'has length', NUM.
    ASSIGN LINE1 TO <F1>.
    ASSIGN LINE2-COL2 TO <F2>.
    MOVE <F1> TO LINE2.
    ASSIGN 'LINE2-COL2 =' TO <F1>.
    I just can't install SAPNWSP...I only got MiniSap...But I got all the development enviorment...Don't know about the User-Exits...Actually I don't think so...Because those "mini" systems doesn't come with any functional module.
    Greetings,
    Blag.

Maybe you are looking for

  • Do Not cost and CCS

    Hello Everyone, Afresh to CO module and have a question on the 'Do Not Cost' indicator on material master data and it's effect on material costing. I have a raw material that has this indicator marked and the OBYC configuration has GBB - VBR mapped t

  • Help with Adjustment brush

    Hi All, I have upgraded LR2 to 2.1. Now I can't use the adjustment brush. When i click on the photo to make an adjustment - nothing happens; not white dot, no change, no nothing. HELP! What am I doing wrong? The gradient filter works just fine. Any h

  • Using Hierarchy levels in Webi charts and tables

    Gurus, I am building a webi report that incorporates our HR employee structure. The Webi report is told to bring data for 'Level 1 and 2' of the hierarchy for the employee ID requesting the data. scenario Employee A      Employee A1           Emp A1a

  • Very basic initial configuration question.

    Hi. I replaced a Catalyst 2960G for a C2960X-24-L in a network where there are already five switches. I have no idea how to assign it an ip : is there anyone here willing to explain that in  very simple way ? I tried plug it in the existing network,

  • Batch schedule several webi reports

    hi, all i have lots of webi reports to schedule, and it's time consuming to do it one by one, any method can schedule them in batch mode. boe 3.1 sp3. thanks in advance. Ada