BRIDGE statement in a loop : dynamic destination and source table names ...
Hello,
I can't find the right syntax to do what I need, if it's possible :
Context :
I work actualy on a migration from MS Access applications to Oracle (datas only). So I copied all MS Access Tables into Oracle and created manualy all the relationnal constraints like primary and foreign keys ('cause constraints are not included in 'Copy to Oracle').
I Have often to refresh my datas, because the MS access applications are still in use. Therefore I wrote PL/SQL scripts. They do the folowing, using dynamic SQL with 'Execute Immediate' statement :
Script 1
- disable all user's constraints
- disable all user's triggers
- truncate all user's tables
(Here, I have to do a manual copy of all MS Access tables to Oracle, checking the Append check-box, because the BRIDGE statement doesn't support 'Execute Immediate', and wait...)
Script 2
- enable all user's constraints
- enable all user's triggers
Could someone let me know how Il could do the same as :
For t in (select table_name from user_tables) loop
-- Copy the datas from an Access table into the same Oracle table
execute immediate ('BRIDGE ' || t.table_name || ' AS MyAccessConnName(select * from ' || t.table_name || ') APPEND') ;
-- News flash ...
dbms_output.put_line('Table ' || t.table_name || ' filled') ;
end loop;
-------------------------------------------------------------------------------------------------------------------------- ==> 00900. 00000 - "invalid SQL statement"
If a dynamic table name substitution is applicable in the Bridge statement from a query, I take it with joice!
Thank you for helping me...
Daniel
Hi Daniel,
The BRIDGE statement is just an extra command I implemented in the SQL Developer worksheet script runner.
It gets interpreted by SQL Developer and it dynamically creates (CREATE TABLE , INSERT INTO , SELECT ... ) statements and runs them against the connections specified.
It was developed to improve certain migration features of SQL Developer. We haven't really spent any time developing it into a customer friendly statement to be used in custom scripts.
Hence the lack of doc. But it is there and if you can make it work for yourself all the better.
When I say "One way of doing what you want". I mean I haven't thought about your particular problem exhaustively and I wouldn't want you to take my solution as gospel :)
If you are happy running a script in SQL Developer, but would rather not run 2 scripts , or cut and paste results around, you could SPOOL the results and execute them.
--call your other scripts to disable constraints during the data move
set echo off;
set feedback off;
set linesize 1000;
set pagesize 0;
set headsep off;
set termout off;
set verify off;
set heading off;
SET PAGES 0;
SET HEAD OFF;
spool c:\mydynamicscript.sql
select 'BRIDGE ' || table_name || ' AS MyAccessConnName(select * from ' || table_name||');' from user_tables ;
spool off
@c:\mydynamicscript.sql
--call another script to enable your constraints again
Regards,
Dermot.
SQL Developer Team.
Similar Messages
-
Dynamically passing the source table name to OWB mapping
I am building a mapping wherein one of the source tables is a view. The view name varies with the time parameter I pass in. I am looking at ways to pass in the time parameter to the mapping procedure such that it first gets the view name from a table and uses that view as the source table to fetch data. Any directions?
In normal PL/SQL coding, I can first get the view name and use this view name to buld a dynamic query, which can be then executed.This is a common question. The best way to do this is to use a synonym.
Create the synonym in the database and import into OWB. Use the synonym in your mapping. Have your mapping accept a mapping input for the table you want the synonym to point to. Setup a premapping process to re-create the synonym with the table you want to use.
Here is the procedure that I use. It defaults to a private synonym. Remember, the synonym will be created in the same schema that the mapping is deployed to.
CREATE OR REPLACE PROCEDURE "CAWDATA"."CREATE_SYNONYM_PRC" ("P_SYNONYM_NAME" IN VARCHAR2, "P_OBJECT_NAME" IN VARCHAR2,
"P_IS_PUBLIC_SYNONYM" IN BOOLEAN DEFAULT false) IS
BEGIN
if p_is_public_synonym = true then
execute immediate 'create or replace public synonym '|| p_synonym_name || ' for '|| p_object_name;
else
execute immediate 'create or replace synonym '|| p_synonym_name || ' for '|| p_object_name;
end if;
exception
when others
then
raise_application_error(sqlcode,sqlerrm) ;
END; -
How to identify the source column and source table for a measure
Does anyone have a query that I can use to positively identify the source column and source table for a cube measure in an SSAS cube? Visual Studio shows ID, Name, and Source, but it is nearly worthless in a large cube and database.
Also - the same for a dimension would be great.
If no query exists for this, can someone please explain how to find the source column/table for a measure and for a dimension?
Thanks.DMVs don’t expose the DataSourceView content. AMO is much better suited for object model operations like
this than the DMVs. PowerShell is also sometimes an option, but in this case C# code would be much easier because analyzing the contents of the DataSourceView is much easier using the .Net DataSet class.
Hope this helps.
Reeves
Denver, CO -
Where to see dim and fact table names for a cube.
Hello Experts,
Where to see dim and fact table names for a cube.Do a wild character search with the cube name (with '*' on both sides of the cube name) in transaction code SE11 or LISTSCHEMA...
For Eg : Cube Name is ZFIN_C111
Goto transaction code SE11
Tables - ZFIN_C111 & then F4 would give you all the associated tables for the InfoCube. -
How to get RFC Destination and Logical System name dynamically
Hi all,
I have a RFC FM written in CRM. I need to call this FM in R/3. So, i use the syntax " Call function <func> destination <destination name>. My problem is that i need to fetch the destination name dynamically..
There is a way to do so in CRM which is as follows:
DATA: lt_siteselect TYPE TABLE OF siteselect INITIAL SIZE 0,
ls_siteselect TYPE siteselect.
CALL FUNCTION 'SMOF0_READ_SITESELECT'
TABLES
to_siteselect = lt_siteselect.
READ TABLE lt_siteselect INTO ls_siteselect
WITH KEY sitetypeid = cl_smw1_siteprovider=>c_sitetype_r3oltp.
The above piece of code returns the site and also takes care of the client you are currently working on. But the specified FM is present only in R/3..
I want to achieve the functionality fulfilled by the above code in R/3.
Kindly help.
Useful answers will be rewarded.
Thanks in advance,
Karan Merwana
I can not use FM LOG_SYSTEM_GET_RFC_DESTINATION as for that i need to provide the logical system name. And the logical system name would be different for different clients.
Message was edited by:
Karan MerwanaFor those referring this thread later, I could not find a solution to this and ultimately had to do away with hardcoding of system names based on the DEV, Q, and PROD system names.
If anyone does manage to get a workaround, please let me know. -
Dynamic Structures and Internal Tables
Hi All,
I am doing a report to create condition records based on the condition type and condition table. Assume the condition type as PR00 and it as condition table of 304,305,306.Each condition table as its own header and item fields.Based on the condition table that the user specifies in the selection screen
the header and item structures of my report should change dynamically and these should be moved to the dynamic internal table that contains both header and item fields.Can anyone give an idea how to achieve it. Thanks in advance.
Regards,
Chakradhar.Hi All,
Thanks for your replies.
SPLIT i_string_line-input_str AT cl_abap_char_utilities=>horizontal_tab
INTO i_header_line-header
i_header_line-vkorg
i_header_line-vtweg
i_header_line-pltyp
i_header_line-waerk.
In the above syntax based on the condition table I selected on selection screen my flat file is as below.
case 1: If condition table given is 304
H SalesOrganization DistributionChannel Customer
I Material Releasestatus Amount Currency ValidFrom ValidTo
case 2: If condition table given is 305
H SalesOrganization DistributionChannel
I Material Releasestatus Amount Currency ValidFrom ValidTo
case 3: If condition table given is 306
H SalesOrganization DistributionChannel PriceListType DocumentCurrency
I Material Releasestatus Amount Currency ValidFrom ValidTo
In the above code i_string_line-input_str contains the following heading of fields based on the condition table we select in selection screen.when I want to split them into respective fields
using INTO clause my structure should change dynamically.How can I achieve it and my entire program is in OOPS ALV.Thanks in Advance.
Regards,
Chakradhar. -
HRESS Pay Statement - Add new Column in Overview and Selection table
Hello,
I want to add a column in the "Overview and selection" table for a pay statement service. I want to add field called "off-cycle reason" (OCCAT field from pay result).
Is there any work around to do the same?
I feel we may need to implement a BADi to do so.
Thanks,
BhushanHi Bhsuan,
Please refer to the below link.
http://scn.sap.com/thread/1486215
The badi XSS_REM_INTERFACE needs to be implemented.
Regards,
Ananth -
Dynamic bad and Log file names!!
Hi
Hi
I have the scenario like the data files would be passed as parameter to the mapping , and the mapping would have the premapping procedure which would change the file name in the external table definition. This works fine. But the one more issue I have is that, I would like to change the bad file,log file and discard file name also through this procedure. In other words, for each incoming data file I would like to create a bad ,log and disc file.So How do I accomplish in the present procedure which does the following alter table statement
execute immediate 'alter table '||p_table_name||' location('''
||p_file_name||''')';
Any suggestion would be greatly appreciated
Thanks
Balaji -
Table name that stores infopackage,DTP and BW table names
Hi,
I want to create a program to populate the fields with the BW table name(/BIC,/BI0 etc.),Infopackage name and DTP name(Process Variant).May I know from which table I can get the infopackage name using the BW table name?
Hope my question is clear enough.
Regards,
G.SrinivasanHi,
InfoPackage:
RSLDPIO Links datasource to infopackages
RSLDPIOT InfoPackage Text Description
RSLDPRULE ABAP source code for InfoPackages
RSLDPSEL Hardcoded selections in InfoPackages
RSMONICDP Contains the request-id number by data target
RSPAKPOS List of InfoPackage Groups / InfoPackages
RSSUBSTEP2EVID
https://wiki.sdn.sap.com/wiki/display/BI/ImportantTablesinSAPBI%28NW2004%29
Thanks
Reddy -
Hi,
Anyone can send below characteristics what are source field and table in SAP R/3
Account Number Business Imperative Code CC function cc office cc region cc service area cc service line Cost center office cost center service Client Company Code Contract Cost Center Document Date Document Type Employee Fiscal week( posted) Fiscal week( work date) Fiscal year/period Function H/P Industry Client Job Level Office Project Cost center Posting date Project Function PM Company code PM cost center PM function PM office PM region PM service area PM service line Project Manager Project Office Project Partner Project Region Project Service Area Project Service Line Project Type Region Sector Service Area Service Line Service Offering Staffed Cost center WBS Element WBS status Work DateHi,
If you know the technical name of the info object characteristic, go to SE16 in BI, Type table name RSOSFIELDMAP and enter your info object name. I will give you corresponding field name for that info object.
Regards,
Assgn points if helpful. -
Target and Source Table - Query from ODI Repository
Hi folks,
Can anybody help me? I am trying to query the following from an ODI 11g work repository:
All tables and for each table the tables that are listed in designer as “filled by” (don’t know the exact translation as I am using a german ODI designer) – in other words “all tables and the tables they are depending on”. The reason is to perform a connect-by query on that.
There is a solution published on ODIEXPERTS: http://odiexperts.com/interface-mapping-query, but however it does not show me the expected results. Does anyone have an idea how to get a simple table like that:
TARGET SOURCE
TAB1 TAB2
TAB1 TAB3
TAB2 TAB4
TAB3 TAB5
TAB3 TAB6
TAB6 TAB7
Using the Metadata Navigator is no option as we don’t have Weblogic installed and I need the data for further processing.If memory serves you have an SNP_POP table still in that release, join to the Model table (the joins cols are obvious if I recall) to get the datastore names and your more or less there.
I dont have that table in 11.1.1.5 and we moved over a while back so cant really take a look anytime soon. -
How to query table/comment information and lookup table names from PKs?
I am trying to figure out whether I can query the Oracle meta-data to look for:
a) comments on tables and fields matching a certain text pattern. If possible I would LIKE the text pattern matching not to be case-sensitive. Am I looking within the right meta tables?
SQL> desc all_col_comments
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
TABLE_NAME NOT NULL VARCHAR2(30)
COLUMN_NAME NOT NULL VARCHAR2(30)
COMMENTS VARCHAR2(4000)
SQL> desc user_tab_comments
Name Null? Type
TABLE_NAME NOT NULL VARCHAR2(30)
TABLE_TYPE VARCHAR2(11)
COMMENTS VARCHAR2(4000)
See http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:233014204543.
b) I was trying to look up a text named 'PKa200030' which showed up within an application upon which we are developing. The application uses Oracle 11g Enterprise Edition. However, I could not find the name anywhere when querying all_constraints, so I am not sure how to trace back the table name / package name, by knowing what seems to be a primary key constraints, any ideas please?
select c.table_name,c.constraint_name, --c.r_constraint_name,
cc.table_name
from all_constraints c
inner join all_constraints cc on c.r_constraint_name = cc.constraint_name
See http://stackoverflow.com/questions/3210743/viewing-oracles-metadata-about-primary-foreign-key-constraints.
c) I am not sure whether it is possible to draw a database entity model, perhaps using software, assuming that the primary/foreign keys have been already defined within Oracle 11g. Is software available to do this?Hi,
a) comments on tables and fields matching a certain text pattern. If possible I would LIKE the text pattern matching not to be case-sensitive. Am I looking within the right meta tables?
SQL> desc all_col_comments
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
TABLE_NAME NOT NULL VARCHAR2(30)
COLUMN_NAME NOT NULL VARCHAR2(30)
COMMENTS VARCHAR2(4000)
SQL> desc user_tab_comments
Name Null? Type
TABLE_NAME NOT NULL VARCHAR2(30)
TABLE_TYPE VARCHAR2(11)
COMMENTS VARCHAR2(4000)
....... The dictionary views are the same . A query with regular expressions may help in identifying the matching strings in comments.
b) I was trying to look up a text named 'PKa200030' which showed up within an application upon which we are developing. The application uses Oracle 11g Enterprise Edition. However, I could not find the name anywhere when querying all_constraints, so I am not sure how to trace back the table name / package name, by knowing what seems to be a primary key constraints, any ideas please?
select c.table_name,c.constraint_name, --c.r_constraint_name,
cc.table_name
from all_constraints c
inner join all_constraints cc on c.r_constraint_name = cc.constraint_name
....... There is one more view for constraints. USER_CONS_COLUMNS may be of help.
Padma -
Dynamic ALV and internal table.
Hi all,
I have a requirement of creating a dynamic field catelog based on input values in selection screen.
Example:
1) When I enter date range, say 20/03/2008 to 25/03/2008 I should have 6 columns in the output for each date with column heading as date itself.
2) For entering values for these date columns, i need to create an dynamic internal table.(values in the column will be some numbers like 10 on 20/03/2008, 15 on 21/03/2008 etc)
A rough output format would look like this:
Component | 20/03/2008 | 21/03/2008 | ..... |25/03/2008
comp1 | 10 | 15 | | 5
comp2 | 20 | 10 | | 10
Please let me know how can i achieve this...
Need it very urgently..
Regards,
DhareppaHi Dhareppa,
Refer the code below. Its almost on the same line as your requirments.
REPORT zglo2fr_master_planing_sedul NO STANDARD PAGE HEADING.
P R O G R A M H E A D E R *
ArthroCare Corporation *
Program : ZGLO2FR_MASTER_PLANING_SEDUL *
Author : Munvar Basha *
Creation Date : 11Mar08 *
Release : SAP ECC 6.0 *
Request : D01K904032 *
Description : Master Schedule Planning *
Change log (Revisions) *
Author Date Request Description *
P R O G R A M *
DATA DECLARATION *
**--Structure to hold matrial & plant combination records.
TYPES : BEGIN OF ty_marc,
matnr TYPE matnr,
werks TYPE werks_d,
dispo TYPE dispo,
beskz TYPE beskz,
mtart TYPE mtart,
END OF ty_marc.
**--structure to hold MRP LIST Data.
TYPES : BEGIN OF ty_mrp_list,
matnr TYPE matnr,
werks TYPE werks_d,
maktx TYPE maktx,
meins TYPE meins,
mtart TYPE mtart,
week TYPE kweek,
mng01 TYPE mng01,
delkz TYPE delkz,
END OF ty_mrp_list.
**--structure to hold no of weeks.
TYPES: BEGIN OF ty_week,
week TYPE kweek,
END OF ty_week.
**--structure to hold output data.
TYPES : BEGIN OF ty_final,
matnr TYPE matnr,
werks TYPE werks_d,
maktx TYPE maktx,
meins TYPE meins,
mtart TYPE mtart,
week TYPE kweek,
mng01 TYPE mng01,
END OF ty_final.
TYPES : BEGIN OF ty_range,
sign TYPE sign,
option TYPE option,
low TYPE sy-datum,
high TYPE sy-datum,
END OF ty_range.
Definitions of Table types. *
TYPES : ty_marctab TYPE STANDARD TABLE OF ty_marc.
Definitions of Ranges *
*RANGES ran_delkz FOR mdez-delkz.
DATA : i_ran_delkz TYPE RANGE OF mdez-delkz,
wa_ran_delkz LIKE LINE OF i_ran_delkz,
wa_date type ty_range.
Definitions of internal tables. *
data : i_marc type standard table of ty_marc,
i_mrp_list type standard table of ty_mrp_list,
i_week type standard table of ty_week,
i_final type standard table of ty_final,
i_mdps type standard table of mdps,
i_mdez type standard table of mdez,
i_mdsu type standard table of mdsu.
Definitions of work areas for internal tables *
DATA : wa_marc TYPE ty_marc,
wa_mrp_list TYPE ty_mrp_list,
wa_week TYPE ty_week,
wa_final TYPE ty_final,
wa_mt61d TYPE mt61d,
wa_mdez TYPE mdez.
Definitiions of General variables *
DATA : v_matnr TYPE mara-matnr, " Material Number
v_mtart TYPE mara-mtart, " Material Type
v_beskz TYPE marc-beskz, " Procurement Type
v_werks TYPE marc-werks, " Plant
v_dispo TYPE marc-dispo. " MRP Controller (Materials Planner)
DATA : v_mng01 TYPE mng01. "Requirement Quantity
DATA : v_year TYPE char4,
v_week TYPE char2,
v_ok_code TYPE sy-ucomm.
Definitiions of Constants *
CONSTANTS : k_slash TYPE c VALUE '/',
k_6 TYPE char8 VALUE '6',
k_x TYPE c VALUE 'X'.
Definitiions of Field Catlog *
DATA : wa_fieldcat TYPE lvc_s_fcat,
i_fieldcat TYPE lvc_t_fcat,
v_container TYPE scrfname VALUE 'CONTAINER_OUTPUT',
v_custom_container TYPE REF TO cl_gui_custom_container,
v_grid TYPE REF TO cl_gui_alv_grid,
i_gp_table TYPE REF TO data,
wa_gp_line TYPE REF TO data.
FIELD-SYMBOLS: <gt_table> TYPE STANDARD TABLE,
<gwa_table> TYPE ANY,
<l_field> TYPE ANY,
<l_matnr> TYPE ANY,
<l_werks> TYPE ANY,
<l_maktx> TYPE ANY,
<l_meins> TYPE ANY,
<l_mtart> TYPE ANY.
DECLERATIONS FOR SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR v_matnr,
s_mtart FOR v_mtart NO INTERVALS,
s_beskz FOR v_beskz NO INTERVALS NO-EXTENSION,
s_werks FOR v_werks NO INTERVALS NO-EXTENSION
OBLIGATORY,
s_dispo FOR v_dispo,
s_date FOR sy-datum OBLIGATORY.
PARAMETERS : p_dattp TYPE dattp OBLIGATORY DEFAULT '1'.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION EVENT *
INITIALIZATION.
CALL FUNCTION '/BEV4/PLPS__ADD_MONTH_TO_DATE'
EXPORTING
months = k_6
olddate = sy-datum
IMPORTING
newdate = wa_date-high.
wa_date-low = sy-datum.
wa_date-option = 'EQ'.
wa_date-sign = 'I'.
APPEND wa_date to s_date.
SELECTION SCREEN EVENT *
**--Validation for Material
AT SELECTION-SCREEN ON s_matnr.
PERFORM validate_material.
**--Validation for Plant
AT SELECTION-SCREEN ON s_werks.
PERFORM validate_plant.
AT SELECTION-SCREEN ENENT *
AT SELECTION-SCREEN.
IF s_matnr IS INITIAL AND s_dispo IS INITIAL.
MESSAGE text-002 TYPE 'E'.
ENDIF.
IF s_date-low LT sy-datum.
MESSAGE text-003 TYPE 'E'.
ENDIF.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
**--refreshing the internal tables
REFRESH : i_marc,
i_mrp_list,
i_week,
i_final,
i_mdps,
i_mdez,
i_mdsu.
**--clearing the work areas of internal tables.
CLEAR : wa_marc,
wa_mrp_list,
wa_week,
wa_final,
wa_mt61d,
wa_mdez.
To get all the matrial(s) and plant combination records
SELECT a~matnr
a~werks
a~dispo
a~beskz
b~mtart
INTO TABLE i_marc
FROM marc AS a INNER JOIN
mara AS b
ON a~matnr = b~matnr
WHERE a~werks IN s_werks AND
a~matnr IN s_matnr AND
a~dispo IN s_dispo AND
a~beskz IN s_beskz AND
b~mtart IN s_mtart.
IF sy-subrc <> 0.
MESSAGE text-005 TYPE 'S'.
LEAVE LIST-PROCESSING.
ENDIF.
SORT i_marc BY matnr werks.
Ranges to Filter the MRP list only for the following MRP Elements.
MRP Elements are : BA, BE, FE, LE and PA
wa_ran_delkz-sign = 'I'.
wa_ran_delkz-option = 'EQ'.
wa_ran_delkz-low = 'BA'.
APPEND wa_ran_delkz TO i_ran_delkz.
CLEAR wa_ran_delkz-low.
wa_ran_delkz-low = 'BE'.
APPEND wa_ran_delkz TO i_ran_delkz.
CLEAR wa_ran_delkz-low.
wa_ran_delkz-low = 'FE'.
APPEND wa_ran_delkz TO i_ran_delkz.
CLEAR wa_ran_delkz-low.
wa_ran_delkz-low = 'LE'.
APPEND wa_ran_delkz TO i_ran_delkz.
CLEAR wa_ran_delkz-low.
wa_ran_delkz-low = 'PA'.
APPEND wa_ran_delkz TO i_ran_delkz.
CLEAR wa_ran_delkz-low.
LOOP AT i_marc INTO wa_marc.
CALL FUNCTION 'MD_MRP_LIST_API'
EXPORTING
matnr = wa_marc-matnr
werks = wa_marc-werks
sinfg = k_x
inper = p_dattp
IMPORTING
e_mt61d = wa_mt61d
TABLES
mdpsx = i_mdps
mdezx = i_mdez
mdsux = i_mdsu
EXCEPTIONS
mrp_list_not_found = 1
material_plant_not_found = 2
error = 3
OTHERS = 4.
IF sy-subrc = 0.
LOOP AT i_mdez INTO wa_mdez WHERE dat00 IN s_date AND
delkz IN i_ran_delkz.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = wa_mdez-dat00
IMPORTING
week = wa_mrp_list-week
EXCEPTIONS
date_invalid = 1
OTHERS = 2.
IF sy-subrc = 0.
wa_mrp_list-matnr = wa_mt61d-matnr.
wa_mrp_list-werks = wa_mt61d-werks.
wa_mrp_list-maktx = wa_mt61d-maktx.
wa_mrp_list-meins = wa_mt61d-meins.
wa_mrp_list-mtart = wa_mt61d-mtart.
wa_mrp_list-delkz = wa_mdez-delkz.
wa_mrp_list-mng01 = wa_mdez-mng01.
APPEND wa_mrp_list TO i_mrp_list.
CLEAR : wa_mrp_list,
wa_mdez.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR: wa_marc.
ENDLOOP.
IF i_mrp_list IS INITIAL.
MESSAGE text-006 TYPE 'S'.
LEAVE LIST-PROCESSING.
ENDIF.
CLEAR : v_mng01.
LOOP AT i_mrp_list INTO wa_mrp_list.
v_mng01 = v_mng01 + wa_mrp_list-mng01.
AT END OF week.
wa_final-matnr = wa_mrp_list-matnr.
wa_final-werks = wa_mrp_list-werks.
wa_final-maktx = wa_mrp_list-maktx.
wa_final-meins = wa_mrp_list-meins.
wa_final-mtart = wa_mrp_list-mtart.
wa_final-week = wa_mrp_list-week.
wa_final-mng01 = v_mng01.
wa_week-week = wa_mrp_list-week.
APPEND : wa_final TO i_final,
wa_week TO i_week.
CLEAR : v_mng01,
wa_final,
wa_week.
ENDAT.
CLEAR : wa_mrp_list.
ENDLOOP.
**-- Populate the Field catalog
PERFORM populate_fieldcat.
**--Create table dynamically
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fieldcat
IMPORTING
ep_table = i_gp_table.
ASSIGN i_gp_table->* TO <gt_table>.
**--fill table with final output data
PERFORM fill_table.
CALL SCREEN 100.
SUB ROUTINES *
*& Form validate_material *
Validating Material Number(s) *
FORM validate_material .
TYPES : BEGIN OF l_ty_matnr,
matnr TYPE matnr,
END OF l_ty_matnr.
DATA : l_i_matnr TYPE STANDARD TABLE OF l_ty_matnr.
SELECT matnr
FROM mara
INTO TABLE l_i_matnr
WHERE matnr IN s_matnr.
IF sy-subrc <> 0.
MESSAGE text-004 TYPE 'E'.
ENDIF.
ENDFORM. " validate_material
*& Form validate_plant *
Validating Plant Number *
FORM validate_plant .
DATA : l_v_werks TYPE werks_d.
SELECT SINGLE werks
FROM t001w
INTO l_v_werks
WHERE werks = s_werks-low.
IF sy-subrc <> 0.
MESSAGE e019(zartc) WITH s_werks-low.
ENDIF.
ENDFORM. " validate_plant
*& Form populate_fieldcat
text
--> p1 text
<-- p2 text
FORM populate_fieldcat .
DATA : l_v_colname TYPE char7.
SORT i_week BY week.
DELETE ADJACENT DUPLICATES FROM i_week COMPARING week.
LOOP AT i_week INTO wa_week.
AT FIRST.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-scrtext_l = text-007.
wa_fieldcat-scrtext_m = text-007.
wa_fieldcat-scrtext_s = text-007.
wa_fieldcat-fix_column = 'X'.
wa_fieldcat-outputlen = 18.
wa_fieldcat-tooltip = text-007.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-scrtext_l = text-008.
wa_fieldcat-scrtext_m = text-008.
wa_fieldcat-scrtext_s = text-008.
wa_fieldcat-fix_column = 'X'.
wa_fieldcat-outputlen = 4.
wa_fieldcat-tooltip = text-008.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-scrtext_l = text-009.
wa_fieldcat-scrtext_m = text-010.
wa_fieldcat-scrtext_s = text-011.
wa_fieldcat-tooltip = text-009.
wa_fieldcat-outputlen = 40.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 4.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-scrtext_l = text-012.
wa_fieldcat-scrtext_m = text-013.
wa_fieldcat-scrtext_s = text-014.
wa_fieldcat-outputlen = 4.
wa_fieldcat-tooltip = text-012.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 5.
wa_fieldcat-fieldname = 'MTART'.
wa_fieldcat-scrtext_l = text-015.
wa_fieldcat-scrtext_m = text-015.
wa_fieldcat-scrtext_s = text-016.
wa_fieldcat-tooltip = text-015.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDAT.
v_year = wa_week-week+0(4).
v_week = wa_week-week+4(2).
CONCATENATE v_week k_slash v_year INTO l_v_colname.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 6 + sy-index.
wa_fieldcat-fieldname = wa_week-week.
wa_fieldcat-quantity = 'X'.
wa_fieldcat-outputlen = 18.
wa_fieldcat-scrtext_l = l_v_colname.
wa_fieldcat-tooltip = l_v_colname.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR : wa_fieldcat,
l_v_colname,
wa_week.
ENDLOOP.
ENDFORM. " populate_fieldcat
*& Form fill_table
text
--> p1 text
<-- p2 text
FORM fill_table .
**--Create Work Area Dynamically
CREATE DATA wa_gp_line LIKE LINE OF <gt_table>.
ASSIGN wa_gp_line->* TO <gwa_table>.
DATA : l_v_col TYPE char25,
l_v_val TYPE char25.
LOOP AT i_final INTO wa_final.
l_v_col = wa_final-week.
ASSIGN COMPONENT l_v_col OF STRUCTURE <gwa_table>
TO <l_field>.
IF <l_field> IS ASSIGNED.
l_v_val = wa_final-mng01.
CONDENSE l_v_val.
<l_field> = l_v_val.
clear : l_v_val,
l_v_col.
ENDIF.
AT END OF matnr.
READ TABLE i_final INTO wa_final WITH KEY matnr = wa_final-matnr
BINARY SEARCH.
IF sy-subrc = 0.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <gwa_table>
TO <l_matnr>.
IF <l_matnr> IS ASSIGNED.
<l_matnr> = wa_final-matnr.
ENDIF.
ASSIGN COMPONENT 'WERKS' OF STRUCTURE <gwa_table>
TO <l_werks>.
IF <l_werks> IS ASSIGNED.
<l_werks> = wa_final-werks.
ENDIF.
ASSIGN COMPONENT 'MAKTX' OF STRUCTURE <gwa_table>
TO <l_maktx>.
IF <l_maktx> IS ASSIGNED.
<l_maktx> = wa_final-maktx.
ENDIF.
ASSIGN COMPONENT 'MEINS' OF STRUCTURE <gwa_table>
TO <l_meins>.
IF <l_meins> IS ASSIGNED.
<l_meins> = wa_final-meins.
ENDIF.
ASSIGN COMPONENT 'MTART' OF STRUCTURE <gwa_table>
TO <l_mtart>.
IF <l_mtart> IS ASSIGNED.
<l_mtart> = wa_final-mtart.
ENDIF.
APPEND <gwa_table> TO <gt_table>.
CLEAR <gwa_table>.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. " fill_table
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZMUNNA'.
SET TITLEBAR 'MRP'.
IF v_custom_container IS INITIAL.
CREATE OBJECT v_custom_container
EXPORTING
container_name = v_container.
CREATE OBJECT v_grid
EXPORTING
i_parent = v_custom_container.
CALL METHOD v_grid->set_table_for_first_display
CHANGING
it_outtab = <gt_table>
it_fieldcatalog = i_fieldcat.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
v_ok_code = sy-ucomm.
CLEAR sy-ucomm.
CASE v_ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
SET SCREEN 000.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form exit_program
text
--> p1 text
<-- p2 text
FORM exit_program .
CALL METHOD v_custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
ENDFORM. " exit_program
Reward points if that helps.
Manish -
Hi Gurus,
In which table I can see roles and its corresponding query name both.
Thanks
LizaHi Liza,
Check this:
Role table
Regards
Asign point if useful -
Question on Dynamic Query Data Source and Form Folders in Oracle Forms 6i
Hi there -
I have one interesting requirement in Oracle Forms.
This is what I wanted to do.
1. Have a LOV and Go button on Form.
2. From LOV, I will select a pre-defined custom table and click Go.
3. Based on the selected custom table, I have to populate the Block (Tabular Format).
4. User should be able to do update, delete, insert on this block.
5. User should be able to use the Oracle Form folders functionality (select only necessary column and save views etc. Std folder functionality).
6. If user selects a different custom table name in the LOV on top, I need to refresh the data from the block based on this new table. Remaining functionality should be as it is (steps 3 to 5).
You can see here, I am going to have dynamic query data source (Table Name as well as column mapping) on the block. I do not know before hand how many columns the user selected table has!
This is what I have planned for this so far but I have some major questions before I can move on with this design:
1. I am going to create a table structure with fixed number of column in form (40 cols assuming that the custom table will not have more that 40 cols). (Kind of limitation but it's okay as of now).
2. Dynamically populate the block based on the table name selected by the user from LOV. Dynamically change the table column names based on the table selected etc.
3. Perform insert, update, delete using PL/SQL package.
So far it looks okay.
Now my real question is,
Can user still be able to user "Folders" functionality here? I have never done this kind of development before and I doubt the dynamic column naming, dynamic column data source will really work for "folders"!
Also, I am not really sure whether user will be able to save these "folder" queries?
Okay so form experts, can you ppl suggest me if this is really going to work? Are there any better ways to do this?
Initially I tried to do this in OA Framework but I got stuck at because as per OAF developer guide "I cannot user OAF personalization for dynamic items, regions etc".
For more info on that thread see this link...
Re: setUserCustomizable issue!
Thanks in advance for the help.Any suggestion anyone?
Maybe you are looking for
-
Get the current item in advance table by clicking button
hello friends, i have an urgent requirement that... 1) i have a search page, when i click the go button all the search results should populate into table region. 2) every row having username, firstname,lastname,email ...etc. and one disable user butt
-
I just got a 60G iPod Photo and it's great but when I select Slideshow Settings>Music>From iPhoto I get silence from the iPod when I play a slideshow. It works fine if I select anything other than "From iPhoto". I have made sure the song is on the co
-
What can I do for "File size too large"?
Spent 9 hrs creating a slideshow that I saved. Closed PSE 11 and reopened and can no longer find the slideshow. When I select Find, Media type, Project, nothing appears, but there is a gray box in my grid that says "File size too large". Is this m
-
Ok, I have a what hope is an easy to solve problem: I have a BufferedImage that shows what a Swing component looks like, like a screenshot. This is how I create it: BufferedImage i = new BufferedImage(this.getSize().width,this.getSize().height,Buffer
-
Sharing Files Over a Network from an External Drive
I have a Macbook Pro that is running 10.5.6, and I have, recently, acquired another Mac that is running 10.5.6, as well. I decided that I wanted to share some files from my Macbook Pro. The setup for file sharing is a breeze, but I am having some iss