Join in dynamic way
Hi,
I want to do dynamic join from 3 tables and give the i.e. i have method with import fields
and i want to do the select accordingly to the fields that i have
if user enter 5 fields do the select just from table one
if user enter 10 fields to the select from 2 tables (because the additional 5 fields
are form table number 2
and if user enter 15 fields do the same for the third table.
There is option to do it in one dynamic join ?
Regards
Joy
Edited by: Joy Stpr on Aug 4, 2009 6:39 AM
Moderator comments: I have deleted the other two threads as
you can continue and build on the suggestions given against this
thread. PL don't create multiple threads on the same topic.
~Suresh
Edited by: Suresh Datti on Aug 9, 2009 10:33 PM
Hello Joy,
Try this way:
if all of your tables are transparent then it is easy to do:
1. define one single column internal table which will hold fields which you need to select. for e,g, <field>
2. Load required fields in to table <field>
3. Now describe table <field> and get the row count.
4. use case to switch between the select statement so if fields are five it is pretty simple to select data from
single table and if it is 10 then you can use join from two table.
Now before going to join you need to prepare a selected field string using respective alias which you can do
by looping through <field> and then concatenating alias with fieldname use that string during seletion for e.g field_str
Also you need table to hold data after select so you fieldcatalog_tab with <field> and pass it to below method
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = fieldcatalog_tab
importing
p_table = table.
This will give you dynamic internal table now depending on the case field catalog will have respective fields and out table
is create appropriately.
5. Repeat step 4 for case 3 that is join between 3 tables.
Here again you need to create field_str which will hold selection fields with respective alias and
dynamic internal table consist of all the 15 fields.
so your final select sudo code will be some thing like this:
DESCRIBE .... LINES.
case LINES
when 5.
select (field_str)
from (table_name)
into <dyn_itab>
when 10.
select (field_str)
from (table_name) --> here table_name consist of two table for e.g. ABCD AS A JOIN EFGH AS E ON A~XYZ EQ
E~XYZ
into <dyn_itab>
when 15.
Repeat same thing as case 10 only field_str and table_name and structure of <dyn_itab> will change.
endcase.
Hope this helps!,
Thanks,
Augustin.
Similar Messages
-
Problem while changing the JSplitpane in a dynamic way.
Hi Everyone,
In my application i'm changing the jsplitpane in a dynamic way.i'm posting the sample code thatz giving problem.Kindly compile and execute this.In the first frame i've done a split of two parts. The top component has got the name of the application and the bottom component has got some links related to that application. If the user click on this link ,i'm capturing the bottom component alone from the original splitpane and i'm breaking that into another split.
upto this every thing works fine.Now the problem is when ever the user click on that link it'z capturing that event and doing consecutive split on the bottom frame.But i need that paricular split that user has already got to be repainted for all the time when user click on the link.Eventhough i've captured the main splitpane object in some other variable and assiging the same to the second window when user click on that url.But itz not recognizing that.
Kindly some one help me to resolve this.
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
public class Test2 extends JPanel // implements KeyListener
static Vector<String> arrAppName = new Vector<String>();
public static JSplitPane splitPane,splitPane2;
public void AppWin(final JFrame frame)
Container contentPane = this;
GridBagLayout gb = new GridBagLayout();
contentPane.setLayout(gb);
arrAppName.add("link");
JLabel lab = new JLabel("<html><font color=#6698FF><a href>" + arrAppName.get(0) + "</a></font></html>");
contentPane.add(lab);
JScrollPane listScrollPane = new JScrollPane(contentPane);
JLabel label = new JLabel("APPLICATION REPORT", JLabel.CENTER);
Font font = label.getFont();
Font font3 = font.deriveFont(25.0f);
label.setFont(font3);
label.setFont(label.getFont().deriveFont(Font.ITALIC));
label.setHorizontalAlignment(JLabel.CENTER);
label.setForeground(new Color(0x736AFF));
JScrollPane labelScrollPane = new JScrollPane(label);
labelScrollPane.setVisible(true);
// Create a split pane with the two scroll panes in it.
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setTopComponent(labelScrollPane);
splitPane.setBottomComponent(listScrollPane);
splitPane.setDividerLocation(100);
Dimension minimumSize = new Dimension(100, 50);
listScrollPane.setMinimumSize(minimumSize);
labelScrollPane.setMinimumSize(minimumSize);
splitPane2= new JSplitPane();
splitPane2=splitPane;
lab.addMouseListener(new MouseListener()
public void mouseClicked(MouseEvent arg0)
displayMainFrame("link", frame);
public void mousePressed(MouseEvent arg0)
public void mouseReleased(MouseEvent arg0)
public void mouseEntered(MouseEvent arg0)
public void mouseExited(MouseEvent arg0)
public void buildWindow(String link, JFrame frame)
Container contentPane = this;
GridBagLayout gb = new GridBagLayout();
contentPane.setLayout(gb);
JLabel label = new JLabel("Next Screen", JLabel.CENTER);
Font font = label.getFont();
Font font3 = font.deriveFont(25.0f);
label.setFont(font3);
label.setFont(label.getFont().deriveFont(Font.ITALIC));
label.setHorizontalAlignment(JLabel.CENTER);
label.setForeground(new Color(0x736AFF));
JScrollPane buildWindowtop = new JScrollPane(label);
buildWindowtop.setVisible(true);
contentPane.add(buildWindowtop);
/*assigning the main split pane object for all the consecutive call*/
splitPane=splitPane2;
JSplitPane splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane1.setTopComponent(splitPane.getBottomComponent());
splitPane1.setBottomComponent(contentPane);
splitPane.setBottomComponent(splitPane1);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(100);
Dimension minimumSize = new Dimension(100, 50);
buildWindowtop.setMinimumSize(minimumSize);
splitPane1.setMinimumSize(minimumSize);
} // end printing rows
public static void displayFrame(String tname, JFrame framedisp, String buttonName, String tranCorrID,
String buttonOption, JSplitPane buildSplit)
Test2 mainDispPane = new Test2();
framedisp.getContentPane().add(splitPane);
framedisp.setVisible(true);
public static void displayMainFrame(String link, JFrame framedisp)
Test2 mainDispPane = new Test2();
mainDispPane.buildWindow(link, framedisp);
framedisp.getContentPane().add(splitPane);
framedisp.setVisible(true);
public static void main(String[] args)
JFrame frame = new JFrame("MAIN WINDOW");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Test2 mainPane = new Test2();
mainPane.AppWin(frame);
frame.getContentPane().add(splitPane);
frame.setSize(1280, 1000);
frame.setVisible(true);
} // end main
} // end Test2Thanks in Advance,
Siva.anybody can help me this regard?
-
Handle Date format in a dynamic way
Hi Experts,
I need to handle the date format in a dynamic way in different systems.
Sample Scenario:
In my DEV system i am writing a select query where i need to validate the date field which is of the format 12/31/9999.
select * from <table> where date = '12/31/9999'.
This gets relevant records & works fine in DEV system.
But when it goes to QA system the same select query fails to fetch data as the date format is 12.31.9999.
select * from <table>
where date = '12/31/9999'. --> Fails
Similarly when it is PRD system (production) the same select query fails as the date format is 12-31-9999.
select * from <table>
where date = '12/31/9999'. --> Fails
Please post your suggestions.
Thanks
DanyIf you are looking at the date from SE16, or some other output screen, dates are converted to what is referred to as external format. But when they are stored, they are stored in internal format which is always YYYYMMDD. So when you are doing a SELECT from database table using a date field in your WHERE clause, you have to use internal format of the date (YYYYMMDD). When you output a date that you extracted onto a screen using WRITE statement, it will be converted to external format depending on user format specifications. But the date will be in internal format within your program, so if you are transferring a date from the database directly to a file, you are transferring it as YYYYMMDD. If you need it in external format, then you have to use WRITE...TO... option. See help on WRITE command.
-
Are there a dynamic way for evaluting variables in as3?
Hi..!
eval() is a usefull method or function in javascript.. Because we may define our variables via dynamic way..! There are following code is for understanding that how can define dynamic defining variables in javascript.. And Are there a dynamic way for evaluting variables in as3 like following javascript code?
<script language="javascript1.2" type="text/javascript">
var trainOfUfo = "...hi earthling...";
var handleBlade = eval("train"+"Of" + "Ufo");
alert(handleBlade); //-- it appears in dialog box text field area "...hi earthling..."---
</script>
Gürkan Şahin
Code Developer
TurkeyIn AS3 you can use the bracket notation...
var trainOfUfo = "...hi earthling...";
var handleBlade = this["train"+"Of" + "Ufo"];
AS2 supports the eval() function, but it was done away with in AS3 -
Alter Store Procedure in Dynamic way..
Dear Folks,
I need your help on below query !
I’m using an one of the store procedure in my sales database.
But after some upgrade work, respective columns from destination table(NC_SAL) have been deleted & renamed..
& due to this, I have to alter my all procedures those are depend on changed tables & restructure them in this way..
Here is the desired visual..
Can somebody help me to find out a dynamic way to alter all my procs those using table (NC_SAL)
Thanks,Try the below code,
DECLARE @SP NVARCHAR(MAX)
DECLARE C CURSOR FOR SELECT OBJECT_DEFINITION(OBJECT_ID) Description FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%NC_SAL%'
OPEN C
FETCH NEXT FROM C INTO @SP
WHILE @@FETCH_STATUS=0
BEGIN
DECLARE @SQL NVARCHAR(MAX)
SET @SQL = REPLACE(@SP, '[TAXES]', '[LINEDESC]')
SET @SQL = REPLACE(@SQL, 'AS TAXES', 'AS [LINEDESC]')
SET @SQL = REPLACE(@SQL, 'CREATE PROCEDURE', 'ALTER PROCEDURE')
PRINT @SQL
EXEC(@SQL)
FETCH NEXT FROM C INTO @SP
END
CLOSE C
DEALLOCATE C
Regards, RSingh -
Hi,
I would like to supply dataset in dynamic way.
I have a array (dataset_metadata) which contains metadata but I don't know how many metadata are in. I just know that the last metadata is the measure.
So can you help me to supply dataset in javascript?
For 3 metadata, the code is:
var dataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [
{ axis : 1, name : dataset_metadata[0]["$"], value : "{" + dataset_metadata[0]["$"] + "}" },
{ axis : 2, name : dataset_metadata[1]["$"], value : "{" + dataset_metadata[1]["$"] + "}" }
measures : [
{ name : dataset_metadata[2]["$"], value : '{' + dataset_metadata[2]["$"] + '}' }
data : { path : "/data" }
For x metadata, with a loop, the code is?
Same question for the table:
var oTable = new sap.ui.table.Table({
columns : [ new sap.ui.table.Column({
label : dataset_metadata[0]["$"],
template : new sap.ui.commons.TextView({
text : '{' + dataset_metadata[0]["$"] + '}'
sortProperty : dataset_metadata[0]["$"],
filterProperty : dataset_metadata[0]["$"],
width : "100px"
}), new sap.ui.table.Column({
label : dataset_metadata[1]["$"],
template : new sap.ui.commons.TextView({
text : '{' + dataset_metadata[1]["$"] + '}'
sortProperty : dataset_metadata[1]["$"],
filterProperty : dataset_metadata[1]["$"],
width : "100px"
}), new sap.ui.table.Column({
label : dataset_metadata[2]["$"],
template : new sap.ui.commons.TextView({
text : '{' + dataset_metadata[2]["$"] + '}'
sortProperty : dataset_metadata[2]["$"],
filterProperty : dataset_metadata[2]["$"],
width : "100px"
rows : "/data",
visibleRowCount : 12
How supply oTable with using a loop?
Best regards
YannickBefore we get too carried away I want to make sure that this query is actually related to what this SCN Space supports. To do that, we have to look at the Overview for this SCN Space:
If what is in the description I placed in a red border does not match with your query, I have to ask you to please find a more appropriate forum. All SCN forums are listed in this document:
SCN Site Index
If this is a purely Java question with no relation to any SAP products / components than you will have to find a Java forum to post your question into.
I may sound like a stick in the mud here, but following the SCN Rules of Engagement, I can not allow queries that are unrelated in any of the SCN forums.
Many thanks for your understanding,
- Ludek
SCN Moderator -
WWhen I set up family sharing i did it with me as family organizer, but as my spouse is the organizer I had to leave the "family" I created and join his. But while setting it up an error occurred, and the screen went blank. Now I tried to join his family sharing again, and my phone keeps telling me I can't because accounts can only join families twice a year.
I Don't really want to wait 364 days from now, is there a way in which I can reset my accoint so I can join family sharing again?
Apple support doesn't have a solution for me yet!
KInd regardsThis morning I looked at my family sharing account again an IT WORKS NOW! Think Apple has done a reset to my account, though I'm not exactly sure why! So I hope it works for you guys as well!
-
INNER join with dynamic table name ?
Hi,
I have a problem with this statement.
DATA: g_dso_bic_dofr TYPE tabname.
SELECT t1~/bic/ziparomr
t2~/bic/zifremom
INTO (wa_rater_paromr-/bic/ziparomr,
wa_rater_paromr-/bic/zifremom)
* FROM /bic/azd0bfr5100 AS t1 "equivalent to the dynamic statement below
" this is the problem
FROM (g_dso_bic_dofr )AS t1
INNER JOIN /bic/pzifremom AS t2
ON t1~/bic/ziparomr = t2~/bic/ziparomr
" --- to here
WHERE t1~/bic/zikom = v_kommune
The compile check doesnt work when i use the variable table name.
I get
"Wrong expression "INNER" in FROM clause. WHERE condition."
Can anyone help me.
Br Rasmus." this is the problem
* FROM (g_dso_bic_dofr )AS t1 "<<--- check spaces in here
FROM (g_dso_bic_dofr) AS t1 "<<--- and here
INNER JOIN /bic/pzifremom AS t2
ON t1~/bic/ziparomr = t2~/bic/ziparomr
" --- to here
I think there's the problem, the space behind the parenthesis.
Regards -
Is there a dynamic way to use extensions?
Ok, Ranch pals... I have a huge problem...
There's an app o' mine that is bundled in a jar file. It's an Applet, but that doesn't matter. What really matters is: the jar file uses an extension. An extension from Sun. To use that and install it automatically in the client machine I have to put that extension in the MANIFEST file for my app, like the code that follows:
Manifest-Version: 1.0
Extension-List: jai_imageio
jai_imageio-Extension-Name: com.sun.media.imageio
jai_imageio-Specification-Version: 1.0-mr
jai_imageio-Implementation-Version: 1.0_01
jai_imageio-Implementation-Vendor-Id: com.sun
jai_imageio-Implementation-URL: http://someeirdaddress.com.any/anything/herecomeswhatisimportant/jai_imageio-windows-i586.jarThe thing is: my clients have to have this jar file (jai_imageio-windows-i586.jar) in their server, so it can be downloaded and installed (in my case by the Java Plug-in). But the address to this file (http://someeirdaddress.com.any/anything/herecomeswhatisimportant/jai_imageio-windows-i586.jar) has to be inside the MANIFEST file, which is terrible, because if I have 1 zillion clients I'll have to pack my jar 1 zillion times, changing the MANIFEST everytime.
So! The question that is reeeeally bothering me is: "is there a way to set that my app uses an extension from outside the MANIFEST file, say, from my code? If yes, how? If no, is there any auto-checking-and-installing solution for my problem?"Because it is going to be used in an intranet and I can't know for sure that all machines will have access to the internet. So, the file must be in the local server, and they often have different addresses. I don't need the MANIFEST to be dynamic, but the mechanism to use extensions. But, if the only way of doing this is having a dynimic MANIFEST file, ok.
-
Inner Join for Dynamic Select statement
Hi All,
Can some one please help me in rewriting the below select statement where i have to remove the existing table1 by putting a dynamic table name which has the same table structure.
select a~zfield1
a~zfield2
from ztab1 as a
inner join ztab2 as b
on b~ztab1-zfield3 = a~ztab2-zfield3
where a~zfield4 = 'A'.
I am looking something as below. But encountering an error when using the below statement
select a~zfield1
a~zfield2
from (v_ztab1) as a
inner join ztab2 as b
on b~ztab1-zfield3 = a~ztab2-zfield3
where a~zfield4 = 'A'.
No Separate selects please. Please help me in rewriting the same select statement itself.
Regards,
PSKhi,
What error you are getting ?
Also INTO is missing from the statement.
SELECT pcarrid pconnid ffldate bbookid
INTO TABLE itab
FROM ( spfli AS p
INNER JOIN sflight AS f ON pcarrid = fcarrid AND
pconnid = fconnid )
WHERE p~cityfrom = 'FRANKFURT' AND
p~cityto = 'NEW YORK' .
thanks -
Create dynpro in a totally dynamic way
Hi all,
is it possible to create a dynpro program with a tab strip in a totally dynamic/generic way?
The idea is that I have a configuration program:
The user can specify all parameters of the dynpro program (e. g. name of the different tabs, which fields are in the tabs, program name, etc.)
After the configuration the dynpro program should be generated. I know how to create a normal program at runtime. But this is much more.
I think in Webdynpro it would be possible.
But how can I realize this with a normal dynpro?
I know that there are functionality where I can create dynamic dynpros (command: generate dynpro). Please give me a good hint.
regardsHello
I have worked on one similar requirement. Though there was small difference like, the program was not generated dynamically. We had written a program which had some 15 tabs in the tabstrip.
The program would read the customization table for the title, the fields to be displayed in the tab strip. Based on the data from the customization table the program would dynamically modify the screen to have only those many tabs visible in the screen as per the configurations even though there were 15 tabs actually.
The data would be populated dynamically for the fields customized in the table, which may be retrieving this information from different master/transactional data tables.
I hope this has some idea on the design we had used. Let me know if you need any more information.
Regards
Ranganath -
Join Table & Dynamic Selection
Hi Gurus,
I need to do a performance tuning on a bad response time program.
Therefore i use inner join to improve the response time, it works.
But my problem is the original program was using dynamic selection(with LDB), so i need to retain the same feature(i.e. dynamic selection) in new program.
I use FM 'FREE_SELECTIONS_INIT' & FM 'FREE_SELECTIONS_DIALOG' to let user entering dynamic selections.
How can the SELECT with JOIN be done with dynamic selection?
Thanks in advance.
Regards,
HikarunoHai ... here is the program for using the dynamic selection FM used .
REPORT zmodtab NO STANDARD PAGE HEADING.
TYPE-POOLS: rsds.
DATA: is_x030l TYPE x030l,
it_dfies TYPE TABLE OF dfies,
is_dfies TYPE dfies,
it_fdiff TYPE TABLE OF field_dif,
is_fdiff TYPE field_dif.
DATA: w_selid TYPE rsdynsel-selid,
it_tables TYPE TABLE OF rsdstabs,
is_tables TYPE rsdstabs,
it_fields TYPE TABLE OF rsdsfields,
it_expr TYPE rsds_texpr,
it_ranges TYPE rsds_trange,
it_where TYPE rsds_twhere,
is_where TYPE rsds_where,
w_active TYPE i.
DATA: it_content TYPE REF TO data,
it_modif TYPE REF TO data,
it_fcat TYPE lvc_t_fcat.
DATA: w_okcode TYPE sy-ucomm.
FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
<ntab> TYPE STANDARD TABLE.
* Macros
DEFINE table_error.
message e398(00) with 'Table' p_table &1.
END-OF-DEFINITION.
DEFINE fixed_val.
is_fdiff-fieldname = is_dfies-fieldname.
is_fdiff-fixed_val = &1.
is_fdiff-no_input = 'X'.
append is_fdiff to it_fdiff.
END-OF-DEFINITION.
* Selection screen
SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME.
PARAMETERS: p_table TYPE tabname OBLIGATORY "table
MEMORY ID dtb
MATCHCODE OBJECT dd_dbtb_16.
SELECTION-SCREEN: BEGIN OF LINE,
PUSHBUTTON 33(20) selopt USER-COMMAND sel,
COMMENT 55(15) selcnt,
END OF LINE.
SELECTION-SCREEN: SKIP.
PARAMETERS: p_rows TYPE i. "rows
SELECTION-SCREEN: END OF BLOCK b01,
SKIP,
BEGIN OF BLOCK b02 WITH FRAME.
PARAMETERS: p_displ TYPE c AS CHECKBOX. "display
SELECTION-SCREEN: END OF BLOCK b02.
* Initialization
INITIALIZATION.
MOVE '@4G@ Filter records' TO selopt.
* PBO
AT SELECTION-SCREEN OUTPUT.
IF w_active IS INITIAL.
CLEAR: selcnt.
ELSE.
WRITE w_active TO selcnt LEFT-JUSTIFIED.
ENDIF.
* PAI
AT SELECTION-SCREEN.
IF p_table NE is_x030l-tabname.
CALL FUNCTION 'DDIF_NAMETAB_GET'
EXPORTING
tabname = p_table
IMPORTING
x030l_wa = is_x030l
TABLES
dfies_tab = it_dfies
EXCEPTIONS
OTHERS = 1.
IF is_x030l IS INITIAL.
table_error 'does not exist or is not active'.
ELSEIF is_x030l-tabtype NE 'T'.
table_error 'is not selectable'.
ELSEIF is_x030l-align NE 0.
table_error 'has alignment - cannot continue'.
ENDIF.
* Default values for system fields
REFRESH: it_fdiff.
is_fdiff-tabname = p_table.
LOOP AT it_dfies INTO is_dfies.
IF is_dfies-datatype = 'CLNT'.
fixed_val sy-mandt.
ELSEIF is_dfies-rollname = 'ERDAT'
OR is_dfies-rollname = 'ERSDA'
OR is_dfies-rollname = 'AEDAT'
OR is_dfies-rollname = 'LAEDA'.
fixed_val sy-datum.
ELSEIF is_dfies-rollname = 'ERTIM'
OR is_dfies-rollname = 'AETIM'.
fixed_val sy-uzeit.
ELSEIF is_dfies-rollname = 'ERNAM'
OR is_dfies-rollname = 'AENAM'.
fixed_val sy-uname.
ENDIF.
ENDLOOP.
* Prepare free selection on table
REFRESH it_tables.
is_tables-prim_tab = p_table.
APPEND is_tables TO it_tables.
CLEAR: w_selid.
ENDIF.
IF sy-ucomm = 'SEL'.
IF w_selid IS INITIAL.
* Init free selection dialog
CALL FUNCTION 'FREE_SELECTIONS_INIT'
EXPORTING
expressions = it_expr
IMPORTING
selection_id = w_selid
expressions = it_expr
TABLES
tables_tab = it_tables
EXCEPTIONS
OTHERS = 1.
ENDIF.
* Display free selection dialog
CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
EXPORTING
selection_id = w_selid
title = 'Selection'
status = 1
as_window = 'X'
IMPORTING
expressions = it_expr
field_ranges = it_ranges
number_of_active_fields = w_active
TABLES
fields_tab = it_fields
EXCEPTIONS
OTHERS = 1.
ENDIF.
* Start of processing
START-OF-SELECTION.
PERFORM f_create_table USING p_table.
PERFORM f_select_table.
PERFORM f_display_table.
* FORM f_create_table *
FORM f_create_table USING in_tabname.
FIELD-SYMBOLS: <fcat> TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = in_tabname
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
* Complete field catalog
LOOP AT it_fcat ASSIGNING <fcat>.
<fcat>-tabname = in_tabname.
ENDLOOP.
CALL FUNCTION 'LVC_FIELDCAT_COMPLETE'
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
OTHERS = 1.
ELSE.
WRITE: 'Error building field catalog'.
STOP.
ENDIF.
* Create dynamic table for data
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_content.
IF sy-subrc = 0.
ASSIGN it_content->* TO <itab>.
ELSE.
WRITE: 'Error creating internal table'.
STOP.
ENDIF.
* Create dynamic table for modif
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_modif.
IF sy-subrc = 0.
ASSIGN it_modif->* TO <ntab>.
ELSE.
WRITE: 'Error creating internal table'.
STOP.
ENDIF.
ENDFORM.
* FORM f_select_table *
FORM f_select_table.
IF w_active = 0.
SELECT * FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE <itab>
UP TO p_rows ROWS.
ELSE.
* Selection with parameters
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_WHERE'
EXPORTING
field_ranges = it_ranges
IMPORTING
where_clauses = it_where.
READ TABLE it_where INTO is_where WITH KEY tablename = p_table.
SELECT * FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE <itab>
UP TO p_rows ROWS
WHERE (is_where-where_tab).
ENDIF.
IF sy-dbcnt = 0.
WRITE: 'No record selected'.
STOP.
ENDIF.
ENDFORM.
* FORM f_display_table *
FORM f_display_table.
DATA: l_answer TYPE c,
l_eflag TYPE c.
CLEAR: w_okcode.
REFRESH: <ntab>.
* Display table contents
CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
EXPORTING
header = p_table
tabname = p_table
display_only = p_displ
endless = 'X'
no_button = space
IMPORTING
okcode = w_okcode
TABLES
nametab = it_dfies
table = <itab>
fielddif = it_fdiff
modif_table = <ntab>
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
IF p_displ IS INITIAL AND w_okcode = 'SAVE'.
* Confirm update
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = p_table
text_question = 'Do you want to update table ?'
default_button = '2'
display_cancel_button = ' '
IMPORTING
answer = l_answer
EXCEPTIONS
OTHERS = 1.
IF l_answer = '1'.
* Apply modifications
IF NOT <ntab>[] IS INITIAL.
PERFORM f_add_system USING space.
MODIFY (p_table) FROM TABLE <ntab>.
IF sy-subrc NE 0.
l_eflag = 'X'.
ENDIF.
ENDIF.
* Apply deletions
IF l_eflag IS INITIAL.
REFRESH: <ntab>.
CALL FUNCTION 'STC1_GET_DATA'
TABLES
deleted_data = <ntab>
EXCEPTIONS
OTHERS = 1.
IF NOT <ntab>[] IS INITIAL.
DELETE (p_table) FROM TABLE <ntab>.
IF sy-subrc NE 0.
ROLLBACK WORK.
l_eflag = 'X'.
ENDIF.
ENDIF.
ENDIF.
* Apply creations
IF l_eflag IS INITIAL.
REFRESH: <ntab>.
CALL FUNCTION 'STC1_GET_DATA'
TABLES
new_data = <ntab>
EXCEPTIONS
OTHERS = 1.
IF NOT <ntab>[] IS INITIAL.
PERFORM f_add_system USING 'X'.
INSERT (p_table) FROM TABLE <ntab>.
IF sy-subrc NE 0.
ROLLBACK WORK.
l_eflag = 'X'.
ENDIF.
ENDIF.
ENDIF.
IF l_eflag IS INITIAL.
COMMIT WORK.
MESSAGE s261(53).
ELSE.
MESSAGE s075(3i).
PERFORM f_select_table.
ENDIF.
ENDIF.
* Display table again
PERFORM f_display_table.
ENDIF.
ENDIF.
ENDFORM.
* FORM f_add_system *
FORM f_add_system USING new TYPE c.
FIELD-SYMBOLS: <irec> TYPE ANY,
<upd> TYPE ANY.
LOOP AT it_fdiff INTO is_fdiff.
READ TABLE it_dfies INTO is_dfies
WITH KEY fieldname = is_fdiff-fieldname.
LOOP AT <ntab> ASSIGNING <irec>.
ASSIGN COMPONENT is_fdiff-fieldname OF STRUCTURE <irec> TO <upd>.
IF is_dfies-datatype = 'CLNT'.
<upd> = sy-mandt.
ELSE.
CASE is_dfies-rollname.
WHEN 'AENAM'.
<upd> = sy-uname.
WHEN 'AEDAT' OR 'LAEDA'.
<upd> = sy-datum.
WHEN 'AETIM'.
<upd> = sy-uzeit.
WHEN OTHERS.
ENDCASE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM.
reward points if it is usefull......
Girish -
Updating internal table in dynamic way
Hi,
I want to update one internal table dynamically.I have two internal table.
One internal table has the records which are field names of the 2nd internal table.
suppose:
Itab1 is as follows:
F1 F2
aaa bbb
Itab2 as follows:
aaa bbb
This means the ITAB1 records are the fields of ITB1.Now I want to update ITAB2 when I found ITAB1-F1 is the field of ITAB2 dynamically.
Can anyone give some code hint to do so.you can use below code for this. I write it in notepad some changes may be necessary.
data: lv_c(30).
field-symbols: <f1> type any.
loop at itab1.
concatenate 'itab2' itab1-fieldname into lv_c.
assign (lv_c) to <f1>.
if assign successful this means this field exists
if sy-subrc = 0
move value to <f1>.
*modify itab2.
endif.
endloop.
Edited by: Gungor Ozcelebi on Jul 1, 2009 3:37 PM -
Hi Forum,
I am having a problem with incosistent data of two columns with semicolon separated values. Column A and column B should have the exact same number of elements, which is not always the case.
In order to split the values into rows I use the approach from a previous thread
http://social.msdn.microsoft.com/Forums/en-US/06d2a674-c166-49fc-9a70-4fbc383190bb/split-multiple-columns-into-rows-using-xml?forum=transactsql
Joining by the row number I somehow need to normalize the tables that contain the split columns so that both columns are aligned before creating the row number.
If table A has one row and table B has 2, any kind of join would replicate the one row of table A. This gives me a wrong result. What I need is row 1 from table A match row 1 from table B and (non-existing) row 2 from table A with value null match row
2 from table B (vice versa). So:
Table A:
pk manufacturer
1 man A
Table B:
pk partnumber
1 part A
1 part B
should result in Table C:
pk manufacturer partnumber
1 man A part A
1 null part B
how can I achieve this?
TIA
Alex>> I am having a problem with inconsistent data of two columns with semicolon separated values. <<
This make no sense. A column has only scalar values by definition. What you have described is a mess that has nothing to do with RDBMS or correct SQL.
>> In order to split the values into rows I use the approach from a previous thread
http://social.msdn.microsoft.com/Forums/en-US/06d2a674-c166-49fc-9a70-4fbc383190bb/split-multiple-columns-into-rows-using-xml?forum=transactsql <<
This should never be done in the database. XML is not SQL.
>> Joining by the row number I somehow need to normalize the tables that contain the split columns so that both columns are aligned before creating the row number. <<
Row number? We have a ROW_NUMBER() function, but RDBMS is based on sets and sequential files, so there is no physical row number.
Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums. Without it, we cannot help you. What you want to do is non-relational garbage, not proper RDBMS. Your poorly named table “C” is not table! It is a report with display formatting. An SQL programmer would never destroy
information by turning a known value into a NULL.
Why do you think that this is how SQL works? I have to teach people and I need to know what leads to such fundamental mistakes. It looks like you have no idea what a table is and have confused this concept with a deck of punch cards that can be shuffled together.
Oh, there are horrible kludges, but why not learn to do it right instead?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Manage the filter of a caracteristic variable in a dynamic way
Dear expert,
I would like to maintain the values of a filter of a caracteristic variable in the table TVARVC so that the users could modify them as they want. (In my user exit, i will call the variables stocked in the table)
But the problem i have is that it seems impossible to define multiple values for a variable in TVARVC.
Is there anyone who knows this? Or some other solutions to manager a filter or default values of a caracteristic variable ?
Thanks in advance.Hi Jef,
What do you mean by impossible ? The key NUMB of the TVARVC is intended for multiple values (type S for Select-option and a different NUMB for the different values).
Regards,
Fred
Maybe you are looking for
-
Unexpected error message when ordering book
During the last few days I've been getting an " Unexpected error occurred, try again later." Anyone else experiencing this? I've done many books in the past with iPhoto, but this is the first time I get an error message.
-
Hi Experts, I am working on forms 6i. I have datablock on 'EMP' table. I have query window with 'EMPNO' to query. It's working fine. Requirement: When I click FIND button, i need get the data from other table of same EMP table structure and populate
-
Creating a calendar of events based upon selections made in other tables
I have a Sheet that I've started working on the includes a variety of pop-up menus that reference look up tables on another sheet that contain names and prices of products. In conjunction with the drop down menus are a series of check boxes for the m
-
Error with Desktop Integration on Macs
My JWS program runs fine on several Macs (running on 1.4.2-XX and 1.5), however, whenever I try to use the desktop integration, I get an error creating the shortcuts. There are no problems on Windows clients.
-
Change folder for websites to be shared
Hello, I want to change the standard-folder which is used by websharing to a folder which is located in a dropbox folder. How can I manage that? Which apache-files need to be changed? I can not think, that this should not be possible... Thx for help