Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

VBAK selection

Former Member
0 Likes
1,268

Hi all,

Need your advice on VBAK selection where my requirement of program just having field ERDAT (doc creation date) as selection. In my system even ERDAT is stated as one of the secondary index but it is marked as "No database index". Hence it resulting a long runtime by using ERDAT for VBAK selection.

Please comment that how can i solve the problem.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,223

Hi,

You can try for Document type with the created date field.

-Maharshi

10 REPLIES 10
Read only

Former Member
0 Likes
1,223

Hello ABC,

Selection by ONLY date is very expensive and cause performance issues for the report. Can you please tell me the business requirement for this report, maybe you can include other fields too!

Regrads

Vijai

Read only

0 Likes
1,223

Hi Vijay,

Thanks for your reply. The business requirement is like this:

The selected Sales order number will have to further trace the document flow to get the Purchase order and Invoice's info. Source is coming from SD.

And Sales order creation date is the only input user need.

Pls comment.

Read only

0 Likes
1,223

Hi,

Your requirement is still not completely clear to me.

I had a similar type of scenario (if i am getting it right)..i used the document type....

check the code :


*&---------------------------------------------------------------------*
*& Form  SUB_GET_VBFA
*&---------------------------------------------------------------------*
*  Fetching Preceding Document and Subsequent Document.
*----------------------------------------------------------------------*
    FORM sub_get_vbfa .
*     Check for INITIAL
*    -------------------
      IF NOT git_lips_temp[] IS INITIAL.

        SELECT vbeln                                                     "Subsequent Sales and Distribution Document
               vbelv                                                     "Preceding Sales and Distribution Document
               vbtyp_n                                                   "Document Category of Subsequent Document
               vbtyp_v                                                   "Document category of Preceding SD document
               FROM vbfa
               INTO TABLE git_vbfa
               FOR ALL ENTRIES IN git_lips_temp
               WHERE vbeln = git_lips_temp-vbeln
               AND ( vbtyp_v = gc_order OR vbtyp_n = gc_delivery ).      "vbtyp_v = C and vbtyp_n = J

        IF sy-subrc EQ 0 .
          SORT git_vbfa BY vbeln.
        ENDIF .

*     To get all Invoices
*     --------------------
        SELECT vbeln                                                     "Subsequent Sales and Distribution Document
               vbelv                                                     "Preceding Sales and Distribution Document
               vbtyp_n                                                   "Document Category of Subsequent Document
               vbtyp_v                                                   "Document category of Preceding SD document
               FROM vbfa
               INTO TABLE git_vbfainv
               FOR ALL ENTRIES IN git_lips_temp
               WHERE vbelv = git_lips_temp-vbeln
               AND ( vbtyp_v = gc_delivery and vbtyp_n = gc_invoice ).   "vbtyp_v = C and vbtyp_n = M

        IF sy-subrc EQ 0 .
          SORT git_vbfainv BY vbelv.
        ENDIF .

      ENDIF.
    ENDFORM.                    " SUB_GET_VBFA

*&---------------------------------------------------------------------*
*& Form  SUB_GET_VBPA
*&---------------------------------------------------------------------*
*  For getting the Customer Number 1 details which inturn would be used
*  for fetching the relevant Customer Name in the next step.
*----------------------------------------------------------------------*
    FORM sub_get_vbpa .
*    Local Declaration:
*    ------------------
      DATA: lit_vbfa TYPE STANDARD TABLE OF gty_vbfa.

*     Check for INITIAL
*    -------------------
      IF NOT git_vbfa[] IS INITIAL.

*       Passing the Value to Local Internal Table
*      -------------------------------------------
        lit_vbfa[] =  git_vbfa[].

        SORT lit_vbfa[] BY vbelv.

*       Removing the Duplicate Entries
*      --------------------------------
        DELETE ADJACENT DUPLICATES FROM lit_vbfa COMPARING vbelv.

        SELECT vbeln                                                     "Sales and Distribution Document Number
               kunnr                                                     "Customer Number
               FROM vbpa
               INTO TABLE git_vbpa
               FOR ALL ENTRIES IN lit_vbfa
               WHERE  vbeln = lit_vbfa-vbelv AND
                      parvw = gc_sold_to_party .                         "parvw = AG

        IF sy-subrc = 0.
          SORT git_vbpa BY vbeln.
        ENDIF.
*       Clearing the Local Internal Table
*      ----------------------------------
        Refresh: lit_vbfa[].

      ENDIF.
    ENDFORM.                    " SUB_GET_VBPA

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 3:21 PM

Read only

0 Likes
1,223

Hi Vijay,

Thanks for your reply. The business requirement is like this:

The selected Sales order number will have to further trace the document flow to get the Purchase order and Invoice's info. Source is coming from SD.

And Sales order creation date is the only input user need.

Pls comment.

Read only

0 Likes
1,223

HI Anubhav Duttagupta,

My selection is on table VBAK but not VBFA. Please comment.

Read only

0 Likes
1,223

Hi ,

You can make Your own Secondry index in vbak table include erdat vbeln auart it will make your database

access faster .

regards

digvijay rai

Read only

0 Likes
1,223

Hi Rai,

Thanks for your reply, however we are not allow to request for the secondary index creation as our curren VBAK having 6 secondary indexes. Where it has reached the max allowed.

Please comment again if there is anywhere that i can do better on the program coding.

Thanks in advance.

Read only

Former Member
0 Likes
1,223

Hi

Can u please give the query you have used

regards

prashant

Read only

Former Member
0 Likes
1,223

Using only ERDAT will cause serious performance issue and a long run time as it will fetch huge number of records.

There should be some other selection criteria in addition to ERDAT for further filteration.

Read only

Former Member
0 Likes
1,224

Hi,

You can try for Document type with the created date field.

-Maharshi