Oracle Sample code table structure needed ...........
Hi,
I have downloaded sample code from oracle web site for connection pooling in java.
some tables were used in that program like AVAILABLE_ROOM_TYPES, hotel_bookings etc....
it was told that the table structures can be found in otn site. but i cud not find that.
can ay one tell me where i can find all the table structures and dumps with data for those tables that are used in all the sample codes available for download.
thanx in advance
saro
Saro,
You can get it here : http://technet.oracle.com/sample_code/tech/java/travel/travelschema.htm
Cheers,
Srinivas.
Similar Messages
-
Oracle Database all table structure
Hi
I want donwload Oracle Database all table structure , any one please explain where i can download the structure in text format
regardsSQL> desc user_tables;
Name Null? Type
TABLE_NAME NOT NULL VARCHAR2(30)
TABLESPACE_NAME VARCHAR2(30)
CLUSTER_NAME VARCHAR2(30)
IOT_NAME VARCHAR2(30)
STATUS VARCHAR2(8)
PCT_FREE NUMBER
PCT_USED NUMBER
INI_TRANS NUMBER
MAX_TRANS NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENTS NUMBER
MAX_EXTENTS NUMBER
PCT_INCREASE NUMBER
FREELISTS NUMBER
FREELIST_GROUPS NUMBER
LOGGING VARCHAR2(3)
BACKED_UP VARCHAR2(1)
NUM_ROWS NUMBER
BLOCKS NUMBER
EMPTY_BLOCKS NUMBER
AVG_SPACE NUMBER
CHAIN_CNT NUMBER
AVG_ROW_LEN NUMBER
AVG_SPACE_FREELIST_BLOCKS NUMBER
NUM_FREELIST_BLOCKS NUMBER
DEGREE VARCHAR2(10)
INSTANCES VARCHAR2(10)
CACHE VARCHAR2(5)
TABLE_LOCK VARCHAR2(8)
SAMPLE_SIZE NUMBER
LAST_ANALYZED DATE
PARTITIONED VARCHAR2(3)
IOT_TYPE VARCHAR2(12)
TEMPORARY VARCHAR2(1)
SECONDARY VARCHAR2(1)
NESTED VARCHAR2(3)
BUFFER_POOL VARCHAR2(7)
FLASH_CACHE VARCHAR2(7)
CELL_FLASH_CACHE VARCHAR2(7)
ROW_MOVEMENT VARCHAR2(8)
GLOBAL_STATS VARCHAR2(3)
USER_STATS VARCHAR2(3)
DURATION VARCHAR2(15)
SKIP_CORRUPT VARCHAR2(8)
MONITORING VARCHAR2(3)
CLUSTER_OWNER VARCHAR2(30)
DEPENDENCIES VARCHAR2(8)
COMPRESSION VARCHAR2(8)
COMPRESS_FOR VARCHAR2(12)
DROPPED VARCHAR2(3)
READ_ONLY VARCHAR2(3)
SEGMENT_CREATED VARCHAR2(3)
RESULT_CACHE VARCHAR2(7)
SQL> -
Oracle Sample Code Login Issue
I want to login to Oracle sample code.When i clicked the 'login' link from oracle sample code home page it is redirecting me to a page to 'Create User'. I gave my OTN username and password,but not accepting and showing invalid username/password message. Please help me to solve this.
Hi,
I had this issue, so i created a new user like 'user_ext' by providing a valid email id. Then try to login with the new user id created -
Oracle Error Code Table Exist?
I am wondering if there is a table in the DD (or elsewhere) that contains the message text associated with Oracle error codes? I know that oerr can be used (outside of the DB), but we are hoping these exist in a table for an auditing application we are trying to work.
Thanks.They are accessible via the SQLERRM function, e.g.
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> SET SERVEROUTPUT ON;
SQL> BEGIN
2 FOR i IN 100 .. 110 LOOP
3 DBMS_OUTPUT.PUT_LINE (SQLERRM (-i));
4 END LOOP;
5 END;
6 /
ORA-00100: no data found
ORA-00101: invalid specification for system parameter DISPATCHERS
ORA-00102: network protocol cannot be used by dispatchers
ORA-00103: invalid network protocol; reserved for use by dispatchers
ORA-00104: deadlock detected; all public servers blocked waiting for resources
ORA-00105: too many dispatcher configurations
ORA-00106: cannot startup/shutdown database when connected to a dispatcher
ORA-00107: failed to connect to ORACLE listener process
ORA-00108: failed to set up dispatcher to accept connection asynchronously
ORA-00109: invalid value for attribute :
ORA-00110: invalid value for attribute , must be between and
PL/SQL procedure successfully completed.
SQL> -
Oracle Data Pump - Table Structure change
Hi,
we have daily partitioned table, and for backup we are using data pump (expdp). we policy to drop partition after backup (archiving).
we have archived dump files for 1year, few days back developer made changes with table structure they added one new column to table.
Now we are unable to restore old partitions is there a way to restore partition if new column added / dropped from currect table.
Thanks
SachinIf a new column has been added to the table, you can import only the the data from the old structure to the new structure. Use the parameter CONTENT=DATA_ONLY.
-
Oracle 9i Lite: Table structure changed
Hello,
how do I add a new column to a database table? I mean what actions to I have to take to add the column to the database on the server and how is this change transferred to the clients? Are these changes impossible to do with Oracle Lite?
StefanYes, this is possible. There are two ways you can update the clients...
1) repackage the app with the packaging wizard
2) use the consolidator API - see the javadoc. -
I want sample code and tables for my requriement
Hi Experts,
I have MATNR(material no), Werks(plant) and date as selection screen fields Based on this I have to get procurement data. i.e Material
Description
Vendor
Vendor name
Product hierarchy
Qty unrestricted
Date product recieve at warehouse.
i.e.Based on MATERIAL and PLANT I have to get total unrestricted quantity of that material.
please provide me relevant tables and sample code
thanx in advanceI have MATNR(material no), Werks(plant) and date as selection screen fields Based on this I have to get procurement data. i.e
Material - <b>EKPO</b>
Description - <b>MAKT</b>
Vendor - <b>EKKO</b>
Vendor name - <b>LFA1</b>
Product hierarchy - <b>(???)</b>
Qty unrestricted -<b> EKPO</b>
Date product recieve at warehouse. <b>(EKKO)</b>
Please provide me relevant tables <b>(As Above)</b>
and
sample code -<b> You need to contact technical expert</b> -
New Sample Code: Querying techniques, integration events, book assignment
We have just posted a new CRM On Demand Web Services code sample to Oracle Sample Code. This sample uses a combination of WS v1.0 and WS v2.0 to demonstrate advanced samples like querying techniques, processing integration events, and book assignment.
The sample is written using .Net framework 1.1 and VS studio 2003. Users will need to have Microsoft .NET (.Net Framework 1.1) installed on their machine.
<a title="Click here" href="https://codesamples.samplecode.oracle.com/servlets/Scarab/action/ExecuteQuery?query=crm_on_demand" target="_blank">Click here</a> to go to the CRM On Demand code samples. Look for Artifact ID S517, Advanced WS Techniques (in .NET Framework 1.1)I found some examples in the Web Services Resource Library.
you can access this through the "Training and Support" link from within CRM OD.
Then click on "Web Services Library" then download the Getting Started kits
Edited by: user10730659 on 20/01/2009 16:11 -
GetXMLData in document viewer sample code
Hi!
Chapter 12 of the XML User Guide discusses invoking a method called getXMLData. Since it is not in any of the AMs, does anyone have experience writing this method? I have an xml report to pick up 2 parameters (just free-form text and no VOs) in the page and I need this method to pick up the 2 parameters.
Any help is appreciated. ThanksHi Steve
Go to the following link:
https://www.sdn.sap.com/irj/sdn/businessobjects-samples?rid=/webcontent/uuid/e02e0a54-6471-2b10-c99c-d66e07fab102&startindex=61.
There you can see different sample codes.
You need to refer to
Java_Enterprise_BE115_Set_Multivalue-Parameters.zip
Hope this helps you.
Thanks
Soni -
Need sample code to get handle of Selected rows from ADF Table
Hi,
I am new to ADF. I have an ADF table based on VO object.On some button action,I need to get handle of selected rows in application module.
If anybody is having sample code to do this then please share with me.
Thanks,
ashokwow now link http://blogs.oracle.com/smuenchadf/examples/#134 is working.thanks a lot.
also the link http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html is very useful. Thanks a lot for Sameh Nassar too.He made it clear that in 11g Select column is not available for a ADF table and provided a solution to get Select column.
Thanks,
ashok -
Need Sample code to retrieve Data from Portal DB(Oracle)
Would anyone provide me steps to create application with a sample code to retrieve data from portal DB which is oracle and see the output in table format.
Hi Bris ,
The sample code , you didnt specified from where do u want to access the oracle thorough java code or through webdynpro .
Sample code to access through Java
import java.sql.*;
class Customer
public static void main(String args[]) throws SQLException
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("Connecting to the database...");
try
Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","t");
Statement st=cn.createStatement();
ResultSet rs=st.executeQuery("select 'Connected' from dual");
rs.next();
String s=rs.getString(1);
System.out.println(s);
st.close();
cn.close();
catch(Exception ex)
System.out.println("The exception raised is:" + ex);
[code]
If accessing through JDBC datasorce.
https://www.sdn.sap.com/irj/sdn/thread?threadID=328550
https://www.sdn.sap.com/irj/sdn/thread?threadID=309386
[code]
package com.dhl.employeemodel;
import java.sql.Connection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class DBConnectionManager {
Connection connection;
* @return
public Connection getConnection() {
try
Context jndiContext = new InitialContext();
DataSource ds = (DataSource)jndiContext.lookup("jdbc/MyAlias");
connection = ds.getConnection();
catch(Exception connectionErrEx)
//connectionErrEx.printStackTrace();
return null;
return connection;
Thanx
Pankaj -
Need Sample code to upload the data to Application Server
Hi ,
I need to upload the data to application server.
The output should be an XML file.
Can anybody send me sample code for this.
Reward points are assured.
Best Regards
Bhagat.may be this code wil help ,first to downjload the XML fine -
1)
REPORT zhr_test2_tk.
TYPE-POOLS: ixml.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_ostream TYPE REF TO if_ixml_ostream,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document.
DATA: l_element_position TYPE REF TO if_ixml_element,
l_element_title TYPE REF TO if_ixml_element,
l_element_flight TYPE REF TO if_ixml_element,
l_element_from TYPE REF TO if_ixml_element,
l_element_to TYPE REF TO if_ixml_element,
l_element_dummy TYPE REF TO if_ixml_element,
l_value TYPE string.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i.
DATA: lt_erec TYPE TABLE OF hrp5126,
l_erec TYPE hrp5126.
DATA: date(10),
time(4),
filepath TYPE string.
CONSTANTS: filedir TYPE string VALUE 'C:\tmp\',
filename TYPE string VALUE 'ZHR_test'.
START-OF-SELECTION.
fill internal table
SELECT * FROM hrp5126 INTO TABLE lt_erec.
Start filling xml DOM object from internal table lt_erec.
LOOP AT lt_erec INTO l_erec.
*Create the root node 'position'
IF sy-tabix EQ 1.
create an ixml factory
l_ixml = cl_ixml=>create( ).
create Document Object Model
l_document = l_ixml->create_document( ).
Fill root node with value 'position'
l_element_position = l_document->create_simple_element(
name = 'position'
parent = l_document ).
ENDIF.
IF sy-tabix GT 1.
create element jobtitle as child of position
l_value = l_erec-jobtitle.
l_element_title = l_document->create_simple_element(
name = 'job_title'
parent = l_element_position
value = l_value ).
l_value = l_erec-empl_start_date.
l_element_dummy = l_document->create_simple_element(
name = 'StartDate'
parent = l_element_title
value = l_value ).
l_value = l_erec-empl_end_date.
l_element_dummy = l_document->create_simple_element(
name = 'EndDate'
parent = l_element_title
value = l_value ).
ENDIF.
ENDLOOP.
IF sy-subrc NE 0.
WRITE: 'No data in table hrp5125'.
ENDIF.
create a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
connect internal XML table to streamfactory
l_ostream = l_streamfactory->create_ostream_itable(
table = l_xml_table ).
render the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
Get time and date
WRITE sy-uzeit2(2) TO time2(2).
WRITE sy-uzeit0(2) TO time0(2).
WRITE sy-datum4(2) TO date0(2).
WRITE sy-datum6(2) TO date2(2).
WRITE sy-datum0(4) TO date4(4).
*Build filename with date and time reference
CONCATENATE filedir filename date time '.xml' INTO filepath.
<i>* This is the code I hope to modify in order to save the xml structure on the application server, with a specified filepath.</i>
<b> OPEN DATASET filepath FOR OUTPUT IN BINARY MODE.
LOOP AT lt_erec into l_erec.
TRANSFER l_erec TO filepath.
ENDLOOP.
CLOSE DATASET filepath.</b>
save XML document
l_xml_size = l_ostream->get_num_written_raw( ).
*This is the code for download to local computer
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = filepath
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
2) uploading tht PC XML file to APPliaction server -
DATA rec like QISRS_XML_LINE.
OPEN DATASET filepath FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT l_xml_table into rec.
TRANSFER rec TO filepath.
ENDLOOP.
CLOSE DATASET filepath. -
Sample code for a custom field added to LIS Communication structure for Del
We appended a new custome field into extraction structure of the LO Cookpit datasource 2LIS_02_ITM through RSA6. And then run CMOD to write the exit code to populate the value and it works fine. But after we read Roberto's Weblog:
/people/sap.user72/blog/2005/02/14/logistic-cockpit--when-you-need-more--first-option-enhance-it
Find the enhancement we did can't make the Delta mechanism works if only this new field gets changed in a record, and the change cannot be reflected on BW. I know we can run SMOD on the enhancement LEINS001 to write the code for LIS Communication structure customer exit. But we have never writen such a code for LIS Communication Structure enhancement and also don't know on how to make the Delta mechanism works in the code. We would be very appreciated if some expert here can provide the sample code!
Thankshi AHP,
Have you tried Sanyam's code listed in this article you recommended?
Now our R3 team has added a custom field called ZZZ to EKKO table and I modify the code to suit our need and the code would be as following:
*& Include ZXM06U16 *
DATA: i_t_ekko LIKE ekko OCCURS 1 WITH HEADER LINE.
DATA: ebeln LIKE ekpo-ebeln,
it_ekko TYPE TABLE OF ekko WITH HEADER LINE,
old_val(50) TYPE c. "For storing the value from the Field Symbol
FIELD-SYMBOLS <fs> TYPE ANY TABLE.
CASE zeitp.
WHEN 'MA'. "When creating a purchase order
MOVE '(SAPLEINS)T_EKKO[]' TO old_val.
ASSIGN (old_val) TO <fs>.
i_t_ekko[] = <fs>.
LOOP AT xmcekko.
ebeln = xmcekko-ebeln.
IF xmcekko-supkz = '1'. "Old Value ?
SELECT SINGLE * FROM ekko INTO it_ekko WHERE ebeln = ebeln.
xmcekko-ZZZ = it_ekko-ZZZ.
ELSE. "New Value ?
READ TABLE i_t_ekko WITH KEY ebeln = ebeln.
xmcekko-ZZZ = i_t_ekko-ZZZ.
ENDIF.
MODIFY xmcekko.
ENDLOOP.
EndCase.
The compile of the above code works fine and we activated everywhere including project level. Then we set debug points in this code, and run RSA3 on 2LIS_02_ITM, but find the extraction program never reaches this code or call this user exit function EXIT_SAPLEINS_001 of this enhancement LEINS001. Any reason?
Thanks
Kevin
Message was edited by: Kevin Smith -
A sample code to check records of a system table?
hi ABAP4 experts,
We are pretty new at ABAP4. We would be appreciated if you can provide a sample code to check how many records and calculate a total amount for a specific field, e.g., DMBTR in a system table, e.g., BSEG. Note: there is no any selection for this table BSEG, we just want to get the total record count in this table and also the total amount for a specific field e.g. DMBTR in this table.
Do we have to use an internal table to transfer all the records of BSEG into the internal table to get the result?
We will give you reward points!Hi Kevin,
Using SUM directly in SQL will NOT work for table BSEG because BSEG is pool table. You will get an ABAP error.
"Aggregate functions and the addition DISTINCT are not supported in field lists for pooled and cluster tables".
You need an internal table to transfer all data from BSEG and perform calculation for count and sum.
Concerning about performance running perhaps you can code something like this.
REPORT ZZFLTEST NO STANDARD PAGE HEADING.
TABLES: BSEG.
DATA: CURS TYPE CURSOR,
PACKAGE_SIZE LIKE RMCS4-MC_CM_PSIZE VALUE '10000'.
DATA: BEGIN OF I_BSEG OCCURS 0,
BELNR TYPE BSEG-BELNR,
BURKS TYPE BSEG-BURKS,
GJAHR TYPE BSEG-GJAHR,
BUZEI TYPE BSEG-BUZEI,
DMBTR TYPE BSEG-DMBTR,
SHKZG TYPE BSEG-SHKZG.
DATA: END OF I_BSEG.
DATA: TOT_DMBTR TYPE BSEG-DMBTR,
TOT_REC TYPE I.
SELECTION-SCREEN BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP.
PARAMETERS: P_SIZE LIKE RMCS4-MC_CM_PSIZE DEFAULT '10000'.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK B01.
START-OF-SELECTION.
PACKAGE_SIZE = P_SIZE.
OPEN CURSOR WITH HOLD CURS FOR
SELECT BELNR BURKS GJAHR BUZEI DMBTR SHKZG
FROM BSEG
WHERE BELNR <> SPACE
AND BURKS <> SPACE
AND GJAHR <> SPACE
AND BUZEI <> SPACE.
*Fetch internal table I_BSEG for every 10000 records.
DO.
FETCH NEXT CURSOR CURS
INTO TABLE I_BSEG PACKAGE SIZE PACKAGE_SIZE.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDDO.
CLOSE CURSOR CURS.
LOOP AT I_BSEG.
TOT_REC = TOT_REC + 1.
IF I_BSEG-SHKZG = 'S'.
TOT_DMBTR = TOT_DMBRT + I_BSEG-DMBTR * -1.
ELSE.
TOT_DMBTR = TOT_DMBTR + I_BSEG-DMBTR.
ENDIF.
ENDLOOP.
WRITE: / 'TOTAL BSEG-DMBTR:', TOT_DMBTR,
/ 'TOTAL RECORD: ', TOT_REC.
END-OF-SELECTION.
Hope this will help.
Regards,
Ferry Lianto -
Need sample code with RV_INVOICE_CREATE used
Hi everybody!
I need sample code with RV_INVOICE_CREATE or similar FMs used.
The thing is that I do not know how to populate parametres of this and other invoicing FMs....
For example, there are some tables to be passed to RV_INVOICE_CREATE
TABLES
XKOMFK = XKOMFK
XKOMV = XKOMV
XTHEAD = XTHEAD
XVBFS = XVBFS
XVBPA = XVBPA
XVBRK = XVBRK
XVBRP = XVBRP
XVBSS = XVBSS
How to populate them? I mean how to fill them with needed values?
Useful answers will be awarded.
Kind regards, M.RV_INVOICE_CREATE is the function module to create invoice based on delivery .
when you pass delivery number ,it will create invoice ,see the invoice number in vf02,vf03 transaction. and also see the data vbrk,vbrp tables
I have done this development and i have cancelled invoice,reverse goods issue,updated the delivery and again i am createing invoice..see the below progrm to get better understanding.
REPORT ZWM_OVERWEIGHT_FIX no standard page heading
message-id zwm.
======================================================================
Program Name : ZWM_OVERWEIGHT_FIX *
Description : Tool to fix Overweight in delivery line item, *
Used All Function module to cancel invoice , *
Reverse the goods issue ,Update Delivery qty,Create *
invoice *
Author : Seshu *
Date : 05/08/2007 *
MODIFICATION HISTORY *
DATE | AUTHOR | CHANGE # | DESCRIPTION OF MODIFICATION *
--|||--
05/08/07| Seshu | DEVK921979 | Initial *
D A T A - D E C L A R A T I O N *******************
Tables
Tables : vbak,
vbap,
vbfa,
likp,
lips,
vbrk,
vbrp.
Internal Tables
data : i_lips like lips occurs 0 with header line,
i_vbap like vbap occurs 0 with header line.
Variables
data : v_deliv like vbfa-vbelv,
v_invoic like vbfa-vbelv.
Data Declaration Part for Post Goods Issue
DATA: l_vbeln LIKE likp-vbeln,
l_vbkok LIKE vbkok,
i_prot LIKE prott OCCURS 0 WITH HEADER LINE,
ef_error_any_0 TYPE c,
ef_error_in_item_deletion_0 TYPE c,
ef_error_in_pod_update_0 TYPE c,
ef_error_in_interface_0 TYPE c,
ef_error_in_goods_issue_0 TYPE c,
ef_error_in_final_check_0 TYPE c,
d_return LIKE bapireturn1.
Internal tables for BAPI Function Module
data : i_cret like BAPIRETURN1 occurs 0 with header line,
i_csucess like BAPIVBRKSUCcESS occurs 0 with header line,
i_ret2 like bapiret2 ,
flag type c,
i_mesg like mesg occurs 0 with header line.
Data Declaration for Invoice Creation
DATA: VBSK_I LIKE VBSK.
data: d_success type c.
DATA: XKOMFK LIKE KOMFK OCCURS 0 WITH HEADER LINE,
XKOMV LIKE KOMV OCCURS 0 WITH HEADER LINE,
XTHEAD LIKE THEADVB OCCURS 0 WITH HEADER LINE,
XVBFS LIKE VBFS OCCURS 0 WITH HEADER LINE,
XVBPA LIKE VBPAVB OCCURS 0 WITH HEADER LINE,
XVBRK LIKE VBRKVB OCCURS 0 WITH HEADER LINE,
XVBRP LIKE VBRPVB OCCURS 0 WITH HEADER LINE,
XVBSS LIKE VBSS OCCURS 0 WITH HEADER LINE,
XKOMFKGN LIKE KOMFKGN OCCURS 0 WITH HEADER LINE.
S E L E C T I O N - S C R E E N ******************
Selection-screen
Selection-screen : begin of block blk with frame title text-001.
parameters : p_vbeln like vbak-vbeln obligatory.
selection-screen : end of block blk.
A T - S E L E C T I O N - S C R E E N ***************
Validation on Sales order
at selection-screen on p_vbeln.
Check the data on VBAK Table
select single vbeln from vbak into vbak-vbeln
where vbeln = p_vbeln.
if sy-subrc ne 0.
message e006 with p_vbeln.
endif.
S T A R T - O F - S E L E C T I O N *******************
Start-of-selection.
break sreddy.
Get the Invoice Number corresponding Sales Order Number
perform get_invoice.
Step 1.
Cancel the Invoice - Transaction VF11
perform cancel_invoice.
Reverse the goods issue
perform reverse_goodsissue.
Get the Order and Delivery Items
perform get_sales_deliv.
Delivery Change
perform Delivery_change.
Create Invoice document
perform invoice_create.
E N D - O F - S E L E C T I O N *******************
end-of-selection.
if flag = 'X'.
message i012 with p_vbeln.
endif.
*& Form get_invoice
Get Invoice Number
FORM get_invoice.
Clear Variables
clear : v_deliv,
v_invoic,
flag.
Get the Delivery Number First
select single vbeln from vbfa into v_deliv
where vbelv = p_vbeln
and vbtyp_n = 'J'.
if sy-subrc ne 0.
message i004 with p_vbeln.
stop.
endif.
Get the Invoice Number
select single vbeln from vbfa into v_invoic
where vbelv = p_vbeln
and vbtyp_n = 'M'.
if sy-subrc ne 0.
message i003 with p_vbeln.
stop.
endif.
ENDFORM. " get_invoice
*& Form cancel_invoice
Cancel the Invoice
FORM cancel_invoice.
clear : i_ret2,
i_cret,
i_csucess.
refresh : i_cret,
i_csucess.
CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
EXPORTING
BILLINGDOCUMENT = v_invoic
TESTRUN =
NO_COMMIT =
BILLINGDATE =
TABLES
RETURN = i_cret
SUCCESS = i_csucess
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = space
IMPORTING
RETURN = i_ret2.
read table i_cret with key type = 'E'.
if sy-subrc ne 0.
message i005 with v_invoic.
stop.
endif.
ENDFORM. " cancel_invoice
*& Form reverse_goodsissue
Reverse the goods Issue
FORM reverse_goodsissue.
Local Variable
data : lv_vbtyp like likp-vbtyp.
clear : i_mesg,
lv_vbtyp.
refresh : i_mesg.
select single vbtyp from likp into lv_vbtyp
where vbeln = v_deliv.
CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
EXPORTING
I_VBELN = v_deliv
I_BUDAT = sy-datum
I_COUNT =
I_MBLNR =
I_TCODE =
I_VBTYP = lv_vbtyp
TABLES
T_MESG = i_mesg
EXCEPTIONS
ERROR_REVERSE_GOODS_ISSUE = 1
OTHERS = 2
if sy-subrc ne 0.
message i007 with v_deliv.
endif.
ENDFORM. " reverse_goodsissue
*& Form get_sales_deliv
Get the Sales order and Deliv Items
FORM get_sales_deliv.
Local Variables
data : lv_kwmeng like vbap-kwmeng.
clear : i_lips,
i_vbap.
refresh : i_lips,
i_vbap.
Select the data from LIPS
select * from lips into table i_lips
where vbeln = v_deliv.
if sy-subrc ne 0.
message i008 with v_deliv.
stop.
endif.
sort i_lips by vbeln posnr.
Get the Sales order Item Data.
select * from vbap into table i_vbap
where vbeln = p_vbeln.
if sy-subrc ne 0.
message i006 with p_vbeln.
stop.
endif.
sort i_vbap by vbeln posnr.
Compare delivery Item and Order Items
loop at i_lips.
clear lv_kwmeng.
read table i_vbap with key posnr = i_lips-posnr.
if sy-subrc eq 0.
lv_kwmeng = i_vbap-kwmeng * 2.
if lv_kwmeng >= i_lips-lfimg.
i_lips-lfimg = i_vbap-kwmeng.
modify i_lips.
endif.
endif.
endloop.
ENDFORM. " get_sales_deliv
*& Form Delivery_change
Delivery Update
FORM Delivery_change.
Clear : i_prot.
refresh : i_prot.
Delivery Update
CALL FUNCTION 'LE_MOB_DELIVERY_UPDATE'
EXPORTING
do_commit = 'X'
TABLES
t_delivery_items = i_lips
prot = i_prot
EXCEPTIONS
conversion_overflow = 1
essential_data_missing = 2
error = 3
nothing_to_update = 4
lock_after_update_failed = 5
error_in_delivery_update = 6
OTHERS = 7.
COMMIT WORK.
IF sy-subrc <> 0.
MESSAGE i009 with v_deliv.
endif.
Post Goods Issue
CLEAR: d_return,
i_prot,
l_vbeln,
l_vbkok.
REFRESH i_prot.
CLEAR: ef_error_in_item_deletion_0 ,
ef_error_in_pod_update_0 ,
ef_error_in_interface_0 ,
ef_error_in_goods_issue_0 ,
ef_error_in_final_check_0 .
carry out goods issue
l_vbeln = v_deliv.
l_vbkok-vbeln_vl = l_vbeln.
l_vbkok-wabuc = 'X'.
carry out goods issue
l_vbeln = v_deliv.
l_vbkok-vbeln_vl = l_vbeln.
l_vbkok-wabuc = 'X'.
SET UPDATE TASK LOCAL.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = l_vbkok
synchron = 'X'
no_messages_update = ' '
update_picking = 'X'
commit = 'X'
delivery = l_vbeln
nicht_sperren = 'X'
if_error_messages_send_0 = space
IMPORTING
ef_error_any_0 = ef_error_any_0
ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
ef_error_in_pod_update_0 = ef_error_in_pod_update_0
ef_error_in_interface_0 = ef_error_in_interface_0
ef_error_in_goods_issue_0 = ef_error_in_goods_issue_0
ef_error_in_final_check_0 = ef_error_in_final_check_0
TABLES
prot = i_prot
EXCEPTIONS
error_message = 1
OTHERS = 2.
if sy-subrc ne 0.
message i010 with v_deliv.
else.
COMMIT WORK .
endif.
ENDFORM. " Delivery_change
*& Form invoice_create
Invoice Creation
FORM invoice_create.
refresh: XKOMFK, XKOMV,
XTHEAD, XVBFS,
XVBPA, XVBRK,
XVBRP, XVBSS.
clear : XKOMFK, XKOMV,
XTHEAD, XVBFS,
XVBPA, XVBRK,
XVBRP, XVBSS,
VBSK_I.
VBSK_I-SMART = 'F'.
XKOMFK-VBELN = v_deliv.
XKOMFK-VBTYP = 'J'.
APPEND XKOMFK.
CALL FUNCTION 'RV_INVOICE_CREATE'
EXPORTING
VBSK_I = VBSK_I
WITH_POSTING = 'C'
TABLES
XKOMFK = XKOMFK
XKOMV = XKOMV
XTHEAD = XTHEAD
XVBFS = XVBFS
XVBPA = XVBPA
XVBRK = XVBRK
XVBRP = XVBRP
XVBSS = XVBSS.
if sy-subrc eq 0.
COMMIT WORK.
flag = 'X'.
else.
message i011 with p_vbeln.
endif.
ENDFORM. " invoice_create
Reward Points if it is helpful
Thanks
Seshu
Maybe you are looking for
-
Buttons not appearing after given time
Captivate is driving me absolutely mad... I am attempting to make an elearning app with audio narration on some slides, and some quiz slides and branching. I have set the default slide display time to 600 sec. I am using audio files for narration and
-
Notes on I-pod, I-phone and I-pad disappeared. Any way to get them back?
The yellow "notes" application on all 3 of my mobile devices lost all of my entries except five. I thought all Apple devices were safe from viruses etc. so I had important entries on there going back to 2010. I also have the I-Cloud and its not on
-
Problem with InDesign export to PDF
Hi All: I hope someone who knows Acrobat can help me with this. I have an InDesign file that I must export to PDF. That in itself isn't the problem. This is: The text in InDesign is aolid black (000000), but once it exports to PDF, it collects a myri
-
hello gurus, I have 3 storage type p1, p2, p3. The same is the order mention in the storage type search. Now wen i do a GI , the system picks material from storage type P2 , when material is available in P1.the picking strategy is next bin search. Al
-
Hi, I am trying to implement the BADI CRM_IC_IARECORD for suppressing creation of interaction records.The interaction record should get generated only when the user clicks on the interaction record work center. I passed RV_SUPPRESS_IREC as true but t