ZIDOC From Ztable. ?
Hi Experts,
I have some Requirement i which i Need to create an Outbound IDOC From Z table. ( Any New Insertion / Updation of record in this Z table ).
There is no standard IDOC which I can use for this functionality.
Can Anybody tell me is it possible ? if Yes how to Do it.
Can anybody give me steps how to configure this.
Any Sample Program / FM to do this. ?
I am Already having a Partner Profile & distribution Model Rady.
Pl. Note that I want this to happend as soon as record is getting added in this table. I dont want to execute any program in Background & then push this data.
it should be real time.
Regards,
Umesh
Hi
Data Creation in Idoc
IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system. Instead of calling a program in the destination system directly, the data is first packed into an IDoc and then sent to the receiving system, where it is analyzed and properly processed. Therefore an IDoc data exchange is always an
asynchronous process. The significant difference between simple RFC-calls and IDoc data exchange is the fact, that every action performed on IDocs are protocolled by R/3 and IDocs can be reprocessed if an error occurred in one of the message steps.
While IDocs have to be understood as a data exchange protocol, EDI and ALE are typical use cases for IDocs. R/3 uses IDocs for both EDI and ALE to deliver data to the receiving system. ALE is basically the scheduling mechanism that defines when and between which partners and what kind of data will be exchanged on a regular or event triggered basis. Such a set-up is called an ALE-scenario.
IDoc is a intermediate document to exchange data between two SAP Systems.
*IDocs are structured ASCII files (or a virtual equivalent).
*Electronic Interchange Document
*They are the file format used by SAP R/3 to exchange data with foreign systems.
*Data Is transmitted in ASCII format, i.e. human readable form
*IDocs exchange messages
*IDocs are used like classical interface files
IDOC types are templates for specific message types depending on what is the business document, you want to exchange.
WE30 - you can create a IDOC type.
An IDOC with data, will have to be triggered by the application that is trying to send out the data.
FOr testing you can use WE19.
How to create idoc?
*WE30 - you can create a IDOC type
For more information in details on the same along with the examples can be viewed on:
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm#_Toc8400404
http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a6620507d11d18ee90000e8366fc2/frameset.htm
http://www.sappoint.com/presentation.html
http://www.allsaplinks.com/idoc_search.html
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://www.erpgenie.com/sapedi/idoc_abap.htm
To Create Idoc we need to follow these steps:
Create Segment ( WE31)
Create Idoc Type ( WE30 )
Create Message Type ( WE81 )
Assign Idoc Type to Message Type ( WE82 )
Creating a Segment
Go to transaction code WE31
Enter the name for your segment type and click on the Create icon
Type the short text
Enter the variable names and data elements
Save it and go back
Go to Edit -> Set Release
Follow steps to create more number of segments
Create IDOC Type
Go to transaction code WE30
Enter the Object Name, select Basic type and click Create icon
Select the create new option and enter a description for your basic IDOC type and press enter
Select the IDOC Name and click Create icon
The system prompts us to enter a segment type and its attributes
Choose the appropriate values and press Enter
The system transfers the name of the segment type to the IDOC editor.
Follow these steps to add more number of segments to Parent or as Parent-child relation
Save it and go back
Go to Edit -> Set release
Create Message Type
Go to transaction code WE81
Change the details from Display mode to Change mode
After selection, the system will give this message The table is cross-client (see Help for further info). Press Enter
Click New Entries to create new Message Type
Fill details
Save it and go back
Assign Message Type to IDoc Type
Go to transaction code WE82
Change the details from Display mode to Change mode
After selection, the system will give this message The table is cross-client (see Help for further info). Press Enter.
Click New Entries to create new Message Type.
Fill details
Save it and go back
Check these out..
Re: How to create IDOC
Check below link. It will give the step by step procedure for IDOC creation.
http://www.supinfo-projects.com/cn/2005/idocs_en/2/
ALE/ IDOC
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sappoint.com/abap.html
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.docs
go trough these links.
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sappoint.com/abap.html
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.allsaplinks.com/idoc_sample.html
http://http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
An IDoc is simply a data container that is used to exchange information between any two processes that can understand the syntax and semantics of the data...
1.IDOCs are stored in the database. In the SAP system, IDOCs are stored in database tables.
2.IDOCs are independent of the sending and receiving systems.
3.IDOCs are independent of the direction of data exchange.
The two available process for IDOCs are
Outbound Process
Inbound Process
AND There are basically two types of IDOCs.
Basic IDOCs
Basic IDOC type defines the structure and format of the business document that is to be exchanged between two systems.
Extended IDOCs
Extending the functionality by adding more segments to existing Basic IDOCs.
To Create Idoc we need to follow these steps:
Create Segment ( WE31)
Create Idoc Type ( WE30)
Create Message Type ( WE81)
Assign Idoc Type to Message Type ( WE82)
imp links
http://www.allsaplinks.com/idoc_sample.html
http://www.sapgenie.com/sapedi/idoc_abap.htm
www.sappoint.com
--here u can find the ppts and basic seetings for ALE
http://sappoint.com/presentation.html
www.sapgenie.com
http://www.sapgenie.com/ale/index.htm
Reward points if useful
Regards
Anji
Similar Messages
-
Filling a field in Infoset(LDB-PNPCE) from it001 but want to fil from ztabl
Hello All,
I have created a Infoset query with LDB (PNPCE) .
In infoset query has one field called description is filling from standard LDB PNPCE under orgnizational unit(it001).
This description field from Standard LDB pnpce ---infotype0001and now i want to fill this field based on Ztable .
How to achive this .Please help me.
Thank you
best regadrs
TrupthiHi,
Change in standard field is not the best practice.
You can write program in adhoc query
instead of changing logic in that , create a new field and write a small code and fetch data from Ztable which u r planing.
steps to create that are given below.
Go to Sq02 - enter your infoset and click on change
Select additional fields of particular infotype where you want to create additional field
Select extras button in the menu and click on create
Select the option and Enter the name of the field, Select Additional field and click on Continue
Enter the data required data.Click on Continue.
New field created .
Select the field and click on code button
enter code and generate program.
Regards,
Naveen -
Transporting ZIDOC from DEV to QA
Hi people,
How can I transport an ZIDOC from DEV system to QA system? Didn't find a way of putting an IDOC in a transport request... we can transport ZIDOC's by this way or there is another way?
thank you,
robertiMake a simple dummy change in the IDOC Segment (we31) and put it in a transport request.
regards.
roberti -
How to fetch all the records from ztable
Hi
My program is outbound program.
According to the requirement i have to fetch all the records from ztable which are not tranmitted before to the third party and once the records are extracted and written to output file they will be marked as 'X' in the "status" field of that ztable for the next days run.
How to fetch the records.Please suggest me.
Thanks,
NeelimaHI,
Fetch all the records whose status is equal to 'X' as whatever data is sent to third party system is marked as 'X' in status field of table after sending.
You need to first fetch the data into internal table using the select statement where status EQ space. You get the data which is not yet transmitted to third part. And later in the program after trasmitting the data to third party modify the Records in the DB table which are transmitted with Staus eq 'X'. -
Material Variant configuration in sales order line item from Ztable
Hello Experts,
we have configurable material and and creating sales order. from sales order line item if we goto configuration we can maintain variant configurations. My requirement is that when i click on configuration after selecting a line item i need to check ztable where i have material no and and relable text. if an entry exists i have to populate this relable text in one of the configuration filed. Can any one help how can i read and update configuration in sales order level and where to do this coding so that when i click on configuration the value from ztable populated in a field.
Many thanks in advance.Hi Senthil,
It is simple.
When you create a characteristic which should have the value maintained in the Z table, go to the tab values. Here you have a push button called "Other Value check". Here you click this button and select the function module option. Now, in the window, you will have a place where you can mention the name of teh function module.
You create a function module with the help of your developer to find out the text maintained in the Z table using teh rules you have in your mind and update that logic in the characteristic. In the earlier screen, you just have to mention the name of the function module, thats all, your work is done.
Now when you configure, for this characteristic, the value will be automatically determined using teh function module. You have to create such characteristics as "Not ready for input" ones in additional data for which you cannot enter values manually.
Hope this helps. -
Hi Experts
Does any one have idea how to load the hierarchy to BW from Ztable in R3. The one way I know is to import the Ztable data into Flat file and load it in to BW.
If you know any other best solution using which I can eliminate flat file load , please let me know.
thanks,
Raj.Hi Raj,
Even though if your data in your Z-table in tree structure you have to download the data into flat file and then you have upload the same. I think you cannot create Generic datasource for Hierarchy.
If you have your data in Flat structure in the table then this same code may help you.
* PROGRAM FOR GL ACCOUNT HIERARCHY
* Program name : GL hierarchy
* Program Description : Report
* Technical Object No :
* Developer : N.S.Balaji
* Level2 Analyst/FC :
* Company :
* Start Date :
* End Date :
* Initial CTS :
* Description :
* Transaction : NA
* External References : NA
* Logical Database : NA
* Function Modules : NA
* Includes : NA
* MODIFICATIONS lOG
* Developer :
* Level2 Analyst :
* Start Date :
* End Date :
* CCP/PQR/TDL No. :
* CM No: DATE: CTS:
* Description :
report zbiw_glacc_hier line-size 250.
data :
begin of itab occurs 0,
seg(5),
segname(30),
spu(5),
spuname(30),
bu(5),
buname(30),
pu(15),
puname(30),
* cust(8),
* custname(60),
end of itab.
data : itab_all like itab occurs 0 with header line,
itab_root like itab occurs 0 with header line.
data : begin of i_hier occurs 0. " BIW Structure to hold hirearchy
* INCLUDE STRUCTURE E1RSHND.
data: nodeid like e1rshnd-nodeid, "NODE ID
infoobject like e1rshnd-infoobject, "infoobjectNAME
nodename like e1rshnd-nodename, "nodename year
link(5), " LIKE E1RSHND-LINK, "linkname
parentid like e1rshnd-parentid. "parent id
data: leafto(32), "Interval - to
leaffrom(32). "Interval - from
include structure e1rsrlt.
include structure rstxtsml.
*DATA : PARENT LIKE E1RSHND-NODENAME.
data : end of i_hier.
data : sr(8) type n value '00000000'.
data : begin of itab1 occurs 0, " Node Level1 of Hierarchy
z_ah_level1 like itab-seg,
z_ah_level2 like itab-spu,
z_ah_desc_level2 like itab-spuname,
end of itab1.
data : begin of itab2 occurs 0, " Node Level1 of Hierarchy
z_ah_level2 like itab-spu,
z_ah_level3 like itab-bu,
z_ah_desc_level3 like itab-buname,
end of itab2.
data : begin of itab3 occurs 0, " Node Level3 of Hierarchy
z_ah_level3 like itab-bu,
z_ah_level4 like itab-pu,
z_ah_desc_level4 like itab-puname,
end of itab3.
data wa like itab.
data : begin of itab_first occurs 0, " Node Level2 of Hierarchy
z_ah_level1 like ITAB-SEG,
end of itab_first.
data : begin of itab_sec occurs 0, " Node Level2 of Hierarchy
z_ah_level2 like ITAB-SPU,
end of itab_sec.
data : begin of itab_third occurs 0, " Node Level2 of Hierarchy
z_ah_level3 like ITAB-BU,
end of itab_third.
data : begin of i_download occurs 0,
record(250),
end of i_download.
data : v_pid like e1rshnd-nodeid,
v_line(250).
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = 'C:/'
FILETYPE = 'DAT'
TABLES
DATA_TAB = itab .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
itab_all[] = itab[].
itab_root[] = itab_all[].
sort itab_all by seg spu bu pu .
sort itab_root by seg.
delete adjacent duplicates from itab_root comparing seg.
* Appending Root level of node
* sr = 00000001.
* move : sr to i_hier-nodeid,
* '0HIER_NODE' to i_hier-infoobject,
* 'SHA HIERARCHY' to i_hier-nodename,
* '00000000' to i_hier-parentid,
* 'EN' to i_hier-langu,
* 'SHA HIERARCHY' to i_hier-txtmd.
* append i_hier.
* clear i_hier.
v_pid = '00000000'.
loop at itab_root.
if itab_root-seg = itab_root-spu.
delete itab_root.
endif.
endloop.
loop at itab_root.
* Appending first level of the node
sr = sr + 1.
move : sr to i_hier-nodeid,
'0HIER_NODE' to i_hier-infoobject,
itab_root-seg to i_hier-nodename,
v_pid to i_hier-parentid,
'EN' to i_hier-langu,
itab_root-segname to i_hier-txtsh,
itab_root-segname to i_hier-txtmd,
itab_root-segname to i_hier-TXTLG.
append i_hier.
clear i_hier.
endloop.
loop at itab_all.
move itab_all to wa.
* Separation of level 3 of the node
at new spu.
if not wa-spu is initial.
move : wa-seg to itab1-z_ah_level1,
wa-spu to itab1-z_ah_level2,
wa-spuname to itab1-z_ah_desc_level2.
append itab1.
clear itab1.
endif.
endat.
* Separation of level 3 of the node
at new bu.
if not wa-bu is initial.
move : wa-spu to itab2-z_ah_level2,
wa-bu to itab2-z_ah_level3,
wa-buname to itab2-z_ah_desc_level3.
append itab2.
clear itab2.
endif.
endat.
* Separation of level 2 of the node
at new pu.
if not wa-pu is initial.
move : wa-bu to itab3-z_ah_level3,
wa-pu to itab3-z_ah_level4,
wa-puname to itab3-z_ah_desc_level4.
append itab3.
clear itab3.
endif.
endat.
clear wa.
endloop.
sort itab1 by z_ah_level1 z_ah_level2.
delete adjacent duplicates from itab1 comparing z_ah_level1
z_ah_level2.
sort itab2 by z_ah_level2 z_ah_level3.
delete adjacent duplicates from itab2 comparing z_ah_level2
z_ah_level3.
sort itab3 by z_ah_level3 z_ah_level4.
delete adjacent duplicates from itab3 comparing z_ah_level3
z_ah_level4.
loop at itab_root.
move itab_root-SEG to itab_first-z_ah_level1.
append itab_first.
clear itab_first.
endloop.
itab_sec[] = itab2[].
itab_third[] = itab3[].
sort itab_first by z_ah_level1.
delete adjacent duplicates from itab_first.
sort itab_sec by z_ah_level2.
delete adjacent duplicates from itab_sec.
sort itab_third by z_ah_level3.
delete adjacent duplicates from itab_third.
data : indx like sy-tabix.
clear indx.
loop at itab_first.
indx = sy-tabix.
read table itab_sec with key z_ah_level2 = itab_first-z_ah_level1
binary search.
if sy-subrc eq 0.
delete itab_first index indx.
endif.
endloop.
clear indx.
loop at itab_sec.
indx = sy-tabix.
read table itab_third with key z_ah_level3 = itab_sec-z_ah_level2
binary search.
if sy-subrc eq 0.
delete itab_sec index indx.
endif.
endloop.
clear indx.
clear indx.
loop at itab1.
If itab1-z_ah_level1 = itab1-z_ah_level2.
delete itab1.
endif.
endloop.
loop at itab2.
If itab2-z_ah_level2 = itab2-z_ah_level3.
delete itab2.
endif.
endloop.
loop at itab3.
If itab3-z_ah_level3 = itab3-z_ah_level4.
delete itab3.
endif.
endloop.
* Appending First level node to Hierarchy table
loop at itab_root.
loop at itab1 where z_ah_level1 = itab_root-SEG.
read table i_hier with key nodename = itab1-z_ah_level2.
if sy-subrc ne 0.
read table i_hier with key nodename = itab1-z_ah_level1.
if sy-subrc eq 0.
move i_hier-nodeid to i_hier-parentid.
* Appending First level node to Hierarchy table
sr = sr + 1.
move : sr to i_hier-nodeid,
'0HIER_NODE' to i_hier-infoobject,
itab1-z_ah_level2 to i_hier-nodename,
'EN' to i_hier-langu,
itab1-z_ah_desc_level2 to i_hier-txtsh,
itab1-z_ah_desc_level2 to i_hier-txtmd,
itab1-z_ah_desc_level2 to i_hier-txtlg.
append i_hier.
clear i_hier.
endif.
endif.
endloop.
endloop.
* Appending second level node to Hierarchy table
loop at itab_sec.
loop at itab2 where z_ah_level2 = itab_sec-z_ah_level2.
read table i_hier with key nodename = itab2-z_ah_level3.
if sy-subrc ne 0.
read table i_hier with key nodename = itab2-z_ah_level2.
if sy-subrc eq 0.
move i_hier-nodeid to i_hier-parentid.
* Appending second level node to Hierarchy table
sr = sr + 1.
move : sr to i_hier-nodeid,
'0HIER_NODE' to i_hier-infoobject,
itab2-z_ah_level3 to i_hier-nodename,
'EN' to i_hier-langu,
itab2-z_ah_desc_level3 to i_hier-txtsh,
itab2-z_ah_desc_level3 to i_hier-txtmd,
itab2-z_ah_desc_level3 to i_hier-txtlg.
append i_hier.
clear i_hier.
endif.
endif.
endloop.
endloop.
* Appending third level node to Hierarchy table
loop at itab_third.
loop at itab3 where z_ah_level3 = itab_third-z_ah_level3.
read table i_hier with key nodename = itab3-z_ah_level4.
if sy-subrc ne 0.
read table i_hier with key nodename = itab3-z_ah_level3.
if sy-subrc eq 0.
move i_hier-nodeid to i_hier-parentid.
* Appending third level node to Hierarchy table
sr = sr + 1.
move : sr to i_hier-nodeid,
* 'ZGL_AC_CD' to i_hier-infoobject,
'0GL_ACCOUNT' to i_hier-infoobject,
itab3-z_ah_level4 to i_hier-nodename,
'EN' to i_hier-langu,
itab3-z_ah_desc_level4 to i_hier-txtsh,
itab3-z_ah_desc_level4 to i_hier-txtmd,
itab3-z_ah_desc_level4 to i_hier-txtlg.
append i_hier.
clear i_hier.
endif.
endif.
endloop.
endloop.
loop at i_hier.
concatenate i_hier-nodeid i_hier-infoobject i_hier-nodename
i_hier-link i_hier-parentid i_hier-leafto
i_hier-leaffrom i_hier-langu i_hier-txtsh
i_hier-txtmd i_hier-txtlg into v_line
separated by ','.
move v_line to i_download-record.
append i_download.
write : / i_hier.
endloop.
perform f_download.
**& Form f_download
** text
** --> p1 text
** <-- p2 text
form f_download.
call function 'DOWNLOAD'
exporting
* BIN_FILESIZE = ' '
* CODEPAGE = ' '
* FILENAME = ' '
filetype = 'DAT'
* ITEM = ' '
* MODE = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* FILEMASK_MASK = ' '
* FILEMASK_TEXT = ' '
* FILETYPE_NO_CHANGE = ' '
* FILEMASK_ALL = ' '
* FILETYPE_NO_SHOW = ' '
* SILENT = 'S'
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
* IMPORTING
* ACT_FILENAME =
* ACT_FILETYPE =
* FILESIZE =
* CANCEL =
tables
data_tab = i_download
* FIELDNAMES =
* EXCEPTIONS
* INVALID_FILESIZE = 1
* INVALID_TABLE_WIDTH = 2
* INVALID_TYPE = 3
* NO_BATCH = 4
* UNKNOWN_ERROR = 5
* GUI_REFUSE_FILETRANSFER = 6
* CUSTOMER_ERROR = 7
* OTHERS = 8
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " f_download
this code may need modification as your requirement and this may be the optimized one.
First you have to read data from you Z-table into internal table then need to separate a each node level.
hope this helps.
Cheers,
Balaji -
SELECT * FROM ZTABLE INTO TABLE it_table1.
DELETE ZTABLE FROM TABLE it_table1.Hi,
Check this syntax :
Variants:
1. DELETE FROM dbtab. or
DELETE FROM (dbtabname).
2. DELETE dbtab FROM wa. or
DELETE (dbtabname) FROM wa.
3. DELETE dbtab FROM TABLE itab. or
DELETE (dbtabname) FROM TABLE itab.
4. DELETE dbtab. or
DELETE *dbtab.
5. DELETE dbtab VERSION vers. or
DELETE *dbtab VERSION vers.
Effect
Deletes a set of lines in a database table (see relational database). You can specify the name of the database table either directly in the program in the form DELETE FROM dbtab ... or at runtime as the contents of the variable dbtabname in the form DELETE FROM (dbtabname) .... In both cases, the database table must be known to the ABAP Dictionary. By default, the system deletes only data from the current client. You can only use a view to delete data, if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status "no restriction".
DELETE is part of the OPEN SQL command set.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.See Open SQL and Unicode.
Notes
Authorization checks are not supported by the DELETE statement and must be carried out at program level.
When you delete lines using the DELETE command, the process is only complete after a database commit (see LUW). Before the commit, any database change can be reset using a database rollback (see Programming Transactions).
In dialog systems, synchronizing parallel user access to a single dataset cannot be handled by the locking mechanism of the database system alone. In many cases, you therefore have to use the SAP locking mechanism.
Variant 1
DELETE FROM dbtab. or
DELETE FROM (dbtabname).
Extras:
1. ... WHERE condition
2. ... CLIENT SPECIFIED
3. ... CONNECTION con
Effect
Deletes lines in a database table. If you do not specify a WHERE clause, the system deletes all lines (in the current client). If you specify a WHERE clause, the system deletes all lines that fulfill the WHERE condition.
After the statement is executed, the system field SY-DBCNT contains the number of lines that were deleted.
The Return Code is set as follows:
SY-SUBRC = 0:
At least one line was deleted.
SY-SUBRC = 4:
No line was deleted since no lines were selected.
Example
Delete all flight bookings (in the current client):
DELETE FROM SBOOK.
Addition 1
... WHERE condition
Effect
The system deletes only those lines that fullfill the
condition specified in the WHERE Clause.
Example
Delete all bookings of Lufthansa flight 0400 on 02/28/2001 (in the current client):
DELETE FROM SBOOK WHERE CARRID = 'LH' AND
CONNID = '0400' AND
FLDATE = '20010228'.
Addition 2
... CLIENT SPECIFIED
Effect
Switches off automatic client handling. This allows you
to delete data across all clients in case of client-specific tables. The client field is then handled like a normal table field for which you can specify appropriate conditions in the WHERE clause.
The addition CLIENT SPECIFIED must be specified directly after the name of the database table.
Addition 3
... CONNECTION con
Effect
The Open SQL command is not executed on the
standard database but on the Secondary Database Connection specified using con. con is the name of the database connection as it was specified in the table DBCON in the column CON_NAME. The database connection con can als be specified dynamically in the form (source_text) - the field source_text contains the name of the database connection and must be type C or STRING.
The CONNECTION con addition must be specified directly after the name of the database table or after the CLIENT SPECIFIED addition.
Variant 2
DELETE dbtab FROM wa. or
DELETE (dbtabname) FROM wa.
Extras:
1. ... CLIENT SPECIFIED
2. ... CONNECTION con
Effect
These are SAP-specific short forms to delete a single line from a database table. The primary key for the line to be deleted is taken from the explicitly specified work area wa. The key values are read from left to right according to the structure of the primary key of the database table. The structure of wa is not considered. This is why the work area wa must be at least as wide (DATA) as the primary key of the database table dbtab, and the alignment of the work area wa must correspond to that of the database table. Otherwise, a runtime error occurs.
If the database table dbtab or the work area wa contain strings, wa must be compatible with the line structure of dbtab.
After the statement is executed, the sytem field SY-DBCNT contains the number of lines that were deleted (0 or 1).
The Return Code is set as follows:
SY-SUBRC = 0:
The line was deleted.
SY-SUBRC = 4:
No line could be deleted since there was no line with the primary key specified.
Example
Delete the booking with the booking number 3 of Lufthansa flight 0400 on 02/28/2001 (in the current client):
DATA wa TYPE sbook.
wa-carrid = 'LH'.
wa-connid = '0400'.
wa-fldate = '20010228'.
wa-bookid = '00000003'.
DELETE sbook FROM wa.
Addition 1
... CLIENT SPECIFIED
Effect
As in variant 1.
Addition 2
... CONNECTION con
Effect
As in variant 1.
Variant 3
DELETE dbtab FROM TABLE itab.
DELETE (dbtabname) FROM TABLE itab.
Extras:
1. ... CLIENT SPECIFIED
2. ... CONNECTION con
Effect
Deletes sets: All lines of the database table for which the internal table itab contains values for the fields of the primary key are deleted. The lines of the internal table itab must fulfill the same conditions as the work area wa in variant 2.
The system field SY-DBCNT contains the number of lines that were deleted, that is, the number of lines in the internal table itab for whose key values lines existed in the database table dbtab.
The Return Code is set as follows:
SY-SUBRC = 0:
All lines in itab could be used for deleting lines in dbtab.
SY-SUBRC = 4:
For at least one line of the internal table, the database table did not contain a line with the same primary key. All lines found were deleted.
Note
If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0.
Addition 1
... CLIENT SPECIFIED
Effect
As in variant 1.
Addition 2
... CONNECTION con
Effect
As in variant 1.
Variant 4
DELETE dbtab. or
DELETE *dbtab.
Addition:
... CLIENT SPECIFIED
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas.See Cannot Use Short Forms and Cannot Use * Work Areas.
Note
This variant is obsolete.
Effect
These are the SAP-specific short forms of variant 2. They work like variant 2 but the work area is not specified explicitly. Instead, the table work area dbtab or *dbtab is implicitly used which is declared with a TABLES statement.
DELETE dbtab. or
DELETE *dbtab.
is also equivalent to
DELETE dbtab FROM dbtab. or
DELETE dbtab FROM *dbtab.
After the statement is executed, the system field SY-DBCNT contains the number of lines that were deleted (0 or 1).
The Return Code is set as follows:
SY-SUBRC = 0:
The line was deleted.
SY-SUBRC = 4:
No line could be deleted since no line with the primary key specified existed.
Example
Delete the booking with the booking number 3 of Lufthansa flight 0400 on 02/28/2001 (in the current client):
TABLES sbook.
sbook-carrid = 'LH'.
sbook-connid = '0400'.
sbook-fldate = '20010228'.
sbook-bookid = '00000003'.
DELETE sbook.
Note
If you do not explicitly specify a work area, the values for the line to be deleted are taken from the table work area dbtab even if the statement occurs in a subroutine (FORM) or function module (FUNCTION), in which the table work area is obscured by an identically named formal parameter or local variable.
Addition
... CLIENT SPECIFIED
Effect
As in variant 1.
Variant 5
DELETE dbtab VERSION vers.
DELETE *dbtab VERSION vers.
This variant is not allowed in an ABAP Objects context.See Cannot use the VERSION Addition.
Note
This variant has become obsolete since the variants 1 - 3 allow you to specify the database table name dynamically.
Effect
Deletes a line in a database table whose name is taken from the field vers at runtime. The database table must be known to the ABAP Dictionary, and its name must comply with the following naming convention: The name must begin with a 'T' and may contain at most five characters, including the leading 'T'. The field vers must contain the table name without the leading 'T'. The system deletes only lines in the current client. The line to be deleted is taken from the statically specified table work area dbtab or *dbtab.
The Return Code is set as follows:
SY-SUBRC = 0:
The line was deleted.
SY-SUBRC = 4:
No line could be deleted since no line with the primary key specified existed.
Additional help
Deleting Table Lines
Laxman -
Recover deleted entries from ztable
Hi
is there any best method to recover the deleted entries from ztable?Hi Vahi,
1. Find out the exact time when the data has been deleted.
2. Restore THE WHOLE DATABASE on any other server with MSSQL server
running on that. You should not restore the database completely,
rather using "Point-in-time" recovery method. Appoint the time from
the p.1 minus 5 minutes as the end point of the database recovery.
Please refer to the note 193816 for more information.
3. Now the old content of the table ZRATE is there. You can
export the data and then import them into the produtive system.
Afterwards you can delete the restored database, it is not needed
anymore.
Thanks!
Anusha -
Send sample prg for alv editable from ztable
Hi ,
Need of prg for alv editable . get data from ztable in standard tool bar i need to create record insert ,delete ,modify existing records .
Thanks in advance.
Regarding,
kumarHi Anil,
> Try like this code i wrote this code for fetch some records from database table and approve/ reject
> the records by clicking buttons.
REPORT zcl_timesheet_approval MESSAGE-ID zcl_msg.
CLASS L_CL_EVENTS DEFINITION *
Class for inserting buttons on the toolbar *
CLASS l_cl_events DEFINITION.
PUBLIC SECTION.
METHODS:
toolbar FOR EVENT toolbar
OF cl_gui_alv_grid
IMPORTING e_object
e_interactive,
user_command FOR EVENT user_command
OF cl_gui_alv_grid
IMPORTING e_ucomm .
ENDCLASS. " L_CL_EVENTS DEFINITION
CLASS L_CL_EVENTS IMPLEMENTATION *
Implementation of class L_CL_EVENTS *
CLASS l_cl_events IMPLEMENTATION.
METHOD toolbar.
PERFORM event_toolbar USING e_object.
ENDMETHOD. " TOOLBAR
METHOD user_command.
PERFORM event_ucomm USING e_ucomm.
ENDMETHOD. " USER_COMMAND
ENDCLASS. " L_CL_EVENTS IMPLEMENTATION
Tables decalration..................................................
TABLES:
zcl_timesheet. " Employee master table
CONSTANTS:
c_boolean_yes(1) TYPE c " Boolean - yes
VALUE 'X',
c_approve_status(1) TYPE c " Approval status
VALUE 'A',
c_rej_status(1) TYPE c " Rejected status
VALUE 'R',
c_save_status(1) TYPE c " Save status
VALUE 'S',
c_fcode_approve(7) TYPE c " Function code - APPROVE
VALUE 'APPROVE',
c_fcode_rej(6) TYPE c " Function code - REJECT
VALUE 'REJECT',
c_fcode_back(4) TYPE c " Function code - BACK
VALUE 'BACK',
c_fcode_onli(4) TYPE c " Function code - EXECUTE
VALUE 'ONLI',
c_fcode_exit(4) TYPE c " Function code - EXIT
VALUE 'EXIT',
c_fcode_cancel(6) TYPE c " Function code - CANCEL
VALUE 'CANCEL',
c_zero(1) TYPE c " Constant value 0
VALUE '0',
c_alv_scr(7) TYPE c " GUI status : ALV screen
VALUE 'ALV_SCR'.
Type definition...................................................
Type definition of the structure to hold data from table *
zcl_timesheet. *
TYPES:
BEGIN OF type_s_time,
empid TYPE zcl_timesheet-empid,
" Employee ID
workdate TYPE zcl_timesheet-workdate,
" Date
groupid TYPE zcl_timesheet-groupid,
" Group ID
projectid TYPE zcl_timesheet-projectid,
" Project ID
projectname TYPE zcl_timesheet-projectname,
" Project name
objectid TYPE zcl_timesheet-objectid,
" Object ID
objectname TYPE zcl_timesheet-objectname,
" Object name
activityid TYPE zcl_timesheet-activityid,
" Activity ID
activityname TYPE zcl_timesheet-activityname,
" Activity name
timeworked TYPE zcl_timesheet-timeworked,
" Time spent on work
description TYPE zcl_timesheet-description,
" Description
taskstatus TYPE zcl_timesheet-taskstatus,
" Status of the proj
billstatus TYPE zcl_timesheet-billstatus,
" Billing status
appstatus TYPE zcl_timesheet-appstatus,
" Staus of the record
wstatus TYPE zcl_timesheet-wstatus,
" Working status
mngcomment TYPE zcl_timesheet-mngcomment,
" Managers comment
END OF type_s_time.
Field-string declarations...........................................
DATA:
Field-string to build fieldcat.
fs_fcat TYPE lvc_s_fcat,
Field-string for t_timesheet
fs_timesheet TYPE zcl_timesheet.
Working variables...................................................
DATA:
w_valid(1) TYPE c, " To get the flag from check_data
w_display(1) TYPE c, " Flag to display all records
ok_code TYPE syst-ucomm, " Function code on dialog screens
w_okcode TYPE syst-ucomm, " Temporary function code
w_first(1) TYPE c, " To place buttons for first time
w_submit(1) TYPE c, " Flag to display submitted records
w_empid TYPE zcl_emprecord-empid.
" Employee ID for GET parameter
Internal table declarations........................................
DATA:
Internal table to build fieldcat.
t_fcat TYPE lvc_t_fcat,
Internal table to display data.
t_time TYPE TABLE OF type_s_time,
Internal table to hold submitted data.
t_timesheet TYPE TABLE OF zcl_timesheet.
For ALV ...........................................................
DATA:
To create instance for cl_gui_custom_container
g_grid TYPE REF TO cl_gui_custom_container,
To create instance for cl_gui_alv_grid
g_alv TYPE REF TO cl_gui_alv_grid,
To create instance for l_cl_events
g_events TYPE REF TO l_cl_events,
To assign name for custom container
g_container TYPE scrfname VALUE 'CONTAINER',
To assign layout
g_fcatlayo TYPE lvc_s_layo.
Selection screen elements............................................
SELECTION-SCREEN BEGIN OF BLOCK blck WITH FRAME TITLE text-000.
SELECT-OPTIONS:
s_group FOR zcl_timesheet-groupid " Group ID
NO INTERVALS,
s_prjid FOR zcl_timesheet-projectid, " Project ID
s_empid FOR zcl_timesheet-empid, " Employee ID
s_date FOR zcl_timesheet-workdate. " Date
SELECTION-SCREEN END OF BLOCK blck.
SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME TITLE text-015.
PARAMETERS:
p_app RADIOBUTTON GROUP g1 USER-COMMAND app ,
" To approve timesheet
p_disp RADIOBUTTON GROUP g1. " To display timesheet
SELECTION-SCREEN END OF BLOCK blck1.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN.
To perform user actions on the selection screen
PERFORM user_command.
MODULE STATUS_0100 OUTPUT *
This module will create the objects for the instance and display *
the records *
MODULE status_0100 OUTPUT.
SET PF-STATUS c_alv_scr.
PERFORM set_titlebar USING w_display.
If program executed in foreground.
IF sy-batch IS INITIAL.
If g_grid is empty.
IF g_grid IS INITIAL.
To create object for instance grid
CREATE OBJECT g_grid
EXPORTING
container_name = g_container.
To create object for object grid
CREATE OBJECT g_alv
EXPORTING
i_parent = g_grid.
ELSE.
CALL METHOD g_alv->refresh_table_display.
ENDIF. " IF G_GRID IS INITIAL
ENDIF. " IF SY-BATCH IS INITIAL
REFRESH t_fcat.
If w_display eq 'X' .
IF w_display EQ c_boolean_yes.
To display all records except saved data
PERFORM display_allrecords.
ENDIF. " IF W_FLAG EQ C_BOOLEAN_YES
IF w_submit EQ c_boolean_yes.
To display submitted records
PERFORM submitted_records.
ENDIF. " IF W_SUBMIT EQ C_BOOLEAN_YES
ENDMODULE. " STATUS_0100 OUTPUT
MODULE USER_COMMAND_0100 INPUT *
To perform user actions in the screen 100 *
MODULE user_command_0100 INPUT.
To update the data in the ALV grid
PERFORM check_changed_data.
w_okcode = ok_code.
CLEAR ok_code.
CASE w_okcode.
WHEN c_fcode_back.
LEAVE TO SCREEN 0.
WHEN c_fcode_exit OR c_fcode_cancel.
LEAVE PROGRAM.
ENDCASE. " CASE W_OKCODE
ENDMODULE. " USER_COMMAND_0100
FORM GET_DATA *
To get the submitted data from zcl_timesheet *
No parameters are passsed to this subroutine *
FORM get_data .
SELECT *
FROM zcl_timesheet
INTO TABLE t_timesheet
WHERE empid IN s_empid
AND workdate IN s_date
AND groupid IN s_group
AND projectid IN s_prjid
AND appstatus EQ c_boolean_yes.
IF sy-subrc NE 0.
MESSAGE e000 .
ELSE.
CALL SCREEN 100.
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " GET_DATA
FORM BUILD_FCAT *
To build the field catalog giving managers comment in editable mode *
-->PR_Tabname type lvc_tname *
-->PR_Fieldname type lvc_fname *
-->PR_Coltext type lvc_txtcol *
-->PR_Colpos type lvc_colpos *
FORM build_fcat USING pr_tabname TYPE lvc_tname
pr_fieldname TYPE lvc_fname
pr_coltext TYPE lvc_txtcol
pr_colpos TYPE lvc_colpos.
CLEAR fs_fcat.
fs_fcat-tabname = pr_tabname.
fs_fcat-fieldname = pr_fieldname.
fs_fcat-coltext = pr_coltext.
fs_fcat-col_pos = pr_colpos.
IF fs_fcat-fieldname EQ 'MNGCOMMENT'.
fs_fcat-edit = c_boolean_yes.
fs_fcat-lowercase = c_boolean_yes.
fs_fcat-dd_outlen = 60.
ELSE.
fs_fcat-edit = space.
ENDIF. " IF FS_FCAT-FIELDNAME...
APPEND fs_fcat TO t_fcat.
ENDFORM. " BUILD_FCAT
FORM BUILD_FCATD *
To build fieldcatalog in the display mode *
-->pr_Tabname type lvc_tname *
-->pr_Fieldname type lvc_fname *
-->pr_Coltext type lvc_txtcol *
-->pr_Colpos type lvc_colpos *
FORM build_fcatd USING pr_tabname TYPE lvc_tname
pr_fieldname TYPE lvc_fname
pr_coltext TYPE lvc_txtcol
pr_colpos TYPE lvc_colpos .
CLEAR fs_fcat.
fs_fcat-tabname = pr_tabname.
fs_fcat-fieldname = pr_fieldname.
fs_fcat-coltext = pr_coltext.
fs_fcat-col_pos = pr_colpos.
fs_fcat-edit = space.
APPEND fs_fcat TO t_fcat.
ENDFORM. " BUILD_FCATD
FORM ALV_DISPLAY *
To display data in ALV *
--> pr_table type standard table *
--> pr_fcat type lvc_t_fcat *
FORM alv_display USING pr_table TYPE STANDARD TABLE
pr_fcat TYPE lvc_t_fcat .
Local data declaration....
DATA: lt_exclude TYPE ui_functions.
To exclude buttons on the ALV grid
PERFORM exclude_tb_functions CHANGING lt_exclude.
To display ALV
CALL METHOD g_alv->set_table_for_first_display
EXPORTING
i_default = space
is_layout = g_fcatlayo
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = pr_table[]
it_fieldcatalog = pr_fcat[].
ENDFORM. " ALV_DISPLAY
FORM EVENT_TOOLBAR *
Setting toolbar in the alv grid *
-->E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET *
FORM event_toolbar USING e_object
TYPE REF TO cl_alv_event_toolbar_set.
Local declaration for the button.
DATA: ls_toolbar TYPE stb_button.
To add Approve button
ls_toolbar-function = c_fcode_approve.
ls_toolbar-butn_type = c_zero.
ls_toolbar-text = text-001.
APPEND ls_toolbar TO e_object->mt_toolbar.
To add Reject button
CLEAR ls_toolbar.
ls_toolbar-function = c_fcode_rej.
ls_toolbar-butn_type = c_zero.
ls_toolbar-text = text-013.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDFORM. " EVENT_TOOLBAR
FORM EXCLUDE_TB_FUNCTIONS *
To exclude buttons from ALV grid *
<--> PR_EXCLUDE TYPE UI_FUNCTIONS *
FORM exclude_tb_functions CHANGING pr_exclude TYPE ui_functions.
Local data declaration...
DATA ls_exclude TYPE ui_func.
To remove the buttons on the ALV grid.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
APPEND ls_exclude TO pr_exclude.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
FORM EVENT_UCOMM *
After Input in the ALV grid,if user select record and press *
approve or reject then the record will get updated *
--> PR_ucomm type sy-ucomm *
FORM event_ucomm USING pr_ucomm LIKE sy-ucomm.
CASE pr_ucomm.
If e_ucomm contains 'APP' i.e.function code for Approve button
WHEN c_fcode_approve. " To approve selected record
PERFORM app_timesheet USING c_approve_status.
If e_ucomm contains 'REJ' i.e. function code for Reject
WHEN c_fcode_rej. " To reject selected record
PERFORM app_timesheet USING c_rej_status.
ENDCASE. " CASE E_UCOMM
ENDFORM. " EVENT_UCOMM
FORM APP_TIMESHEET *
To get the selected records and update the records in database *
--> pr_status type char01 *
FORM app_timesheet USING pr_status TYPE char01 .
Local data declaration......
DATA:
lt_marked_rows TYPE lvc_t_roid, " Table to get rowid
l_fs_marked_row LIKE LINE OF lt_marked_rows.
" Field-string for lt_marked_rows
To get all the selected rows in the table lt_marked_rows
CALL METHOD g_alv->get_selected_rows
IMPORTING
et_row_no = lt_marked_rows.
Reading each row id and updating the database.
LOOP AT lt_marked_rows INTO l_fs_marked_row.
Reading the table t_timesheet with rowid
READ TABLE t_timesheet INTO fs_timesheet INDEX
l_fs_marked_row-row_id.
If record is there in the table.
IF sy-subrc EQ 0.
CLEAR fs_timesheet-appstatus.
GET PARAMETER ID 'ZEMPID' FIELD w_empid.
Changing the appstatus.
fs_timesheet-appstatus = pr_status.
fs_timesheet-approvedby = w_empid.
Updating the database table.
UPDATE zcl_timesheet FROM fs_timesheet.
IF sy-subrc EQ 0.
DELETE t_timesheet INDEX l_fs_marked_row-row_id.
PERFORM refresh_table USING pr_status.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0
ENDLOOP. " LOOP AT LT_MARKED_ROWS...
ENDFORM. " APP_TIMESHEET
FORM CHECK_CHANGED_DATA *
To change the data *
No parameters are passsed to this subroutine *
FORM check_changed_data .
To change the data.
CALL METHOD g_alv->check_changed_data.
ENDFORM. " CHECK_CHANGED_DATA
FORM DISPLAY_ALL *
To display all the records *
No parameters are passsed to this subroutine *
FORM display_all .
SELECT empid " Employee ID
workdate " Workdate
groupid " Groupid
projectid " Project ID
projectname " Project name
objectid " Object ID
objectname " Object name
activityid " Activity ID
activityname " Activity name
timeworked " Time worked
description " Description
taskstatus " Task status
billstatus " Bill status
appstatus " Approved status
wstatus " Working status
mngcomment " Manager comment
FROM zcl_timesheet
INTO TABLE t_time
WHERE empid IN s_empid
AND workdate IN s_date
AND groupid IN s_group
AND projectid IN s_prjid
AND appstatus NE c_save_status.
IF sy-subrc NE 0.
MESSAGE e000.
ELSE.
CALL SCREEN 100.
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " DISPLAY_ALL
FORM REFFRESH_TABLE *
To refresh output table and issue message according p_status *
-->PR_STATUS TYPE CHAR01 *
FORM refresh_table USING pr_status TYPE char01.
To refresh output table.
CALL METHOD g_alv->refresh_table_display.
Depending upon pr_status message is given.
IF pr_status EQ c_approve_status.
MESSAGE s001.
ELSE.
MESSAGE s002.
ENDIF. " IF P_STATUS EQ C_APPROVE_STATUS
ENDFORM. " REFRESH_TABLE
FORM SET_TITLEBAR *
To set titlebar on the screen 100. *
-->PR_STATUS TYPE CHAR01 *
FORM set_titlebar USING pr_status TYPE char01.
If pr_status eq 'X'.
IF pr_status EQ c_boolean_yes.
SET TITLEBAR c_alv_scr WITH text-017.
ELSE.
SET TITLEBAR c_alv_scr WITH text-018.
ENDIF. " IF P_STATUS EQ C_BOOLEAN_YES
ENDFORM. " SET_TITLEBAR
FORM USER_COMMAND *
According to sy-ucomm the action is performed in the screen 100 *
No parameters are passsed to this subroutine *
FORM user_command .
CASE sy-ucomm.
If p_app is selected, submitted data will be displayed for approval
WHEN c_fcode_onli OR c_fcode_approve.
CLEAR sy-ucomm.
To display the submitted records.
IF p_app EQ c_boolean_yes.
w_submit = c_boolean_yes.
To get submitted records
PERFORM get_data.
ENDIF. " IF P_APP EQ C_BOOLEAN_YES
To display all records according to selection.
IF p_disp EQ c_boolean_yes.
w_display = c_boolean_yes.
To display
PERFORM display_all.
CLEAR w_display.
ENDIF. " IF P_DISP EQ C_BOOLEAN_YES
ENDCASE. " CASE SY-UCOMM
ENDFORM. " USER_COMMAND
FORM DISPLAY_ALLRECORDS *
To display all the records in the display mode *
No parameters are passsed to this subroutine *
FORM display_allrecords .
CLEAR w_display.
PERFORM build_fcatd USING 'T_TIME' 'WORKDATE' text-002 '1'.
PERFORM build_fcatd USING 'T_TIME' 'EMPID' text-009 '2'.
PERFORM build_fcatd USING 'T_TIME' 'PROJECTID' text-003 '3'.
PERFORM build_fcatd USING 'T_TIME' 'PROJECTNAME' text-004 '4'.
PERFORM build_fcatd USING 'T_TIME' 'OBJECTID' text-005 '5'.
PERFORM build_fcatd USING 'T_TIME' 'OBJECTNAME' text-006 '6'.
PERFORM build_fcatd USING 'T_TIME' 'ACTIVITYID' text-007 '7'.
PERFORM build_fcatd USING 'T_TIME' 'ACTIVITYNAME' text-008 '8'.
PERFORM build_fcatd USING 'T_TIME' 'TIMEWORKED' text-010 '9'.
PERFORM build_fcatd USING 'T_TIME' 'DESCRIPTION' text-011 '10'.
PERFORM build_fcatd USING 'T_TIME' 'APPSTATUS' text-012 '11'.
PERFORM build_fcatd USING 'T_TIME' 'BILLSTATUS' text-016 '12'.
PERFORM build_fcatd USING 'T_TIME' 'MNGCOMMENT' text-014 '13'.
PERFORM alv_display USING t_time t_fcat.
ENDFORM. " DISPLAY_ALLRECORDS
FORM SUBMITTED_RECORDS *
To display submitted records for the manager to approve *
No parameters are passsed to this subroutine *
FORM submitted_records .
CLEAR w_submit.
To create object for instance g_events
CREATE OBJECT g_events.
If w_first equal to space
IF w_first IS INITIAL.
SET HANDLER g_events->toolbar
FOR g_alv.
w_first = c_boolean_yes.
ENDIF. " IF W_FIRST IS INITIAL..
SET HANDLER g_events->user_command
FOR g_alv.
g_fcatlayo-sel_mode = c_approve_status.
REFRESH t_fcat.
PERFORM build_fcat USING 'T_TIMESHEET' 'WORKDATE' text-002 '1'.
PERFORM build_fcat USING 'T_TIMESHEET' 'EMPID' text-009 '2'.
PERFORM build_fcat USING 'T_TIMESHEET' 'PROJECTID' text-003 '3'.
PERFORM build_fcat USING 'T_TIMESHEET' 'PROJECTNAME' text-004 '4'.
PERFORM build_fcat USING 'T_TIMESHEET' 'OBJECTID' text-005 '5'.
PERFORM build_fcat USING 'T_TIMESHEET' 'OBJECTNAME' text-006 '6'.
PERFORM build_fcat USING 'T_TIMESHEET' 'ACTIVITYID' text-007 '7'.
PERFORM build_fcat USING 'T_TIMESHEET' 'ACTIVITYNAME' text-008 '8'.
PERFORM build_fcat USING 'T_TIMESHEET' 'TIMEWORKED' text-010 '9'.
PERFORM build_fcat USING 'T_TIMESHEET' 'DESCRIPTION' text-011 '10'.
PERFORM build_fcat USING 'T_TIMESHEET' 'APPSTATUS' text-012 '11'.
PERFORM build_fcat USING 'T_TIMESHEET' 'BILLSTATUS' text-016 '12'.
PERFORM build_fcat USING 'T_TIMESHEET' 'MNGCOMMENT' text-014 '13'.
PERFORM alv_display USING t_timesheet t_fcat.
ENDFORM. " SUBMITTED_RECORDS
Plzz Reward if it is useful,
Mahi. -
We have a Ztable with below structure where the approved purchase prices are stored. We have created a routine which checks whether the PO price is matching to the prices in this table w.r.t. the validity date.
Can we copy the price from this table to PO directly. i.e, no user will enter the price in PO or info record but the PO will adopt the price from below table.
MANDT MANDT CLNT 3 0 Client
KSCHL KSCHA CHAR 4 0 Condition type
LIFNR ELIFN CHAR 10 0 Vendor Account Number
MATNR MATNR CHAR 18 0 Material Number
EKORG EKORG CHAR 4 0 Purchasing Organization
WERKS WERKS_D CHAR 4 0 Plant
SEQU NUMC 13 0 Sequence Number
DATAB KODATAB DATS 8 0 Validity start date of the condition record
DATBI KODATBI DATS 8 0 Validity end date of the condition record
KBETR KBETR_KOND CURR 11 2 Rate (condition amount or percentage) where no scale exists
KONWA KONWA CUKY 5 0 Rate unit (currency or percentage)
KPEIN KPEIN DEC 5 0 Condition pricing unit
kindly revert.
thanks in advance.Hi,
You need set a price with standard tools if you want that a VOFM subroutine works, ie: you can do a substitution if the system set a price before.
I hope this helps you
Regards,
Eduardo -
Deleting records from ztable??
hi there....
i have arequirement to delete records from a ztable using coding .....
i hav tried the delete command but its not working properly.
can anyone suggest a proper method for this....
urgent requirement.... useful ans wil be rewarded.
regards'DELETE { {FROM target [WHERE sql_cond]}
| {target FROM source} }.
PARAMETERS p_carrid TYPE sflight-carrid.
DELETE FROM sflight
WHERE carrid = p_carrid AND
fldate = sy-datum AND
seatsocc = 0.
PARAMETERS p_carrid TYPE sflight-carrid.
TYPES: BEGIN OF sflight_key,
mandt TYPE sflight-mandt,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF sflight_key.
DATA sflight_key_tab TYPE TABLE OF sflight_key.
SELECT carrid connid fldate
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE sflight_key_tab
WHERE carrid = p_carrid AND
fldate = sy-datum AND
seatsocc = 0.
DELETE sflight FROM TABLE sflight_key_tab. -
I have a ztable in which there r 5,000 records in production system. User entered some wrong entries. Now i have to delete those rows physically. How can this be done with out effecting other rows. My Ztable is having maintenance sm30. how can i solve this problem. I can't write code for using delete statement as the rows r placed at different places so tht i can't put table index & proceed. thanks in advance
regards
RamI have a solution that might work for you too.
Go to SE11. enter your table name and press display(F7).
Then press (CntrlShiftF10) for contents of table.
enter the fields that might help you select your records else leave them empty and press F8.
Now the records are displayed in list.
Checkmark the records you want to delete.
Then press Display(F7).
Now in Command Bar enter '/h' and press ENTER. the system wud give a msg that debugging has been started.... Now press ENTER once again it will go into debugging.
In debugging mode there is a variable CODE which will be having value SHOW, change that value to DELE and press the pencil button in the extreme right to that field.This changes the contents of CODE from SHOW to DELE. Now press F8.
Now in application toolbar 'Delete entry' button will appear with navigation keys.
So now buddy you need to delete that record by pressing that button and navigate to next record and delete that and so on,one by one. after you have deleted all the required record press the BACK button, you again come back to list display of records, press refresh and all the deleted records will disappear. Keep on eye on the Message bar while deleting.........
Reward points if useful, get back in case of query... -
Need to display value from ztable to a free field in a standard tcode...
Hello Experts,
I have a requirement wherein I need to get some data from a custom table and
need to display it in one of the free fields of transaction FBL1N(Vendor line item display).
I really do not have any idea how to go about this. Hope you can help me guys.
Thank you and take care!Hi!
You will have to look for an appropriate user-exit (if there are any) for transaction FBL1N. In the user-exit you can fetch the data from the custom table and populate the fields of the std transaction. Alternative - The fields in FBL1N are populated from the FI documents. So you can create a substitution rule (using a user-exit) and populate the field in the FI Doc. For this you might require the help of your functional consultant.
Hope this helps
Cheers! -
Fetching Email-Id from ZTABLE.
Dear All,
I have a requirement in which i have to fetch email-id of users from a Z-table based on workcenter (for Tcode IW31/32) value.
The Z-table contains the Workcenter - Email Id combination.
I have the work center value in my workflow container using the BO BUS2088, now how to fetch the email-id from the Z-table at runtime?
I thought of using a rule which in turn would call a FM and in FM I was fetching the value, but the Email-ID fetched is longer than the standard return parameter - ACTOR_TAB-OBJID (only 12 characters long).
How can i achieve this feature of dynamic assignment of email-id based on the value from Z-table ?
Kindly assist.
Thanks.
Saurabh.Could you please explain what is PA0105-USRID_LONG ??
And i am trying all sorts of approaches to pass data from WF container to my task, but not getting success.
I even created a class YNEWCLASS with a method YGETDATA and 2 parameters- ACTUALLYPROCBY to take workcenter value from task to method and EMAIL to send the value back to task. but while putting the value for OBJECT CATEGORY for task ( where I select ABAP Class and give class and method name) it gives an error - Interface implementation IF_WORKFLOW does not exist.
I tried using the BOR object method also but in that I am facing type mismatch while binding the task and WF.
Any helpful material from where I can learn how to pass data between WF container and task and vice-versa.
Thanks,
Saurabh. -
Transfering data from ztable across the r/3 systems by using change pointer
hi all,
what we have to do at the field of domain level when we are transfering data from custom table across the r/3 systems by using change pointers.Hi Deepak,
Check this blog.. it gives a very good explanation on extraction of data through function modules...
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Hope it helps..
Regards
Manick
Message was edited by:
Manickavasagan M
Maybe you are looking for
-
Photo gallery not showing pix in preview
i'm using dreamweaver 8 to create a photo-based website. after i create the album, i'm not seeing any of the thumbnails or photos in the Dreamweaver program or in the web preview (firefox). i'm new to web design and new to Dreamweaver. what am i doin
-
Hi, When we are accessing the GRC AC 5.3 web application via our Juniper remote access VPN appliance, experienceing the attached application error after logging in. Here are the steps taken before reaching this error. 1) Login to https://xxxxxxx.yyyy
-
Magic mouse batteries drops fast, help!
is there anyway to solve this problem? in the mac store they told me that the batteries may last about 2 or 3 months aprox. but i think that's not true, put new ones and in less than a month they are dead. i tried 4 brands and still the same thing.
-
Thank you very much! SAPuFF08HRu3001ABAPuFF09problem!
HR module,T-CODE: PC00_M28_CALC_SIMU( Simulation ),how to dont give wages to the staffs who did not have continued to sign contracts( now want to solve the problem without modifying standard programme )?
-
"Acquisition value negative in area 32." when post FI doc by F-02
Hi All, I want to scrap a asset. In our system, we set assets have two depreciation area, one depreciation area is 01 TWD 183150, another depreciation area is 32 USD 5779.42 [TWD|http://www.flickr.com/photos/44956360@N08/5188549037/] [USD|http://www.