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.

Similar Messages

  • Use of Logical Database in function module

    Hello Experts,
    Is there a way of using logical database and Get enent inside a function module.
    I am trying to create a RFC for HR module and need this badly. Any help would be highly appriciated.
    Thanks,
    Gregory fernando

    This fm will work fine with all LDBs including PNP
    Have you checked the fm documentation ?

  • How to use Logical database in function module?

    I will create a function module in HR.
    but how to use Logical database  in function module ?  Logical database PNP always show screen.in function (RFC) code , it is a matter.

    You cannot attach the LDB to the main program of the function group.
    - So you may [SUBMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=submit&adv=false&sortby=cm_rnd_rankvalue] a report which use the LDB and get back the data (export/import), by default in the syntax of SUBMIT the selection-screen will not be displayed
    - Use [LDB_PROCESS|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=ldb_process&cat=sdn_all], fill a structured table for selection, and get data back in another table
    - Use [HR function modules to read Infotypes|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=hrfunctionmodulestoread+Infotypes&adv=false&sortby=cm_rnd_rankvalue].
    Regards

  • 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

  • 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

  • How to use parameters in smartform genrated  function module

    i executed smartform one functional module is genrated  '/1BCDWB/SF00000002'
    now the problem is that  i want to send  output of this smartform through email
    now how to use ' MAIL_RECIPIENT   '      and  ' MAIL_SENDER   ' to send smartform output through email .
    please check following module which generated by smartform.
    plz suggest me  .
    CALL FUNCTION '/1BCDWB/SF00000002'
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        ITAB_PA0001                =   ITAB_PA0001
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    Hi
    You can do it while passing these parameters in the CONTROL_PARAMETERS.
    data: ls_CONTROL_PARAMETERS type SSFCTRLOP.
    ls_CONTROL_PARAMETERS-DEVICE  = 'LOCL'.
    ls_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
    ls_CONTROL_PARAMETERS-PREVIEW = ' '.
    Pass this ls_CONTROL_PARAMETERS to the importing parameter of the FM .
         CALL FUNCTION LF_FM_NAME
               EXPORTING
                          CONTROL_PARAMETERS   = LS_CONTROL_PARAM
    In addition to this, you might also want to set the print immediately field on the same structure to 'X'.
    Generally you leave the device field empty, the user master record default printer will be used

  • How to pass dynamic logical expression to function module

    Hi,
    I'm using FM META_READ_TABLE as below:
    As mentioned above im using META_READ_TABLE FM to get company codes from CSKS table of ECC. Below is the code im using:
       DATA:i_opt type STANDARD TABLE OF RFC_DB_OPT, i_fld type STANDARD TABLE OF RFC_DB_FLD,
           i_res type STANDARD TABLE OF TAB512.
    Constants:   c_expr(72) TYPE c VALUE 'KOSTL EQ COST_CTR', c_fld(5) TYPE c VALUE 'BUKRS'.
      w_opt-text = c_expr.
    w_fld-FIELDNAME = c_fld.
    append: w_opt to i_opt,
            w_fld to i_fld.
    data i_control type STANDARD TABLE OF BBP_CONTROL_RECORD.
    **&&--Get Co code from ECC (CSKS table)
    CALL FUNCTION 'META_READ_TABLE'
      EXPORTING
        QUERY_TABLE          = c_table
    *   DELIMITER            = ' '
    *   NO_DATA              = ' '
    *   ROWSKIPS             = '0'
    *   ROWCOUNT             = '0'
        LOGICAL_SYSTEM       = v1_logsys
      TABLES
        OPTIONS              = i_opt
        FIELDS               = i_fld
        DATA                 = i_res
        CONTROL_RECORD       = i_control.
    however it is giving me 'Communication Error' while executing this piece of code. I guess the problem here is with passing query to i_opt table. obviously the way im doing this is wrong and it has to be dynamic. Could anybody please give me idea how to execute fm with dynamic query i.e., 'KOSTL EQ COST_CTR' where COST_CTR is cost center and an importing parameter to this.please advise.
    Rgds

    The "communication error" would seem more likely to be a problem with an RFC call - does 'META_READ_TABLE" call another function in the remote system?
    We don't have that function module here (is it SRM?) but you should be able to construct your dynamic "where" something like this (p_kostl is the variable in this example):
      data:
        l_where     type text72.
      concatenate
        'KOSTL EQ_'
        p_kostl      "variable
        into l_where.
      translate l_where using '_ '.  "replace underscore with space
    Jonathan

  • How to use select-options in the function module of import parameter ?

    Hi ...
       I have created a BAPI and tested in SWO1 tcode , by giving the single value for an company code ( BUKRS ) , it executed properly .
    Same thing is working after implementing in a program .
    so now it is working for fetching a single company code details .
    My requirement is : I want to use select-options in program as well as in function module IN IMPORT PARAMETER.
    Program :
    REPORT  ZTEST.
    TABLES : T001 , ZBAPI_STR .
    TYPES : BEGIN OF TY_ITEM  .
              INCLUDE STRUCTURE ZBAPI_STR .
    TYPES : END OF TY_ITEM .
    DATA :WA_ITEM TYPE TY_ITEM ,
          ITEM LIKE STANDARD TABLE OF WA_ITEM INITIAL SIZE 0 .
    PARAMETER : BUKRS TYPE ZBAPI_STR-BUKRS.
    call function 'ZBAPI_FMT001'
      exporting
        bukrs         =  BUKRS
    IMPORTING
      RETURN        =
      tables
        itemtab       = ITEM
    IF ITEM IS NOT INITIAL .
      LOOP AT ITEM INTO WA_ITEM .
        WRITE : / WA_ITEM-BUKRS , WA_ITEM-BUTXT , WA_ITEM-ORT01 , WA_ITEM-LAND1 .
      ENDLOOP.
    ENDIF.
    FUNCTION MODULE :
    FUNCTION ZBAPI_FMT001.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(BUKRS) TYPE  EFG_TAB_RANGES
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRET2
    *"  TABLES
    *"      ITEMTAB STRUCTURE  ZBAPI_STR
    SELECT BUKRS BUTXT ORT01 LAND1 FROM T001 INTO TABLE ITEMTAB WHERE BUKRS = BUKRS .
    ENDFUNCTION.
    Regards
    Deepa.

    I have given a similiar example which i did
    Declare a
    Table type:Z_TT_PONUM             
    Short text  :  Select options  PO Number
    in SE11 tcode with row type eg: Z_ST_PONUM
    create a structure (this will be the row type)
    Structure          Z_ST_PONUM            
    Short text         Select Options Field PO number
    Compenent  Compent type
    SIGN       BAPISIGN      Inclusion/exclusion criterion SIGN for range tables
    OPTION       BAPIOPTION      Selection operator OPTION for range tables
    LOW       EBELN                      Purchasing Document Number
    HIGH       EBELN                      Purchasing Document Number
    In the function module import
    give as
    I_PO_NUM     TYPE     Z_TT_PONUM     opt  pass value Select options  PO Number
    Hope this is exactly what you want to know.
    So you create a structure simliar to mine but the low an high whould be your component
    then a table type  and then include that in the BAPI.
    Then pass your select-option value to this BAPI when you call this BAPI in the program

  • How to use multiple models in one Function module?

    Hi,
    In my FM i am using 2 models and if i dont completely exit the Function and use the same fm for another query based on another
    model it is giving error saying invalid type.
    if iv_type_of_search = 'A'.
    start the application BT
        lv_bol_core = cl_crm_bol_core=>get_instance( ).
        lv_bol_core->start_up( 'BP_APPL' ).
    get an instance of dynamic opporunity query
        lr_query = cl_crm_bol_dquery_service=>get_instance( 'BuilHeaderAdvancedSearch' ).
    Contact Search
      elseif iv_type_of_search = 'C'.
    start the application BT
        lv_bol_core = cl_crm_bol_core=>get_instance( ).
        lv_bol_core->start_up( 'BP_APPL' ).
    get an instance of dynamic opporunity query
        lr_query = cl_crm_bol_dquery_service=>get_instance( 'BuilContactAdvancedSearch' ).
    *Opportunity Search
      elseif iv_type_of_search = 'O'.
    start the application BT
        lv_bol_core = cl_crm_bol_core=>get_instance( ).
        lv_bol_core->start_up( 'BT' ).
    get an instance of dynamic opporunity query
        lr_query = cl_crm_bol_dquery_service=>get_instance( 'BTQOpp' ).
      endif.
    Any idea how to over come this or remove the instance of the old query and model every time its run?
    it looks like the object of the last run is still there and i cant find any destructor method or way and
    if i exit se37 it works fine....

    Hi George,
    You can also set up your model (component set) with the components you need.
    Check it on:
    SPRO->CRM->CRM Cross-Application Components->Generic Interaction Layer/Object Layer->Basic Settings
    Kind regards,
    Garcia

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

  • 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

  • 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

  • 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

  • Need an example how to use SCAN_Start with a callback function

    I would appreciate if someone helps me with a working example of how to use SCAN_Start with a callback function. I need just a basic functionality: to specify a channel list (with gains probably), to start a data acquisition task and to receive data buffers utilizing a callback function. t this time whatever I was trying to do caused computer hangups, though it is supposed to be one of the most regular tasks to perform.
    Thank you in advance,
    Mike

    Hello Mike,
    Thank you for contacting National Instruments.
    Attached is an example project which uses a callback function to begin analog acquisition (AI) by calling SCAN_Start. This project acquires from the first 2 channels on your DAQ device. Make sure to modify the device number in the code to match the number of your card.
    Let me know if you have any further questions...
    Sincerely,
    Sean C.
    Applcications Engineer
    National Instruments
    Attachments:
    Acquire_multichannel_61xx.zip ‏11 KB

