cancel
Showing results for 
Search instead for 
Did you mean: 

Settlement doc number & wbs element relationship table

Former Member
0 Kudos

Hello,

I am trying to find any tables which can help me get the settlement doc number and wbs element relationship. Presently I am using table AUAA and here is my select for that:

SELECT belnr aufnr pspnr anln1 coobjnr FROM auaa INTO TABLE tab_auaa

WHERE emtyp = 'PR'

AND bukrs IN p_bukrs

AND kokrs IN p_kokrs.

since I do not have "belnr"(the primary key) it is taking too long to get this info.....any one has any idea of any other tables to get this information or a bapi?

appreciate the help

AS

Accepted Solutions (1)

Accepted Solutions (1)

former_member203108
Active Contributor
0 Kudos

Hi,

I think you want to pull the settlement doc number for a particular project, right? In that case why cant you pass the PSPNR into AUAA, rather than just passing EMTYP = 'PR', because if you just pass EMTYP='PR' system will filter AUAA based on 'PR' and it will read all the data's of all the project, that is why it is taking long time.

If you want to know all the PSPNR for a particular project, then pass project number (PROJ-PSPID) into PRHI-PSPHI, and collect PRHI-POSNR, then input this PRHI-POSNR into AUAA-PSPNR, now it will list all the settlement document(BELNR) only for that particular project.

Former Member
0 Kudos

Hi Ahmed,

thanks for replying....well what i am trying to do is write a report on an AUC costs....now user will provide the AUC number or the wbs which is settling to an AUC....I need to find all the settlements for that AUC to get all the costs associated with this particular AUC....

to get all the wbs elements under an AUC...I had sort of same logic as you described above(but not for the whole project..since it is not required)...but since it was inside the loop(inside the loop since need to navigate through these settlements and find the wbses until hit the internal orders)...it was not performing well....so i took out the select from loop and try to get all the settlement first which are associated with wbses into an internal table....because i would not know before hand if all the project is contributing to the cost of this AUC or just some wbses, inside the project, are settling to this AUC....if i can find a trasnparent table than i can create an index of my choice and get all that information quickely...

do you know if system writes these settlement doc number with wbses when we settle a wbs to AUC or an internal order to a wbs element...

appreciate help very much....

AS...

Former Member
0 Kudos

Hello,

any help on this will be greatly appreciated....

thanks...

AS...

former_member203108
Active Contributor
0 Kudos

Hi,

To get all the cost posted to the AUC, you can use table ANEP(Asset line item), enter with AUC number and companycode you will get all the cost posted to that AUC with their document number(BELNR)...

You can also use ANEK(Docuemnt header posted to Asset), enter with AUC number and set the business transaction(GLVOR) as KOAE(settlement), by setting KOAE to GLVOR, you will filter the data related to settlement.

Former Member
0 Kudos

Hi,

my report has to show all the wbses and internal orders contributing to the cost of an AUC, the closest table I got beside the AUAA is the AUAK which gives the settlement doc number for wbses and AUFK which gives me the internal order and wbs relationship...using this relationship I tried to get the belnr for the internal orders....but for some reason, I miss out close to 50% of the settlements....

so I am stuck with AUAA table which has the complete set of settlement documents for me...I can navigate through these settlements find all the wbses....which are of concern...since an AUC does not necessarily involved the whole project....

The whole point for me is to get all the settlement doc numbers for, say the whole project....but when I pass even the whole project...to AUAA....it takes very long time in production (more than 22 seconds, we have right now only 600000 entries in AUAA).

so that is we stand..

Appreciate the help very much....any input would be great on this....

AS

Note: is there any bapi or a table which can tell us how many settlement doc number (BELNR) are associated with an WBS?

Former Member
0 Kudos

Hi.

I'm making a change spec for a report that gives all the settlements of a project, excluding the AuC, im using the next tables:

COVP

COBRB

COEPBR

If you filter COVP you need to indicate field LEDNR='00' and VERSN='0' to obtain better performance. This table COVP gives all the documents that are afecting to a Object number and you can identify the settlement documents with field BEKNZ='O'

Best Regards...

Former Member
0 Kudos

Hi all,

thanks for all the help and support on this...I found a way to get all the CO settlement doc numbers for a project and their relationship as sender and receiver.....

first i went to anla and anek to get the AUC and the wbs settling to this AUC relatiionship...once i got my main wbs element...i found all the wbses for this project.

I need to use the table AUAK, AUFK, and AUAA to get all that information. I got all my wbses for a project first....than I went to table AUAK with all these wbses...and found the belnr(settlement doc numbers)....this table does not give out complete settlement doc numbers for wbses....we need to go back to AUAK with the internal orders to get the belnrs for them as well....so to get all the internal orders for a project i went to AUFK....than i took these orders and went back AUAK with these orders and got my missing belnrs....

