‎2007 Apr 16 1:53 PM
Hello!
What is the BAPI for the same behaviour as VA23? Only a BAPI that returns the details of the Quotation - I dont want a BAPI for changing the quotation or anything like that..
The BAPI_QUOTATION_GETDETAILSBOS does not exist in the system. Is there any other BAPI which can help me export the quotation details using JCo?
Thanks
Sameer
‎2007 Apr 17 3:09 PM
Ok, I'm done with those function modules now. Lets just hit the DB directly. Put this logic in your function module and pass these back thru the interface.
Select Single * into ex_vbak
from vbak
where vbeln = DOC_NUMER.
Select Single * into ex_vbap
from vbap
where vbeln = DOC_NUMBER
and posnr = DOC_ITEM_NUMBER.Regards,
Rich Heilman
‎2007 Apr 16 1:56 PM
‎2007 Apr 16 2:40 PM
Hi Rich!
Thanks for your answer! There ist just one problem, I am not an ABAP guy, I just posted the question here in case anyone knew of a BAPI about it.
Maybe you will understand it better if I explain it - I am working on a JCo program which first lays down a quotation in the R/3 system. This part works smoothly. Next, I try to read this quotation using the number generated in the above step and export the data from the quotation into an XML file.
The only part I am stuck in is finding a BAPI which will read the quotation - the closest I found was SD_SALES_DOCUMENT_READ, but this does not seem to be working right in my program. I am still checking it.
Anything simpler in sight to do it?
Thanks for the help again!
Sameer
‎2007 Apr 16 2:55 PM
That function module would work good for you for getting the header level details if it was remote enabled. It is not, and hence can not be called from outside the system. Is there any ABAPer around that could write a wrapper function module around the SD_SALES_DOCUMENT_READ function module. He could then make the wrapper RFC enabled, which would allow you to call it from jCo.
Regards,
RIch Heilman
‎2007 Apr 16 3:38 PM
Hallo Rich!
Finally a positive reply from at least someone!
Unfortunately no, there is no one around here thats a good ABAP programmer. There are just two of us here who are a little familar with ABAP but if you could guide me to some white papers or example programs which show how a wrapper can be built for the SD_SALES--- module, I can go ahead and try it myself.
The need is however to stick with standard SAP delivered BAPIs as much as possible so it would be extremely helpful in case you know of a BAPI for the job
I still find it strange that there are BAPIs for laying a quotation and changing it but not for reading it..
Thanks a ton!
Sameer
‎2007 Apr 17 12:28 PM
Hi Rich!
I have now written a wrapper for the SD_SALES_DOCUMENT_READ and it works perfectly.
But as you know, it only helps us to get the header information rather than the complete quotation data. Is there any RFC or BAPI which does that? Inspite of searching hard, I havent come across anything helpful.
I would be really glad if you (or anyone else reading this ) can help me out with it.
Bye!
Sameer
‎2007 Apr 17 12:46 PM
Hai
BAPI'S for sales
MAP2E_FPLT_TO_BAPISDBPLD
MAP2E_KOMV_TO_BAPISDCOND
MAP2E_SADRVB_TO_BAPISDCOAD
MAP2E_THEAD_TO_BAPISDTEHD
MAP2E_VBAK_TO_BAPISDHD
MAP2E_VBAP_TO_BAPISDIT
MAP2E_VBEP_TO_BAPISDHEDU
MAP2E_VBFA_TO_BAPISDFLOW
MAP2E_VBKD_TO_BAPISDBUSI
MAP2E_VBPA_TO_BAPISDPART
MAP2E_VBUK_TO_BAPISDHDST
MAP2E_VBUP_TO_BAPISDITST
MAP2E_VEDA_TO_BAPISDCNTR
BAPI_SALESDOCUMENT_CHANGE BAPI Change Sales Document
BAPI_SALESDOCUMENT_COPY Copying a Sales Document in a Subsequent Documen
BAPI_SALESDOCU_CREATEFROMDATA1 Creating a Sales and Distribution Document
BAPI_SALESDOCU_CREATEWITHDIA Creating a Sales and Distribution Document
MAP2E_CUXE1CUBLB_TO_BAPICUBLBM
MAP2E_CUXE1CUINS_TO_BAPICUINSM
MAP2E_CUXE1CUPRT_TO_BAPICUPRTM
MAP2E_CUXE1CUVAL_TO_BAPICUVALM
MAP2E_E1CUCFG_TO_BAPICUCFGM
MAP2E_E1CUREF_TO_BAPICUREFM
MAP2E_FPLA_TO_BAPISDBPL
MAP2E_FPLTVB_TO_BAPICCARDM
MAP2E_FPLT_TO_BAPISDBPLD
**Please reward suitable points***
With Regards
Navin Khedikar
‎2007 Apr 17 2:03 PM
Hello Navin
your knowledge of BAPIs related to Sales seems commendable. However, like I said, I am looking for a BAPI/RFC to help me read an existing quotation.
I already tried SD_SALES_DOCUMENT_READ but it returns only the header data. The SD_SALES_DOCUMENT_READ_POS helps partly but provides information only about one particular specified row of records.
Your list, although comprehensive, does not seem to help me in any way regarding that.
Sameer
‎2007 Apr 17 2:22 PM
‎2007 Apr 17 2:34 PM
Hi Rich!
Thanks again mate, I am trying it out right now and will post my results here.
Thanks for showing up again with an answer!
Sameer
‎2007 Apr 17 2:59 PM
Hallo Rich,
I just tried out what you suggested. The SD_SALES_ITEM_LIST_READ returns the number of records in the quotation but no material numbers being used in it.
The following is the code I have written as of yet - bear with me in case the code is dirty, I am a beginner as far as ABAP is concerned and am still stumbling along the way
FUNCTION Z_QUOTATION_READ_POS.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(DOC_NUMBER) LIKE VBAK-VBELN
*" VALUE(DOC_POSNMR) LIKE VBAP-POSNR
*" EXPORTING
*" VALUE(ENCO_EVBAK) LIKE VBAK STRUCTURE VBAK
*" VALUE(ENCO_EVBAKKOM) LIKE VBAKKOM STRUCTURE VBAKKOM
*" VALUE(ENCO_MATNR_POS) LIKE VBAP-MATNR
*" TABLES
*" ENCO_FXAVBBD STRUCTURE BV03V
*" ENCO_EIVBAP STRUCTURE AV03R
*"----------------------------------------------------------------------
CALL FUNCTION 'SD_SALES_DOCUMENT_READ_POS'
EXPORTING
DOCUMENT_NUMBER = DOC_NUMBER
DOCUMENT_POSNR = DOC_POSNMR
IMPORTING
EVBAK = ENCO_EVBAK
EVBAKKOM = ENCO_EVBAKKOM
MATNR_POS = ENCO_MATNR_POS
TABLES
FXAVBBD = ENCO_FXAVBBD.
ENCO_EIVBAP-VBELN = 0020000017.
CALL FUNCTION 'SD_SALES_ITEM_LIST_READ'
TABLES
EIVBAP = ENCO_EIVBAP.
ENDFUNCTION.The first part is of course where I use the READ_POS RFC, after that I call the LIST_READ as you suggested but in the output table, only the position numbers are filled up - at least it shows how many records are present in the Quotation.
How do I get the material numbers too? I checked the SD_SALES_ITEM_LIST_READ Function module and in the module it only iterates on the position number. I know its not recommended to change SAP code so how do I go ahead?
Just give me the idea, I will try and implement it myself in ABAP - learn better that way.
Thanks again!
Sameer
‎2007 Apr 17 3:09 PM
Ok, I'm done with those function modules now. Lets just hit the DB directly. Put this logic in your function module and pass these back thru the interface.
Select Single * into ex_vbak
from vbak
where vbeln = DOC_NUMER.
Select Single * into ex_vbap
from vbap
where vbeln = DOC_NUMBER
and posnr = DOC_ITEM_NUMBER.Regards,
Rich Heilman
‎2007 Apr 17 3:11 PM
‎2007 Apr 17 3:12 PM
‎2007 Apr 17 3:53 PM
Hi Rich!
I will try out your code now...but just a remark - wont "Select Single ....... and posnr = DOC_ITEM_NUMBER" insert just a single record where the position number is defined?
I was trying to get all the materials in the quotation - some kind of a loop to iterate through all the POSNMRs. I will try something like "Select * into enco_vbap from vbap where vbeln = DOC_NUMBER".
Will let you know what happens
Bye!
Sameer
‎2007 Apr 17 4:06 PM
Hello there again,
I just tried out the code with the following results - when I use the Select* instead of the select single, I get the entry of the last row in the evbap table.
I have two materials in the quotation, but with
Select * into enco_evbap
from vbap
where vbeln = DOC_NUMBER.I get only one entry in the output containing the second material. If I use the select single, I get the first.
I am guessing, I am not aware of looping techniques in ABAP. When I use Select * blah blah blah, how do I append a second row in the enco_evbap table so that the second material gets written into the second row?
Again, the following dirty beginner ABAP code that I have -
FUNCTION Z_QUOTATION_READ_POS.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(DOC_NUMBER) LIKE VBAK-VBELN
*" VALUE(DOC_POSNMR) LIKE VBAP-POSNR
*" EXPORTING
*" VALUE(ENCO_EVBAK) LIKE VBAK STRUCTURE VBAK
*" VALUE(ENCO_EVBAKKOM) LIKE VBAKKOM STRUCTURE VBAKKOM
*" VALUE(ENCO_MATNR_POS) LIKE VBAP-MATNR
*" VALUE(ENCO_EVBAP) LIKE VBAP STRUCTURE VBAP
*" TABLES
*" ENCO_FXAVBBD STRUCTURE BV03V
*" ENCO_EIVBAP STRUCTURE AV03R
*"----------------------------------------------------------------------
CALL FUNCTION 'SD_SALES_DOCUMENT_READ_POS'
EXPORTING
DOCUMENT_NUMBER = DOC_NUMBER
DOCUMENT_POSNR = DOC_POSNMR
IMPORTING
EVBAK = ENCO_EVBAK
EVBAKKOM = ENCO_EVBAKKOM
MATNR_POS = ENCO_MATNR_POS
TABLES
FXAVBBD = ENCO_FXAVBBD.
ENCO_EIVBAP-VBELN = 0020000017.
Select single * into enco_evbak
from vbak
where vbeln = DOC_NUMBER.
Select * into enco_evbap
from vbap
where vbeln = DOC_NUMBER.
endselect.
CALL FUNCTION 'SD_SALES_ITEM_LIST_READ'
TABLES
EIVBAP = ENCO_EIVBAP.
ENDFUNCTION.
Thanks for all the help, I really appreciate it..
Sameer
‎2007 Apr 17 4:10 PM
You forget the TABLE in the second select statement. You don't need the function modules anymore so you can get rid of them.
*CALL FUNCTION 'SD_SALES_DOCUMENT_READ_POS'
*
*EXPORTING
* DOCUMENT_NUMBER = DOC_NUMBER
* DOCUMENT_POSNR = DOC_POSNMR
*
*IMPORTING
* EVBAK = ENCO_EVBAK
* EVBAKKOM = ENCO_EVBAKKOM
* MATNR_POS = ENCO_MATNR_POS
*
*TABLES
* FXAVBBD = ENCO_FXAVBBD.
ENCO_EIVBAP-VBELN = 0020000017.
Select single * into enco_evbak
from vbak
where vbeln = DOC_NUMBER.
Select * into TABLE enco_evbap
from vbap
where vbeln = DOC_NUMBER.
*endselect.
*CALL FUNCTION 'SD_SALES_ITEM_LIST_READ'
*
*TABLES
* EIVBAP = ENCO_EIVBAP.
*
ENDFUNCTION.
Regards,
Rich Heilman
‎2007 Apr 17 4:16 PM
Hi Sameer,
I don't know if I am too late...:)
You can as well use the FM RFC_READ_TABLE function module.
Once for VBAK and another time for VBAP.
REgards,
Ravi
‎2007 Apr 18 8:45 AM
Hi Rich!
Thanks for all the help I tried out your suggestions and just saw your last post about the missing "table" keyword.
Yesterday I tried it with the statement Select * appending table enco_..... and that had worked. The following is the running program now
FUNCTION Z_QUOTATION_READ_POS.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(DOC_NUMBER) LIKE VBAK-VBELN
*" VALUE(DOC_POSNMR) LIKE VBAP-POSNR
*" EXPORTING
*" VALUE(ENCO_EVBAK) LIKE VBAK STRUCTURE VBAK
*" VALUE(ENCO_EVBAKKOM) LIKE VBAKKOM STRUCTURE VBAKKOM
*" VALUE(ENCO_MATNR_POS) LIKE VBAP-MATNR
*" VALUE(ENCO_EVBAP) LIKE VBAP STRUCTURE VBAP
*" TABLES
*" ENCO_FXAVBBD STRUCTURE BV03V
*" ENCO_EVBAP1 STRUCTURE VBAP
*"----------------------------------------------------------------------
CALL FUNCTION 'SD_SALES_DOCUMENT_READ_POS'
EXPORTING
DOCUMENT_NUMBER = DOC_NUMBER
"The position number is not needed because a list of all materials in
"the quotation is needed - not just one material at a particular
"position. However, it is a required parameter and is set by default
"to 0.
DOCUMENT_POSNR = DOC_POSNMR
IMPORTING
EVBAK = ENCO_EVBAK
EVBAKKOM = ENCO_EVBAKKOM
MATNR_POS = ENCO_MATNR_POS
TABLES
FXAVBBD = ENCO_FXAVBBD.
"Select single * into enco_evbak
"from vbak
"where vbeln = DOC_NUMBER.
"The following select code works
"Select * appending table enco_evbap1
"from vbap
"where vbeln = DOC_NUMBER.
"endselect.
Select * into TABLE enco_evbap1
from vbap
where vbeln = DOC_NUMBER.
ENDFUNCTION.Thanks again for all your help!
Sameer
‎2010 Mar 09 7:16 PM
Hi,
check this one:
BAPISDORDER_GETDETAILEDLIST
Don't forget to fill I_BAPI_VIEW with what informations you need.
Regards,
Frisoni