Application Development 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: 

MIRO question - detail lines of a purchaising document

lauraquinterosa
Participant
0 Kudos

Hi all,

I'm doing a batch input to transaction MIRO, i'd like to know how to get the lines for the detail lines of a purchasing document at table-level in the grid for purchasing docs because i need to do some other things with that data before ending my batch input.

How SAP calculates what it shows there, because sometimes shows less lines than the ones in the tables. Which criteria uses to summarize them? i´m seeing tables ekbe and ekbe, probably missing other tables...

Thanks in advance!

Laura

Message was edited by: Laura Quinteros

9 REPLIES 9

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Laura,

save time for guessing number of table lines in MIRO. Use instead BAPI_INCOMINGINVOICE_SAVE, it's very well documented.

Also Bapis BAPI_INCOMINGINVOICE_CREATE, BAPI_INCOMINGINVOICE_GETDETAIL, BAPI_INCOMINGINVOICE_RELEASE might help you to change values.

..._SAVE looks more like transaction MIRA, ..._CREATE seems to have more functionalities.

This might not be the answer you like to have, but batch input on multiple tab strips and table controls needs a lot of fine tuning to handle all exeption cases.

Regards,

Christian

0 Kudos

Hi Laura,

It´s too dificult to make what you want in a bathinput with MIRO, use a BAPI as say christan or take the old MIRO (MB01) or the better one as clasical transaction.

Cheers,

Chiquito.

0 Kudos

Ok, I'll give BAPIs a try.

Thanks a lot! I'll let you know what happened.

Regards,

Laura

0 Kudos

Hi Christian,

I think I'll probably use BAPI_INCOMINGINVOICE_CREATE because i need to generate a new invoice...but i till don't know if it'll serve to put the amount (INVFO-WRBTR) correctly... do you have any documentation for this BAPI?

Another thing, i've tried to get the value i need (RM08M-DIFFERENZ) from the MIRO in a field exit for WRBTR using field symbols or GET_DYNP_VALUE but they don't seem to work... the function gives a dump because of the format number, and the field symbols is never assigned...do you know why it could be happening this? And i can't find a proper user exit to get this value and put it back where i need it...

Thanks in advance!

Regards,

Laura

0 Kudos

Hi Laura!

Help on BAPI_INCOMINGINVOICE_CREATE: first of all of course the 25 pages of documentation of this FM in SE37. Also structures are documented and in transaction BAPI->MM->Invoice (or something like this) you will find HTML-style docu of this function (but same content).

INVFO-WRBTR is translated to header data GROSS_AMOUNT and part of the first example - and correct handling of net amount / gross amount should be the very basic functionality. If case of problems, pricing procedure might be first thing to blame.

I guess, CALC_TAX_IND will handle your problem of getting correct gross value. Just enter your net amount and flag this field with X. But there are several scenarios described, one should match your requirement without reading results out of MIRO fields. One way: you get your tax amount of calculation in PO.

GET_DYNP_VALUE: yep, often used function DYNP_VALUES_READ, but this is years ago (what is your release?) If get_dynp_value makes trouble, dynp_values_read brings no difference, call 'HELP_GET_FIELDS' directly!

But this approach won't work with BAPI. Field exits are only executed for displayed input fields (field, which is only in display mode does not trigger for field exits!). And with BAPI, you don't show any field...

But there is one BADI (SE18) INVOICE_UPDATE with three promissing methods, I would give CHANGE_AT_SAVE a chance.

If no exit will do the job, you might do a 2-step scenario: create unchanged doc, read DIFFERENZ from database (by BAPI), change doc (2 steps because of two bookings).

It's possible to accept (rounding) differences. Wouldn't this be the correct process handling? You wouldn't eleminate all differences immediately, you don't want to hard-code all acceptence-level-rules in a field-exit or BAPI-program... Looks more like a discussing point with functional consultants than searching good user-exit.

It is possible with correct pricing procedure (to get correct tax handling and complete condition (price and costs) information) and account assigment to get only small rounding differences (not each systems handles tax so correct like SAP, calculated on header sums and re-distribution). Prices differences can be adjusted by insertion of item value... I just have the feeling, your process requirement / solution is little bit strange (but maybe just exceptional).

Regards,

Christian

0 Kudos

Hi Christian,

i'll tell you how exactly what is my process requirement because i'm getting a little bit dizzy with all this info:

first i have to select all purchasing orders with the EKPO-EREKZ marked, and pass that data to the batch input or the BAPI or the BADI. My question is, if with the current purchasing order/position in MIRO the DIFFERENZ is calculated, can i pass that value to WRBTR in one step with let's say the correct BAPI or BADI?

Or there should i consider what you said: a 2-step process?

I´m seeing the BADI you told me to, and the BAPIs to see if i can meet a solution to this strange requirement.

Regards,

Laura

0 Kudos

Hi Laura,

I try to use smaller sentences!

Use BAPI to create incoming invoice.

Push F1 on balance field (differenz):

"If the difference is not zero (and you did not flag the field Calculate tax), you may have to correct the:..."

You tried to go the way to change the gross invoice amount (WRBTR), I would propose to flag the calculate tax (see above for BAPI-field). As long as amounts are correct, no difference should be left.

But...

jump to help (little blue 'i'), have a short look at 'Balance'; go to 'Accepting and Posting Variances'. Here is a description, how rounding and other differences can be handled (small difference account).

OK, no todo list, but that are key words for discussion with functional consultant / search in help.sap.com / ...

Currently I don't see a need to read balance and adjust gross amount.

Not so dizzy any longer?

Christian

0 Kudos

Hi,

Thanks a lot Christian!! for your info and your patience specially

As I am new to this forum I ask you one last question: How can I give you reward points for this topic? Your answers have been very helpful!

Danke schoen!

Regards,

Laura

0 Kudos

Hi Laura,

difficult question (never done this before, never asked for this). Somehow you have to mark this topic as question, then small stars beneath topics should appear. By clicking them, you can decide about amount:

2 - helpful

6 - very helpful

10 - solution, question closed

(Maybe search a little bit in other threads)

But your welcome, patience is no question (it's more a task to figure out your problem; without assuming too much).

Regards,

Christian