now I had all my belnrs for a project....so i went to table AUAA and did the select with these belnr...and since now i have the primary key the access is lighting fast....by doing that select i got all my relationship, i mean which settlement is goind where...

mind you that I used AUAS to get the sender/receiver relationship with the amount....this is as well a cluster table but we have the primary key belnr(co settlement doc. numbers)...so no worries to get the data here as well....

here are my selects for AUAK, AUFK and AUAA....

TYPES: BEGIN OF prps_ty,
        psphi TYPE prps-psphi,
        END OF prps_ty.

        DATA all_proj TYPE STANDARD TABLE OF prps_ty.
        DATA wa_all_proj TYPE prps_ty.


TYPES: BEGIN OF objnr_ty,
           objnr TYPE auak-objnr,
           END OF objnr_ty.
DATA lo_p_psp TYPE STANDARD TABLE OF objnr_ty.

IF all_proj IS NOT INITIAL.

          SELECT objnr FROM prps INTO TABLE lo_p_psp FOR ALL ENTRIES IN all_proj
          WHERE
          psphi = all_proj-psphi.

        ENDIF.

IF lo_p_psp IS NOT INITIAL.

          SELECT belnr objnr FROM auak INTO TABLE tab_auak FOR ALL ENTRIES IN lo_p_psp
          WHERE
          kokrs IN p_kokrs
          AND gjahr IN p_gjahr
          AND objnr = lo_p_psp-objnr
*        AND objnr LIKE 'PR%'.

        SORT tab_auak BY belnr.
        DELETE ADJACENT DUPLICATES FROM tab_auak COMPARING belnr.


 SELECT aufnr objnr pspel FROM aufk INTO TABLE tab_aufk FOR ALL ENTRIES IN lo_p_psp
          WHERE
          bukrs IN p_bukrs
          AND kokrs IN p_kokrs
          AND pspel = lo_p_psp-objnr.
        ENDIF.

*get the belnrs for orders---this part is very important or we miss out all the belnrs for I/O...
        IF tab_aufk IS NOT INITIAL.
          SELECT belnr objnr FROM auak INTO TABLE tab_auak2
          FOR ALL ENTRIES IN tab_aufk
          WHERE
          kokrs IN p_kokrs
          AND gjahr IN p_gjahr
          AND objnr = tab_aufk-objnr.

        ENDIF.
*append these new belnrs to tab_auak
        LOOP AT tab_auak2 INTO wa_tab_auak2.
*              CONCATENATE 'PR' wa_tab_aufk-pspel INTO wa_tab_auak2-objnr.
          APPEND wa_tab_auak2 TO tab_auak.
        ENDLOOP.

        SORT tab_auak. "by belnr.
        DELETE ADJACENT DUPLICATES FROM tab_auak.

*now get all the belnrs for this project...complete list....

        IF tab_auak IS NOT INITIAL.
          SELECT belnr aufnr pspnr anln1 coobjnr FROM auaa INTO TABLE tab_auaa
                   FOR ALL ENTRIES IN tab_auak
*            WHERE pspnr = wa_wbs-posnr
                                 WHERE
                                 belnr = tab_auak-belnr
                                 AND emtyp = 'PR'
                                 AND bukrs IN p_bukrs
                                 AND kokrs IN p_kokrs.


        ENDIF.

        SORT tab_auaa BY pspnr belnr.

I used our own indexes for all the transparent table accesses.... to speed up the process...you might want to create your own indexes depending on the where clauses for transparent tables.....

well thanks again..and hope all this will help someone else too....

AS...

Edited by: J Are on Oct 31, 2009 1:19 PM

Former Member
0 Kudos

Thanks

Answers (1)

Answers (1)

Former Member
0 Kudos

You can check if the Assignment field in FI document has the WBS-code.

Also the good practice is to have a designated document type assigned in the settlement profile, so that you will look just for the settlement documents.

Former Member
0 Kudos

Hello,

{You can check if the Assignment field in FI document has the WBS-code.

Also the good practice is to have a designated document type assigned in the settlement profile, so that you will look just for the settlement documents.}

can you pls explain a little bit more...what table what field are you mentioning here...

Appreciate answer very much....

AS

Former Member
0 Kudos

Hello,

do we have any replacement for table AUAA in SAP....I mean is there any othe table which can give me the same information....I am looking for settlement document numbers in a project? I know there is another table AUAK...but it does not give me complete set of settlemnet documents for a project...any ideas?

appreciate the help...

AS.