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: 

bapi to save as completed an incoming invoice

former_member182371
Active Contributor
0 Kudos

Hi,

is there a bapi allowing to create an incoming invoice an saving it as completed?.

i don´t need to park it.

i´d like to save the document as completed.

(i did try with BAPI_INCOMINGINVOICE_PARK but what i got was a parked document and what i need is a document saved as completed).

it is as if you cliked "Saved as completed" button of transaction MIR7.

Best regards.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

Check these BAPIs

BAPI_INCOMINGINVOICE_CREATE

Check this thread as well

Regards,

Satish

9 REPLIES 9

Former Member
0 Kudos

HI,

Check these BAPIs

BAPI_INCOMINGINVOICE_CREATE

Check this thread as well

Regards,

Satish

former_member182371
Active Contributor
0 Kudos

To all people interested this is how i solved the question:


CALL FUNCTION 'BAPI_INCOMINGINVOICE_PARK'
  EXPORTING
    headerdata       = x_in_header
  IMPORTING
    invoicedocnumber = lc_belnr
    fiscalyear       = lc_gjahr
  TABLES
    itemdata         = i_in_item
    return           = i_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait = 'X'.

  CALL FUNCTION 'MRM_INVOICE_READ'
    EXPORTING
      i_belnr = lc_belnr
      i_gjahr = lc_gjahr
    IMPORTING
      e_rbkpv = s_rbkpv
    TABLES
      t_drseg = tab_drseg
      t_rbselbest = l_t_selbest
      t_rbsellifs = l_t_sellifs
      t_rbselfrbr = l_t_selfrbr
      t_rbselwerk = l_t_selwerk
      t_rbselerfb = l_t_selerfb.

 PERFORM drseg_complete(SAPLMR1M) USING     s_rbkpv
                                            'V'
                                            space
                                  CHANGING  tab_drseg[].

* As the next routine checks ok-code not initial i have to
* pass a value to the ok-code
DATA: c_okqu(17)   TYPE c VALUE '(SAPLMR1M)OK-CODE'.
FIELD-SYMBOLS: <fs_okqu> TYPE ANY.
ASSIGN (c_okqu) TO <fs_okqu>.
<fs_okqu> = 'COMP'.


DATA: ok-code(20).
DATA:      l_trtyp     LIKE t169-trtyp value 'V'.
CONSTANTS: l_okcode    LIKE  ok-code VALUE 'COMP'.


PERFORM document_park(SAPLMR1M) USING s_rbkpv
                             tab_drseg[]
                             l_t_selbest[]
                             l_t_selfrbr[]
                             l_t_sellifs[]
                             l_t_selwerk[]
                             l_t_selerfb[]
                             l_trtyp          "akt_typ
                             l_okcode.       "fcocomp.

Note that the key here was the two routines drseg_complete and document_park

Best regards.

Edited by: pablo casamayor on Apr 24, 2008 8:27 AM

Edited by: pablo casamayor on Apr 24, 2008 8:29 AM

0 Kudos

Hello Pablo,

I have the same thing to do. I tried the way you did, but it's not working. Is there any other tips to create an invoice with status 'Save as completed'.

I went through debug also, but still cannot figure out where is the status getting updated.

Thanks in advance for your help. 

0 Kudos

Hello,

Just wanted to say that your solution works.

There was a field which I forgot to add to be used in BAPI_INCOMINGINVOICE_PARK.

But this is a good solution, thanks very much.

Former Member
0 Kudos

Hello,

Just wanted to ask something. In fact this solution is working fine for EUR invoice. But when we want to create USD invoice, it is not working. The status (RBSTAT) is still A. I am not able to save as completed for USD.

Do u have any idea?

0 Kudos

Hi,

(before the above code some of this routines where needed too in order to fill all the structures needed)

have a look at the following routines in program saplmrm_bapi

importing_data_check

rbkpv_fill

frseg_fill

co_fill

ma_fill

rbtx_fill

Best regards.

0 Kudos

I tried what u said, but I'm stuck at the routine rbtx_fill

The function module BAPI_INCOMINGINVOICE_CREATE1 does not exist in my SAP Version, the above routine (rbtx_fill) needs some features associated with BAPI_INCOMINGINVOICE_CREATE1.

We have even activated the required business function as per the SAP Note 1903144 , but no success.

0 Kudos

Hi,

this is what i finally added in the routine:


PERFORM rbtx_fill(saplmrm_bapi)                  TABLES    taxdata

                                              withtaxdata

                                              vendoritemsplitdata

                                    USING    s_rbkpv-waers

                                    CHANGING  s_rbkpv-rbtx[]

                                              s_rbkpv-h_rbws[]

                                              s_rbkpv-h_rbvs[]

                                              return[]

                                              f_subrc.

  CHECK f_subrc = 0.


Best regards.

0 Kudos

I just did that.. But I still cannot create any incoming invoice with status B when the currency is USD.

Even after these codes, the status is A.