cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating debit memo request with refernece to contract

wjanes
Explorer
0 Kudos

Hi Community.

I have a little problem and hope i can solve it with your help 🙂

I am creating a debit memo request with FM "SD_SALESDOCUMENT_CREATE".

Actually it is working but when i look under the tab i have no assignment to my contract

If i try it without bapi (transaction va01) i have an assignmen to the contract (sales order)t:

Item

        ls_items = VALUE #( material = <outtab>-matnr
                            target_qty = <outtab>-menge
                            target_qu = <outtab>-meins
                            ref_doc = <outtab>-kontrakt
                            ref_doc_it = <outtab>-posnr
                            ref_doc_ca = 'G'
                            itm_number = <outtab>-posnr ).

        ls_itemx = VALUE #( material = abap_true
                            target_qty = abap_true
                            target_qu = abap_true
                            ref_doc = abap_true
                            ref_doc_it = abap_true
                            ref_doc_ca = abap_true
                            itm_number = abap_true ).

Header

          "Header
          ls_header-doc_type = <outtab>-fkart.
          ls_header-sales_org = <outtab>-vkorg.
          ls_header-distr_chan = '01'.
          ls_header-division = '01'.
          ls_header-bill_date = <outtab>-budat.
          ls_header-ref_doc = <outtab>-kontrakt.
          ls_header-refdoc_cat = 'G'.
          ls_header-ord_reason = <outtab>-augru.

          ls_headerx-doc_type = abap_true.
          ls_headerx-sales_org = abap_true.
          ls_headerx-distr_chan = abap_true.
          ls_headerx-division = abap_true.
          ls_headerx-bill_date = abap_true.
          ls_headerx-ref_doc = abap_true.
          ls_headerx-refdoc_cat = abap_true.
          ls_headerx-ord_reason = abap_true.

Hope you can help me 🙂

Thanks

View Entire Topic
VeselinaPeykova
Active Contributor
0 Kudos

Probably I do not understand well the test case that you are executing.

You said that you create debit memo request (DR) with reference to a contract via BAPI, but then in your VA01 example you show creation with reference to a document that you mentioned to be a sales order. Are you using exactly the same data in both cases? You might want to double-check the document types, item categories and so on - just to make sure that the foreground test is as close as possible to what you do via BAPI.

What I find interesting in your screenshots that I do not see the same fields in the two systems where I tried to replicate the scenario - one is ECC6 EhP4, the other one is S/4HANA 1909 FP01. It is possible that I am missing some important part of the process, because the availability of fields in sales documents depend on a number of factors, but still - would you please specify the exact names of the fields which you are missing in the BAPI case, but which are available in VA01 execution?

This could help a lot in finding out the root cause.

Another important point - did you check if these fields are correctly populated on table level (SE16), but are just not visible in the GUI or they are not filled at all? I guess that this would be the first troubleshooting step that a developer would perform, but you did not mention it in the question.

Also, I assume that you are not using Screen Personas, is this correct? This is just the good old VA01 in SAP GUI, right?

If the answer to the second question is yes and if the assignment data is populated on table level, but it not displayed in VA03, I would suggest that you take a look at 208245 - Availability of fields in sales orders, which explains how you can check why a certain field is hidden, editable or read-only in sales documents. It should be easy for you to identify why the field is not shown once you identify the field names.

wjanes
Explorer
0 Kudos

Hi veselina.petrova

Thanks for your hint.
I checked the VBAP of both orders and it seems that the fields VBELV and POSNV are not populated when i use the BAPI but they are filled if i create an debit req via va01 (reference to contract).

I tried to fill these values on MV45AFZZ and it seems to work

I did not find another solution to pupulate these to fields over the BAPI.