Skip to Content
avatar image
Former Member

logic for WBS ELEMENT

hi

i have an issue in the report, the problem is

in the selection screen i have an WBS ELEMENT as an select option(there is no belnr in selection scrren)

for eg- if i enter

COMP CODE = 0010

WBS ELEMNT = 23456

YEAR = 2008.

For the above details there are 2 line items in table for that particular belnr as

BUKRS BELNR YEAR BUZEI WBSELT SHKZG

0010 40000050 2008 001 23456 S

0010 40000050 2008 002 00000 H

there is only one line item for WBS ELEMENT IN BSEG TABLE.

So i am getting debit(SHKZG-S) value but i am not getting credit value if i write the select query as below.

SELECT bukrs

belnr

gjahr

buzei

sgtxt

kostl

aufnr

lifnr

ebeln

projk

FROM bseg

into table gt_bseg

for all entries in i_get

where bukrs eq i_get-bukrs

and belnr eq i_get-belnr

and gjahr eq i_get-ryear

and buzei eq i_get-buzei

and projk in s_projk.

please help how to get both values.help with code

thanks in advance,

one of the friend from SDN gave the following solution to my problem

but here he kept KOART = D, WHEREAS FOR MY CODE OTHERLINEITEM MISSED WOULD BE CREDIT OR DEBIT ONCE IT MAY BE MISSED THE CREDIT LINEITEM OR DEBIT ONE.

LOOP AT GT_BSEG.

select single BELNR KOART WRBTR PROJK FROM BSEG INTO wa_bseg WHERE BELNR = BSEG-BELNR AND KOART = 'D'.

append the values of wa_bseg to it_bseg.

endloop.

i have faced same problem if u observe the table BSEG if KOART value is D , in that line item you cant get the PROJK value so

from above select statemnt u can retrieve that value

finally in it_bseg u can get the lineitems which are emitted by your select query

PLEASE HELP ME

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 20, 2008 at 09:22 AM

    hi,

    I think you don't need to put all the conditions mentioned by you in the Query, it would be sufficient to put only the primary key fields of BSEG, so the Query should be like....

    SELECT bukrs

    belnr

    gjahr

    buzei

    SHKZG

    sgtxt

    kostl

    aufnr

    lifnr

    ebeln

    projk

    FROM bseg

    into table gt_bseg

    for all entries in i_get

    where bukrs eq i_get-bukrs

    and belnr eq i_get-belnr

    and gjahr eq i_get-ryear

    and buzei eq i_get-buzei.

    (****include only PK fields in where condition)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 09:39 AM

    >

    > hi

    >

    > i have an issue in the report, the problem is

    > in the selection screen i have an WBS ELEMENT as an select option(there is no belnr in selection scrren)

    > for eg- if i enter

    > COMP CODE = 0010

    > WBS ELEMNT = 23456

    > YEAR = 2008.

    >

    If you're trying to select from BSEG using only these selection criteria, then your query is likely to be very, very slow. Since BSEG is a cluster table and therefore only the key is used for the query, you need to specifiy at least BUKRS and BELNR to get any sort of decent performance.

    If I wanted to select using WBS element (or any controlling object) my starting point would be the Controlling tables COEP and COBK, or COVP which is a view of the two; after all, the Controlling tables were set up specifically to deal with this sort of query.

    Once you've picked up the line you want with your WBS element selection, you can get any of the other lines on the document by selecting from BSEG using the reference document fields held in the Controlling tables.

    Add comment
    10|10000 characters needed characters exceeded