Application Development and Automation 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: 
Read only

SD Invoice update z_fields FM/BAPI

Former Member
0 Likes
2,182

Am I doing somethig wrong? Is there another way???CALL FUNCTION 'RV_INVOICE_DOCUMENT_READ'

    EXPORTING
      vbrk_i        = vbrk
      konv_read     = 'X'
    TABLES
      xkomfk        = xkomfk
      xvbrk         = xvbrk
      xvbrp         = xvbrp
      xvbpa         = xvbpa
      xkomv         = xkomv

    EXCEPTIONS
      error_message = 4
      OTHERS        = 4.


      loop at lt_vbrp into ls_vbrp.
FIELD-SYMBOLS : <vbrp> type VBRPVB.
    READ TABLE xvbrp ASSIGNING <vbrp> WITH KEY
        vbeln = ls_vbrp-vbeln
        posnr = ls_vbrp-posnr.
        MOVE lv_offre TO <vbrp>-zzoffre.
        move lv_sau_mdt TO <vbrp>-zzsau_mdt.
        MOVE lv_sau_adh TO <vbrp>-zzsau_adh.

CALL FUNCTION 'RV_INVOICE_ITEM_MAINTAIN'

  EXPORTING
    VBRP_I                  = ls_vbrp
  TABLES
    XKOMFK                  = XKOMFK
    XKOMV                   = XKOMV
    XTHEAD                  = XTHEAD
    XVBFS                   = XVBFS
    XVBPA                   = XVBPA
    XVBRK                   = XVBRK
    XVBRP                   = XVBRP
    XVBSS                   = XVBSS


ls_VBSK_I-mandt = sy-mandt.
ls_VBSK_I-ernam = ls_vbrp-ernam.
ls_VBSK_I-erdat = ls_vbrp-erdat.
ls_VBSK_I-uzeit = ls_vbrp-erzet.


CALL FUNCTION 'RV_INVOICE_DOCUMENT_ADD'
  EXPORTING
   VBSK_I                = ls_VBSK_I
  TABLES
    XKOMFK                = XKOMFK
    XKOMV                 = XKOMV
    XTHEAD                = XTHEAD
    XVBFS                 = XVBFS
    XVBPA                 = XVBPA
    XVBRK                 = XVBRK
    XVBRP                 = XVBRP
    XVBSS                 = XVBSS
    exceptions
                others    = 1.

Am I doing somethig wrong? Is there another way???

1 ACCEPTED SOLUTION
Read only

Florian
SAP Champion
SAP Champion
0 Likes
1,555

See here,

you forgot something to do.

First:

  Call function 'RV_INVOICE_ITEM_MAINTAIN'

then, to make changes efective:

  Call function 'RV_INVOICE_DOCUMENT_ADD'

with parameters:

            WITH_POSTING           = 'A'

            PREISFINDUNGSART       = 'I'

Comes from that discussion:

SD Invoice (item) update FM/BAPI | SCN

Please use the serch first, before asking a question.

Here you can learn more about:

How to use SCN search | SCN

Regards

Florian

Am I doing somethig wrong? Is there another way???CALL FUNCTION 'RV_INVOICE_DOCUMENT_READ'

    EXPORTING
      vbrk_i        = vbrk
      konv_read     = 'X'
    TABLES
      xkomfk        = xkomfk
      xvbrk         = xvbrk
      xvbrp         = xvbrp
      xvbpa         = xvbpa
      xkomv         = xkomv

    EXCEPTIONS
      error_message = 4
      OTHERS        = 4.


      loop at lt_vbrp into ls_vbrp.
FIELD-SYMBOLS : <vbrp> type VBRPVB.
    READ TABLE xvbrp ASSIGNING <vbrp> WITH KEY
        vbeln = ls_vbrp-vbeln
        posnr = ls_vbrp-posnr.
        MOVE lv_offre TO <vbrp>-zzoffre.
        move lv_sau_mdt TO <vbrp>-zzsau_mdt.
        MOVE lv_sau_adh TO <vbrp>-zzsau_adh.

CALL FUNCTION 'RV_INVOICE_ITEM_MAINTAIN'

  EXPORTING
    VBRP_I                  = ls_vbrp
  TABLES
    XKOMFK                  = XKOMFK
    XKOMV                   = XKOMV
    XTHEAD                  = XTHEAD
    XVBFS                   = XVBFS
    XVBPA                   = XVBPA
    XVBRK                   = XVBRK
    XVBRP                   = XVBRP
    XVBSS                   = XVBSS


ls_VBSK_I-mandt = sy-mandt.
ls_VBSK_I-ernam = ls_vbrp-ernam.
ls_VBSK_I-erdat = ls_vbrp-erdat.
ls_VBSK_I-uzeit = ls_vbrp-erzet.


CALL FUNCTION 'RV_INVOICE_DOCUMENT_ADD'
  EXPORTING
   VBSK_I                = ls_VBSK_I
  TABLES
    XKOMFK                = XKOMFK
    XKOMV                 = XKOMV
    XTHEAD                = XTHEAD
    XVBFS                 = XVBFS
    XVBPA                 = XVBPA
    XVBRK                 = XVBRK
    XVBRP                 = XVBRP
    XVBSS                 = XVBSS
    exceptions
                others    = 1.

Am I doing somethig wrong? Is there another way???

4 REPLIES 4
Read only

Florian
SAP Champion
SAP Champion
0 Likes
1,556

See here,

you forgot something to do.

First:

  Call function 'RV_INVOICE_ITEM_MAINTAIN'

then, to make changes efective:

  Call function 'RV_INVOICE_DOCUMENT_ADD'

with parameters:

            WITH_POSTING           = 'A'

            PREISFINDUNGSART       = 'I'

Comes from that discussion:

SD Invoice (item) update FM/BAPI | SCN

Please use the serch first, before asking a question.

Here you can learn more about:

How to use SCN search | SCN

Regards

Florian

Read only

Former Member
0 Likes
1,555

sorry, yes i saw the discussion yesterday and i did, to make changes efective:

  Call function 'RV_INVOICE_DOCUMENT_ADD'

with parameters:

            WITH_POSTING           = 'A'

            PREISFINDUNGSART       = 'I


and i fill XVBRP table too.

it doesn't work, then i tried without thoses parameters but the result is the same.

I think something else is wrong but what i dont know.

Read only

0 Likes
1,555

Hi khalid,

and there is a commit work afterwards? I mean, just in case... you know

I'm pretty sure, this works in that way...

Regards

Florian

Read only

Former Member
0 Likes
1,555

hi Florian,

Yes there is a commit work

I just found the problem, i had to update the files after the function RV_INVOICE_ITEM_MAINTAIN and not before !

That work ! than you for helping Florian