Doc Number -- Latest Instance

Hi I have been trying to write a query that via the means of a formatted search will look at the document no. and bring back the last instance of that document number. I have the query below which brings back the document no. but not sure how i can format this so it will work as a formatted search?
Any ideas?
SELECT LogInstanc, FROM ADOC T0
WHERE T0.DocNum = [%0] AND T0.objtype=17 and
t0.LogInstanc = (select max(t1.LogInstanc) from Adoc t1 where t1.docnum=t0.docnum and t1.objtype=t0.objtype)

Hi,
Use this:
SELECT LogInstanc FROM ADOC T0
WHERE T0.DocNum = $[ORDR.DocNum] AND T0.objtype=17 and
t0.LogInstanc = (select max(t1.LogInstanc) from Adoc t1 where t1.docnum=t0.docnum and t1.objtype=t0.objtype)
Regards,
Nat

Similar Messages

  • View latest Instance Option in Dashboard

    Dear Experts,
    Could you please tell me the advantages of VIew latest Instance Option in Live Office Connection in case of every user has different authorizations.
    Please answer the below things.
    1)If we create a Dashboard using the View Latest Instance option after scheduling the Report,what are things we have to do so that every user can see the data
    based on his related authorization?
    2)If users are more number ,then is the View Latest Instance Option in Live Office Connection is the right option,in case every user have his own Authorzation?
    If yes ,how the dashboard ll work for different Users?
    3)Users how can see the dashboard in which they should able to see the data related to their Authorization?
    Could you please share ideas related to View latest Instance Option?
    Regards,
    Venkat

    HI Wolfgang - not sure it's possible. You'd probably have to leverage an alternate scheduling 'destination', i.e. if for instance you schedule to a users Inbox, then they should see the latest instance in their inbox - no right-clicking required to open that. Possibly impractical if separate instance is created for each user - though I'd hope this wouldn't be the case if the report contents are the same for everyone.
    Cheers, Ferdie.

  • BO Mobile - Not referring to latest instance

    Customer wants that his users should be able to view the latest report instance of Web-I and Desk-I documents in their respective report folders when logging in through the Blackberry.
    BOE Version installed at customer's location: XI R2 SP3
    OS on BOE Server: WINDOWS 2003 SP2
    CMS Database Type and Version: ORACLE 10G
    Application Server installed: TOMCAT
    Observed Behavior:
    When user logs in to BOE XI R2 through his Blackberry and navigates to the appropriate report document folder, the option to View the Latest Instance or History of a given Desk-I or Web-I report is not available.
    I have also gone through the following documents:
    - Using BusinessObjects Mobile (XI R2)
    - What's New in BusinessObjects Mobile (XI 3.1)
    - Using BusinessObjects Mobile (XI 3.1)
    - BusinessObjects Mobile Installation and Deployment Guide (XI 3.1)
    I have not been able to locate the required options in the above mentioned XI R2 and XI 3.1 documentation. I have also suggested the following workarounds to the customer:
    a) schedule the report to "Inbox": customer did not agree to the same as in his case this would generate multiple copies of the same report based on the number of users. Customer has an installed base of 1000 users.
    b) schedule the report to "Inbox" send as shortcut: customer did not agree to the same as well because the report needs to be viewed by the senior level executives. Here these users would want to view the latest report instance from the respective report folder.
    c) refresh report on demand: customer did not agree to the same because it takes a long time to refresh the data and display the updated report and senior level executive would not be able to wait for that much time.
    I would appreciate if anybody could advise on the following:
    - any plans to add the above requirement in upcoming release of BOE?*
    - any other workarounds (excluding the OpenDoc URL option)?*
    Regards,
    Arijit Gupta

    if it is outdated, what software should i use to do data driven websites?
    Most of us manually code our database driven sites with PHP & MySqli
    PHP: Mysqli - Manual
    To simplify things a little, you could use one of the freely available PHP frameworks below:
    CodeIgniter / EllisLab
    High Performance PHP Framework for Web Development - Symfony
    Yii PHP Framework: Best for Web 2.0 Development
    Laravel - The PHP framework for web artisans.
    Frameworks will help shorten your development time but you still need to thoroughly understand code to use them.
    Nancy O.

  • Sales doc number?

    hi
    can i keep sales doc number in key fields or data fields in DSO?
    in data fields generally K.F and unique character also.
    in key fields we keep characters only.
    regards
    suneel.

    Hi Sunil,
    you can put the sales doc number (EBELN)
    in key filelds ,because which is the uniqe in the sales data.
    Regards
    Krishna Reddy

  • How  to  look for  fi doc  number in cj88

    HI  expert:
          when I  run cj88.   the system generate FI  doc number.   how to look for FI doc number.
    can you tell me !
    thank you !!!!

    Hi,
    You can see the FI Doc. thru' given instruction
    Go to T-code CJI3 then fillup the WBS no. in which you want to see the Settlement document.
    Execute then filter up document type AA  double click on this & click on FI document.
    Hope it will solve your problem.
    Regards,
    Vishal Kr. Sharma

  • Link from Accounting Doc Number to PO

    Hi,
    In FBL3n certain doc types PO number is not updating.Using assignmnets i want to update the field for these kind of doc no.
    My doubt is from FI doc number how can i link it to the PO number.
    Eg:i have an FI doc number say 51000000 which has two line items and corrponding 3 tax line items each .(ie 9 lines for the same in FBL3N).How can i link that my tax line items corrspond to which line item.
    Hope my question is clear.Please suggest.

    Hello,
    Generally the FI doc created from an PO Invoice have:
    BKPF-AWTYP = 'RMRP'.
    You can goto RSEG from BKPF using:
    RSEG-BELNR = BKPF-AWKEY+0(10)
    RSEG-GJHAR = BKPF-AWKEY+10(4)
    In RSEG, you have the PO details in RSEG-EBELN & RSEG-EBELP.
    BR,
    Suhas

  • Crystal report for Enterprise show latest instance shows URL not found error

    hi everyone,
    we recently upgraded our BO4.1 platform from SP2 to SP5.
    after the upgrade we are getting error while view the latest instance of Crystal report in BI launchpad, this error occurs only for Crystal report and that only when we scheduled in pdf format.
    anybody faced this issue before, any idea or resolution?
    Thanks in advance.
    Regards,
    Ganesh

    when I click on view latest instance, i am getting below error.
    The requested URL /BOE/portal/1503182223/CrystalReports/filename/CREnt_BICS_STS_Check.pdf was not found on this server
    but when see the path, I could see the path till /BOE/portal/1503182223/CrystalReports/
    is it remaining path, like the “file name” part generated at runtime?
    could you please support me, do we need changes required in tomcat?
    Regards,
    Ganesh

  • Extracting doc number information from dox saved in DMS

    Hello,
    I'm wanting to have a macro written that will put a document id into the
    footer of saved documents when the appropriate button is pushed.
    I know I can use the standard Word "Insert | Autotext | Header/Footer |
    Filename or Filename and path but when I do that, I get something like
    this:
    ::ODMAGRPWISEDOMAIN_AUS_DOM.POSTOFFICE_AUS_PO.Offi ce Administration:9055.1
    whereas the powers-that-be want something like this:
    OA:9055.1
    and nothing else. (The "OA" bit is the short version of Office
    Administration)
    I have a developer who thinks he may be able to pull this together, but he
    has posed this question:
    Is there a way to retrieve the profile information from Groupwise for a
    document that is currently open on screen?
    Using GW7, SP2 on NetWare 6.5, SP6.
    TIA,
    Catherine

    I think if you insert the filename with the option to include the path name,
    you will get the ODMA string with the doc number at the end (assuming the
    document has been saved and already has been assigned a doc number). Can
    you parse that somehow? I did this a long time ago in WP but not Word.
    Seems to me you should be able to record a macro to do that.
    "Catherine" <[email protected]> wrote in message
    news:D11Ri.13735$[email protected]. .
    > No, we can't get anything at the moment (unless we type it in the footer
    > of the document manually...using a keyboard.....ooh, manual labour!). We
    > can see what we want to get on the profile screen of a document's
    > properties when the document is open - but we don't know how to go about
    > getting that information so it can be plonked into the footer of a
    > document in Word. So the question is: Can you retrieve the profile
    > information from Groupwise for a document that is currently open on
    > screen?
    >
    > Confused? Yeah, me too!
    >
    > It's beginning to sound a bit too hard....
    >
    > Cheers,
    > Cat
    >
    >
    >
    > Dave Parkes wrote:
    >> I'm missing something here, you want
    >>
    >> OA:2870.1
    >>
    >> and you can get
    >>
    >> 2870-1.doc
    >>
    >> so, after juggling the current filename, you'd get what you want,
    >> wouldn't you ?
    >>
    >> Cheers Dave
    >>

  • How to find out SD billing doc # using accounting doc number ?

    Hi Experts,
    Using accounting doc tables such as BKPF , BSEG and BSID , I need to find out respective SD billing doc no when I have accounting doc number.
    The issue is I cannot use either 'reference number' or assignment number' because the same numbers are not flowing to accounting doc from SD ( enabled by a enhacement ).
    Regards
    Mahesh.

    Hi,
    In BKPF : AWKEY / XBLNR  with these fields we can identify the SD billing document number.
    In BSEG table VBELN field is Billing document number
    Or
    Goto T.Code FB03 enter the accounting document number,company code and fiscal year and press enter.
    select the line and choose details, choose addtional data tab, here we can see the billing document number.
    Regards,
    Chandrasekhar.S

  • Dashboard based on Crystal Report's Latest instances for the logged in user

    Hi,
    I am trying design a dashboard based on LiveOffice-crystal report's latest instance for the logged in user. Also there is row level security in the universe on which the crystal reports is created.
    In the live office connection i have selected 'latest instance by current user' in the refresh option and published the dashboard to InfoView.
    when i open the dashboard in InfoView , i find the row level restrictions being applied for different users. But the data retrived is always on-demand data and not based on the latest instance of the logged in users.
    Can anyone throw some light on this issue.
    Thanks

    Hi,
    I am trying design a dashboard based on LiveOffice-crystal report's latest instance for the logged in user. Also there is row level security in the universe on which the crystal reports is created.
    In the live office connection i have selected 'latest instance by current user' in the refresh option and published the dashboard to InfoView.
    when i open the dashboard in InfoView , i find the row level restrictions being applied for different users. But the data retrived is always on-demand data and not based on the latest instance of the logged in users.
    Can anyone throw some light on this issue.
    Thanks

  • How to hide the view latest instance option for the reports in XIR3

    Created an access level and denied the rights "view document instances" and "view document instances that the user owns" in the access level.
    Applied this access level for a particular group on a particular folder.
    Login to Infoview and when view the history,there are no instances for a particular report under that folder.
    But we could still see the 'View Latest instance' option in the properties of the report and when click on it,we are able to view the report.
    As per the security assigned,the user should only be able to view the instances owned by him.
    Plz help me how to hide the option in INFOVIEW

    In 9.3.1 (not sure about 9.2) there is a table in your BIPlus repository which stores preferences/profile information, however, having a user simply log in to WA doesn't appear to automatically create a row for them in this table. (So this may not be a viable solution to your situation, I'm still looking for one myself.) This table stores lots of preference info such as whether or not to show the Main Menu, Toolbar, Masthead, etc. by default.
    To hide the View Pane, edit the data in the SHOW_INFO_PANEL column, change it from a 1 to a 0 and for that user the View Pane will not longer appear by default.
    HYA_USER_PREFS
    But again, this only works if you already see the user in the table otherwise I guess maybe they have to 'touch' their Preference before it creates an entry in that table. Haven't figured that part out yet, and Support didn't have any information.
    If anyone has found a way to maneuver through the table structures I'd love to hear any insight you can offer.
    Before you make any changes to the data in this table be sure to take adequate repository backups, and use caution as usual.
    I'm going to create a Shared Preference and have each user point to it the first time they log in - but then you lose the ability for each user to have their own personal folder as their default, so it's still not the ideal solution. Really wish there was a way for Admins to set certain prefs. A coworker reminded me under 7.? or 6.x things like View Pane were system-level settings which was easy to control, but now it's at the user level.
    Good luck,
    Karen

  • ABAP-OO: Create any number of instances

    Hello,
    please, look at this simple scenario:
    DATA:
      my_class type ref to zcl_xyz.
      create object my_class.
    In that case I have just created one instance. Now I need a mechanism to create and identify any number of instance of the type zcl_xyz. <b>That means, I dont know exactly, if I need 5 or 200 instances.</b> Any feasible idea, how to handle that?
    Thanks and regards.

    Hi,
    Declare one static attribute in the class.
    Here is the sample code to trap the number of instance created for an object type.
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA CREATE_COUNT TYPE I.
        METHODS CONSTRUCTOR.
    ENDCLASS.
    DATA: O1 TYPE REF TO C1,
          O2 LIKE O1,
          O3 LIKE O1.
    CREATE OBJECT: O1,
                   O2,
                   O3.
    WRITE: 'Number of created objects:', C1=>CREATE_COUNT.
    CLASS C1 IMPLEMENTATION.
      METHOD CONSTRUCTOR.
        CREATE_COUNT = CREATE_COUNT + 1.
      ENDMETHOD.
    ENDCLASS.
    Hope this hint helps you.

  • Unable to view latest instance in BO Infoview XIR2

    Hi,
    I am unable to view latest instance in BO Infoview XIR2. Can any one please let me know general procedure to cross check in Infoview or Consol
    Thanks in Aadvance
    Regards
    Sweety

    Hi Sweety,
    What happens if you login as the Enterprise Adminstrator account,  do you get the option to View Latest Instance?
    - What do you mean exactly when you say you cannot view the latest instance? 
    - Are you missing the option/context menu or is the incorrect report displaying?
    I would suggest working with your Enterprise Administrator to ensure you have sufficient rights to View the latest instances.  However,  if you're not able to select the option check out this SAP Note:
    https://bosap-support.wdf.sap.corp/sap/support/notes/1202260
    Regards,
    Wallie

  • GL Line Items and PO Doc Number

    Hi, I'm caught in a world unknown to me, i.e. R/3 world.
    We are using 0FI_GL_4 and have a report called GL Detail.
    I have been asked to enhance the reports functionality to include a PO doc Number.
    I guess thats coming from MM side?
    We also have 2LIS_02_ITM in BW.
    My question, could I extend 0FI_GL_4 to include PO Doc Number? Or could I just have an InfoSet in BW to combine the Purhcasing Data ODS and GL ODS? I mean would it make functional and logical sense?
    Any guidance would be appreciated.
    Thanks,
    Frank

    Frank,
    I understand from your post that you want to have both Fi_Gl and PO combined information ? Am i right.
    I have recently implemented the same recently which is working fine.
    1. Enhance the Fi_Gl for Purchase doc , item and required.Since they originate from BSEG just add the fields to CI_BSIS structure.you will get the PO data.
    2. Now pull the purchase order item level data using 2lis_02_itm extractor.
    3.Pull FI_Gl_4 into one ODS say Fi_Gl_4
    4. Pull Purchasing data into PUR_t01
    5.Now enhance the communication structure of FI_Gl_4 with the purchasing order fields. i.e /BIC/CS8FI_GL_4 in the below code.
    6.Create an ODS with combined fields from purchasing and FI_Gl into another ODS.
    7.Create an Update rule from Fi_Gl_4 to the new ODS and in the update rule lookup the activate table of purchase order ODS and read the values into new ODS.
    8.For your reference i am attaching the start routine that i have written
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: ...
    TABLES : /BIC/APUR_T0200,
             /BIC/AFI_GL_400.
    DATA:   ...
    $$ end of global - insert your declaration only before this line   -
    The follow definition is new in the BW3.x
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CS8FI_GL_4.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
               MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
               DATA_PACKAGE STRUCTURE DATA_PACKAGE
      USING    RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries
      DATA: BEGIN OF DATA_PACK OCCURS 0.
              INCLUDE STRUCTURE /BIC/CS8FI_GL_4.
      DATA: END OF DATA_PACK.
      DATA:L_INDEX LIKE SY-TABIX,
           S_INDEX LIKE SY-TABIX,
           T_INDEX LIKE SY-TABIX,
           WA_VENDOR LIKE /BIC/APUR_T0200-VENDOR.
      DATA : BEGIN OF IT_PURCHASE OCCURS 0,
               /BIC/ZPUR_DOC    LIKE /BIC/APUR_T0200-DOC_NUM,
               /BIC/ZPUR_ITM    LIKE /BIC/APUR_T0200-/BIC/ZPUR_ITM,
               VENDOR           LIKE /BIC/APUR_T0200-VENDOR,
               MATERIAL         LIKE /BIC/APUR_T0200-MATERIAL,
               MATL_GROUP       LIKE /BIC/APUR_T0200-MATL_GROUP,
               PURCH_ORG        LIKE /BIC/APUR_T0200-PURCH_ORG,
               PUR_GROUP        LIKE /BIC/APUR_T0200-PUR_GROUP,
               DOCTYPE          LIKE /BIC/APUR_T0200-DOCTYPE,
               DOC_CAT          LIKE /BIC/APUR_T0200-DOC_CAT,
               /BIC/ZKNTTP       LIKE /BIC/APUR_T0200-/BIC/ZKNTTP,
             END OF IT_PURCHASE.
      RANGES: R_BLART   FOR /BIC/CS8FI_GL_4-AC_DOC_TYP.
    Fill in the Accounting Document Type
      R_BLART-SIGN = 'I'.
      R_BLART-OPTION = 'EQ'.
      R_BLART-LOW = 'KG'.
      APPEND R_BLART.
      R_BLART-SIGN = 'I'.
      R_BLART-OPTION = 'EQ'.
      R_BLART-LOW = 'KR'.
      APPEND R_BLART.
      R_BLART-SIGN = 'I'.
      R_BLART-OPTION = 'EQ'.
      R_BLART-LOW = 'RE'.
      APPEND R_BLART.
      CLEAR L_INDEX.
      REFRESH DATA_PACK.
      DATA_PACK[] = DATA_PACKAGE[].
    Consider only if acc doc type is RE KG and KR
      LOOP AT DATA_PACK.
        L_INDEX = SY-TABIX.
        IF DATA_PACK-AC_DOC_TYP IN R_BLART.
          CONTINUE.
        ELSE.
          DELETE DATA_PACK INDEX L_INDEX.
        ENDIF.
      ENDLOOP.
      CLEAR S_INDEX.
    Consider only if account  type S
      LOOP AT DATA_PACK.
        S_INDEX = SY-TABIX.
        IF DATA_PACK-ACCT_TYPE  EQ 'S'.
          CONTINUE.
        ELSE.
          DELETE DATA_PACK INDEX S_INDEX.
        ENDIF.
      ENDLOOP.
      SELECT DOC_NUM /BIC/ZPUR_ITM VENDOR MATERIAL MATL_GROUP
               PURCH_ORG PUR_GROUP DOCTYPE DOC_CAT
               /BIC/ZKNTTP
               FROM /BIC/APUR_T0200
               INTO TABLE IT_PURCHASE
               FOR ALL ENTRIES IN DATA_PACK
               WHERE DOC_NUM       = DATA_PACK-/BIC/ZPUR_DOC
                 AND /BIC/ZPUR_ITM = DATA_PACK-/BIC/ZPUR_ITM.
      SORT IT_PURCHASE BY /BIC/ZPUR_DOC /BIC/ZPUR_ITM.
      LOOP AT DATA_PACK.
        T_INDEX = SY-TABIX.
        IF DATA_PACK-VENDOR IS INITIAL.
          SELECT SINGLE VENDOR INTO WA_VENDOR
                 FROM /BIC/AFI_GL_400
                 WHERE COMP_CODE = DATA_PACK-COMP_CODE
                 AND   AC_DOC_NO = DATA_PACK-AC_DOC_NO
                 AND   FISCPER   = DATA_PACK-FISCPER
                 AND   FISCVARNT = DATA_PACK-FISCVARNT
                 AND   ACCT_TYPE  EQ 'K'.
          IF SY-SUBRC EQ 0.
            MOVE WA_VENDOR TO DATA_PACK-VENDOR.
            MODIFY DATA_PACK INDEX T_INDEX.
            CLEAR WA_VENDOR.
          ENDIF.
        ENDIF.
        IF DATA_PACK-/BIC/ZPUR_DOC IS INITIAL.
          CONTINUE.
        ELSE.
    READ TABLE IT_PURCHASE WITH KEY /BIC/ZPUR_DOC = DATA_PACK-/BIC/ZPUR_DOC
                                   /BIC/ZPUR_ITM = DATA_PACK-/BIC/ZPUR_ITM
                                   BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            MOVE:  IT_PURCHASE-MATERIAL    TO DATA_PACK-MATERIAL,
                   IT_PURCHASE-MATL_GROUP  TO DATA_PACK-MATL_GROUP,
                   IT_PURCHASE-PURCH_ORG   TO DATA_PACK-PURCH_ORG,
                   IT_PURCHASE-PUR_GROUP   TO DATA_PACK-PUR_GROUP,
                   IT_PURCHASE-DOCTYPE     TO DATA_PACK-DOCTYPE,
                   IT_PURCHASE-DOC_CAT     TO DATA_PACK-DOC_CAT,
                   IT_PURCHASE-/BIC/ZKNTTP TO DATA_PACK-/BIC/ZKNTTP.
            IF DATA_PACK-VENDOR IS INITIAL.
              MOVE IT_PURCHASE-VENDOR TO DATA_PACK-VENDOR.
            ENDIF.
            MODIFY DATA_PACK TRANSPORTING VENDOR MATERIAL MATL_GROUP
                                          PURCH_ORG PUR_GROUP DOCTYPE
                                          DOC_CAT /BIC/ZKNTTP.
          ENDIF.
        ENDIF.
      ENDLOOP.
      REFRESH DATA_PACKAGE.
      DATA_PACKAGE[] = DATA_PACK[].
      FREE : DATA_PACK , IT_PURCHASE.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.
    if you have any other isues do let me know.
    Regards
    Sundaresan
    Message was edited by: sundaresan chander
    Message was edited by: sundaresan chander

  • Restrict selection from LDB 'DDF' based on FI Doc number(BELNR)?

    Hi all,
    I am trying to restrict selection from LDB 'DDF' based on FI Doc number(BELNR).
    Even if i pass only one document number in selection-screen, the program is still printing lot of documents?
    Where I am going wrong?
    *& Report  ZSUB_READ_LDB
    REPORT  ZSUB_READ_LDB.
    DATA wa_BSEG TYPE BSEG.
    SELECT-OPTIONS s_BELNR FOR wa_BSEG-BELNR.
    DATA: callback TYPE TABLE OF ldbcb,
    callback_wa LIKE LINE OF callback.
    DATA: seltab TYPE TABLE OF rsparams,
    seltab_wa LIKE LINE OF seltab.
    callback_wa-ldbnode = 'BSEG'.
    callback_wa-get = 'X'.
    callback_wa-get_late = 'X'.
    callback_wa-cb_prog = sy-repid.
    callback_wa-cb_form = 'CALLBACK_BSEG'.
    APPEND callback_wa TO callback.
    CLEAR callback_wa.
    seltab_wa-kind = 'S'.
    seltab_wa-selname = 'BELNR'.
    LOOP AT s_BELNR.
      MOVE-CORRESPONDING s_BELNR TO seltab_wa.
      APPEND seltab_wa TO seltab.
    ENDLOOP.
    CALL FUNCTION 'LDB_PROCESS'
      EXPORTING
        ldbname                     = 'DDF'
        variant                     = ' '
      TABLES
        callback                    = callback
        selections                  = seltab
      EXCEPTIONS
        ldb_not_reentrant           = 1
        ldb_incorrect               = 2
        ldb_already_running         = 3
        ldb_error                   = 4
        ldb_selections_error        = 5
        ldb_selections_not_accepted = 6
        variant_not_existent        = 7
        variant_obsolete            = 8
        variant_error               = 9
        free_selections_error       = 10
        callback_no_event           = 11
        callback_node_duplicate     = 12
        OTHERS                      = 13.
    IF sy-subrc ne 0.
      WRITE: 'Exception with SY-SUBRC', sy-subrc.
    ENDIF.
    *&      Form  CALLBACK_BSEG
          text
         -->NAME       text
         -->WA         text
         -->EVT        text
         -->CHECK      text
    FORM CALLBACK_BSEG USING name TYPE ldbn-ldbnode
    wa TYPE BSEG
    evt TYPE c
    check TYPE c.
      CASE evt.
        WHEN 'G'.
          WRITE: / wa-BELNR.
          ULINE.
        WHEN 'L'.
          ULINE.
      ENDCASE.
    ENDFORM.                    "CALLBACK_BSEG

    Hi Andreas,
    I have included bukrs and gjahr too...but if I input only one invoice number the report is printing a lot of invoices.
    Not sure from where the data is being picked up?
    Sorry of poor formatting of code.
    Thanks ,
    Subba
    *& Report  ZSUB_READ_LDB
    REPORT  ZSUB_READ_LDB.
    TYPE-POOLS: RSDS, RSFS.
    DATA wa_BSEG TYPE BSEG.
    SELECT-OPTIONS s_BELNR FOR wa_BSEG-BELNR.
    SELECT-OPTIONS s_BUKRS FOR wa_BSEG-BELNR.
    SELECT-OPTIONS s_GJAHR FOR wa_BSEG-BELNR.
    DATA: callback TYPE TABLE OF ldbcb,
    callback_wa LIKE LINE OF callback.
    DATA: seltab TYPE TABLE OF rsparams,
    seltab_wa LIKE LINE OF seltab.
    DATA: TEXPR TYPE RSDS_TEXPR,
    FSEL TYPE RSFS_FIELDS.
    start-of-selection.
      callback_wa-ldbnode = 'BSEG'.
      callback_wa-get = 'X'.
    callback_wa-get_late = 'X'.
      callback_wa-cb_prog = sy-repid.
      callback_wa-cb_form = 'CALLBACK_BSEG'.
      APPEND callback_wa TO callback.
      CLEAR callback_wa.
      seltab_wa-kind = 'S'.
      seltab_wa-selname = 'BELNR'.
    *seltab_wa-LOW =
      LOOP AT s_BELNR.
        MOVE-CORRESPONDING s_BELNR TO seltab_wa.
        APPEND seltab_wa TO seltab.
      ENDLOOP.
      seltab_wa-kind = 'S'.
      seltab_wa-selname = 'BUKRS'.
    *seltab_wa-LOW =
      LOOP AT s_BELNR.
        MOVE-CORRESPONDING s_BUKRS TO seltab_wa.
        APPEND seltab_wa TO seltab.
      ENDLOOP.
      seltab_wa-kind = 'S'.
      seltab_wa-selname = 'GJAHR'.
    *seltab_wa-LOW =
      LOOP AT s_BELNR.
        MOVE-CORRESPONDING s_GJAHR TO seltab_wa.
        APPEND seltab_wa TO seltab.
      ENDLOOP.
      CALL FUNCTION 'LDB_PROCESS'
        EXPORTING
          ldbname                     = 'DDF'
          variant                     = ' '
          EXPRESSIONS                 = TEXPR
          FIELD_SELECTION             = FSEL
        TABLES
          callback                    = callback
          selections                  = seltab
        EXCEPTIONS
          ldb_not_reentrant           = 1
          ldb_incorrect               = 2
          ldb_already_running         = 3
          ldb_error                   = 4
          ldb_selections_error        = 5
          ldb_selections_not_accepted = 6
          variant_not_existent        = 7
          variant_obsolete            = 8
          variant_error               = 9
          free_selections_error       = 10
          callback_no_event           = 11
          callback_node_duplicate     = 12
          OTHERS                      = 13.
      IF sy-subrc ne 0.
        WRITE: 'Exception with SY-SUBRC', sy-subrc.
      ENDIF.
    *&      Form  CALLBACK_BSEG
          text
         -->NAME       text
         -->WA         text
         -->EVT        text
         -->CHECK      text
    FORM CALLBACK_BSEG USING name TYPE ldbn-ldbnode
    wa TYPE BSEG
    evt TYPE c
    check TYPE c.
      CASE evt.
        WHEN 'G'.
          WRITE: / wa-BELNR.
          ULINE.
        WHEN 'L'.
          ULINE.
      ENDCASE.
    ENDFORM.                    "CALLBACK_BSEG

Maybe you are looking for