Maybe you are looking for

  • Power Mac G5 and Applications

    I'm currently in the market to buy a new Power Mac G5 Intel based. My question is, will my current programs run on the new mac? I currently use most often: Adobe Creative Suite CS, Studio 8, FlightCheck Professional, QuarkXpress. Are there any proble

  • BAPI for F-30

    Hi All, what is the bapi for f-30 -clearing GL transaction, i have tried BAPI_ACC_DOCUMENT_POST but the item is not cleared, did i miss anything from the bapi

  • Layout Problem in !E 6 Windows

    I'm having a problem with the layout on this page ( http://www.hrrh-foundation.ca/stories.html ) in Windows Internet Explorer 6 only. The content in the center column is displaced down to below the level of the blue nav in the left column. There's no

  • OBIEE11g GO URL Hyperlink exported in clickable form to Excel

    Hi, I've had to use a GO URL as a drill through on one of our dashboards. Normall we use Action Link (BI Navigation). When the Anlaysis with the GO Url is exported to excel the hyperlink is exported in a clickable form. Anyone know if it's possible t

  • Runtime.exec error on Fedora Core

    Hi, I have some difficulty using Runtime.exec method on Fedora Core. If classpath contains "space", it cannot execute a commnad. It works well on Windows systems with quotation marks. Here's my code. Proccess p = r.exec("java -classpath .:\"pkg root"