11-24-2007 11:18 AM
Hi gurus,
Im using bapi create sales order for creating a new sales order. now this FM
BAPI_SALESDOCU_CREATEFROMDATA1 has a retun vbeln ie SO number.
now based on this SO number i want the PR ref number from the vbep table.
SELECT SINGLE * FROM vbep INTO vbep
WHERE vbeln = v_vbelns .
but this select querry doesnt pick any value.
but when i check this DBase table vbep this SO number is there anr the PR number is also there.
But im not able to find the error why it is not picking the data in the inernal table.
reward points for all usefull ans.
11-24-2007 11:23 AM
Hi Madhvi,
I think you need to call FM CONVERSION_EXIT_ALPHA_INPUT or CONVERSION_EXIT_ALPHA_OUTPUT on v_vbelns before using it in select query.
Check v_vbelns value in debugging, what value it is passing to select query and put the same valu in DBTABLE and see whether you are getting any value or not.
Regards,
Satish
11-24-2007 11:23 AM
Hi,
generally after calling bapi we have to call bapi_transaction_commit.
reward points if helpful.
11-24-2007 11:24 AM
Pass your return doc number v_vbelns from the BAPI to
CONVERSION_EXIT_ALPHA_OUTPUT and then use it into your query.
Regards,
Abhishek
11-24-2007 11:32 AM
this is my exact code
FORM spool_print using v_vbelns
t_repc_create_spool STRUCTURE t_repc.
*internal table for the spool
*data: itab11 like vbep occurs 0 with header line.
data: begin of i_spool occurs 0,
vbeln1 type vbap-vbeln,
vbeln4 type vbap-vbeln,
p_req type vbep-banfn,
p_pur type vbkd-bstkd,
end of i_spool.
tables: vbep.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_output'
EXPORTING
input = v_vbelns
IMPORTING
output = v_vbelns.
SELECT SINGLE * FROM vbep INTO vbep
WHERE vbeln = v_vbelns .
write: /0(71) sy-uline.
write: /1 sy-vline, 2(15) 'SalesOrder-Ch1', sy-vline , 19(15)
'SalesOrder-Ch4',
sy-vline, 37(15) 'Purch_order', sy-vline, 55(15)'purcu_req', sy-vline.
*v_vbelns
*select banfn
*from vbep
*into req
*where vbeln = v_vbeln and posnr = 10 and ETENR = 1 .
*endselect.
i_spool-vbeln1 = t_repc_create_spool-vbeln.
i_spool-vbeln4 = v_vbelns.
i_spool-p_pur = p_purch.
i_spool-p_req = vbep-banfn.
append i_spool.
loop at i_spool.
write: /0(71) sy-uline.
write: /1 sy-vline, 2 i_spool-vbeln1,18 sy-vline, i_spool-vbeln4,
35 sy-vline, i_spool-p_pur,
53 sy-vline, i_spool-p_req, 71 sy-vline.
write: /0(71) sy-uline.
endloop.
ENDFORM. " spool_print
im using the function CONVERSION_EXIT_ALPHA_INPUT.
but yet not able to get the desired result.
the v_vbelns field has a value in it but yet the select querry is nt able to take out the result from the data base table.
11-24-2007 11:39 AM
Madhvi,
Below Function call is working?
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_output' "<< Make output to UPPER CASE
EXPORTING
input = v_vbelns
IMPORTING
output = v_vbelns.
Regards,
Satish
11-24-2007 11:26 AM
hi Madhvi,
You should put proper query to get the out put...
Just try this and see...
Tables : vbep.
SELECT SINGLE * FROM vbep
WHERE vbeln = v_vbelns.
<b>It should work.</b>
Reward points....
Cheers,
Enjoy.
Sagun Desai...
11-24-2007 11:35 AM
Hi,
Before above query and after the bapi.
Just check the output value of sales order "v_vbelns".
If the value is just a number without initial zeros for eg. "12334545".
Then you have to uses the following function module...
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = v_vbelns
IMPORTING
OUTPUT = v_vbelns
.
If the value is just a number with initial zeros for eg. "0012334545".
Then you have to call following transaction....
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = v_vbelns
IMPORTING
OUTPUT = v_vbelns
.
BEFORE ALL ABOVE THIS JUST CHECK DATA IN THE TABLE HOW THE SALES ORDER NUMBER IS MAINTAINED. WHEATHER ITS WITH ZEROS OR WITHOUT ZEROS....
THIS SHOULD WORK....
CHEERS,
SAGUN DESAI...
11-24-2007 5:22 PM
After the BAPI call to create the document, when you call BAPI TRANSACTION_COMMIT, specify WAIT = 'X'.
Rob