cancel
Showing results for 
Search instead for 
Did you mean: 

fuba/BAPI for line items of PM order

0 Kudos

Hi,

i need to write a Report that includes costs of PM orders. I need to see all line items for a specific ordernr (e.g from posting confirmations). I can see the line items in table COEP. But as I do not know the number of the FI document (belnr) performance is pretty bad. Is there a fuba or bapi that can determine the line items? When i run KOB1 it is fast. But in Debugging I did not find the way how KOB1 selects the data from DB. Any Ideas?

Accepted Solutions (0)

Answers (3)

Answers (3)

raymond_giuseppi
Active Contributor

KOB1 doesn't read FI document, it read CO documents (COBK/COEP, often view COVP) with OBJNR criteria (and a harcoded LEDNR = '00' for performance) then navigation is available to CO or original document (look at FM K_DOCUMENT_ACTUAL/COMMITMENT_CALL, set i_flg_sender to navigate to original document)

peter_atkin
Active Contributor

Andreas,

Our ABAPers did it this way by calling the program, then grabing the data from memory before its displayed :

SUBMIT rkaep000
USING SELECTION-SCREEN 0100
WITH p_kokrs =
WITH kostl =
WITH r_budat =
WITH p_fixvar = abap_false
WITH p_usegrd = abap_true
WITH p_maxsel = '99999999'
WITH p_disvar =
WITH p_tcode = 'KSB1N' <<<<<----- Try KOB1 instead
WITH p_hana = abap_true
WITH p_tree = abap_false
WITH p_imout = abap_true
WITH p_grobj = abap_true
EXPORTING LIST TO MEMORY
AND RETURN.

Then grab the data from the class:

TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lr_data ).
ASSIGN lr_data->* TO <lfs_data>.
IF <lfs_data> IS ASSIGNED.
et_cost_table = <lfs_data>.
ENDIF.
CATCH cx_salv_bs_sc_runtime_info.
RAISE EXCEPTION TYPE zi_pmcosts
EXPORTING
textid = zcx_pmcosts=>fetch_co_data_failed.
ENDTRY.

-------------------------

If you are using HANA, then you could also look at the following Calculation Views:

  • MaintenanceOrderCostQuery - shows the FICO posings including settlement
  • MaintenanceOrderHeaderAndCosts
  • MainOrderHeaderPlndAndActl

https://help.sap.com/saphelp_hba/helpdata/en/27/580c16d28147f081c9af4d3e524b50/frameset.htm

PeteA

NTeunckens
Active Contributor
0 Kudos

Please check FM "K_LINE_ITEMS_SELECT" which is called in trx."KOB1". Set up Debugging when executing the transaction ...


Kind regards

Nic T.