Dynamic selection using LDB
Hi,
I want to include two fields of custom infotype in dynamic selection of LDB so that they are handeled automatically by LDB while selection.
can anyone tell me how to achieve the same?
Thanks
-Aleria
Thankyou for the reply. However, can you plz tell me the step to followfor addition of fields after copying the LDB.
-Aleria
Similar Messages
-
Hi Abapers,
I'm using LDB:; SDF - G/L Account database where im restricting few document types thru dynamic selection. I need to access dynamic selection - document type in End-of-selection of my program while selecting document header details. Can i read Dynamic values in my program?DYN_SEL global variable. See [abap documentation|http://help.sap.com/abapdocu/en/ABAPSELECTION-SCREEN_LDB_DYNAMIC.htm] and [sap library|http://help.sap.com/saphelp_nw70/helpdata/EN/67/93b80914a911d2953c0000e8353423/frameset.htm]
-
Hello Guys,
I hope some of you will be using the LdB FMF and the many SAP reports that use FMF. It is in Funds Management, specifically for Public sectors.
There are some transactions for the program RFFMEPGAX. When any of these transactions or program is executed, the selection screen comes up with some PRE-DETERMINED NODES for dynamic selections. There are about 20+ nodes for FMF, but the dynamic selections are available only for 5 nodes.
I am not able to figure out where and how these nodes are restricted. I need to make few other fields available for dynamic selections. I hope some of you will be able to help me out.
Thank you all for your time.
PS: I am not sure, but think FMF is available only in Enterprise.The nodes for dynamic selection that are displayed are the nodes that the program is using. Try this simple program that uses LDB FMF:
REPORT zcdf_ldb_test.
TABLES: fkrs, ffnd.
WRITE: sy-datum.
I get dynamic selections for only these 2 tables. Keep adding tables and you get more nodes for dynamic selection. So when you see 5 nodes, the selection screen is trying to tell you that only those 5 tables are used by the program. Making more available that the program does not use would be misleading to the user.
You can use transaction SE36, and do a where used on LDB FMF to find other programs that use this LDB and execute them to see how the number of dynamic nodes changes.
In SE36, click on Selections to see all of the tables available for dynamic selection.
Is this the information your were looking for? -
Hi,
I am trying to use the LDB PSJ in one of my custom Reports,
We are interested only in the "Dynamic Selections" part of the LDB.
Right now the report works fine without any LDB assigned,but once the LDB is assigned,
the report code does not get executed. Am assuming the LDB is doing some check and exiting
without executing the report code.
The selection screen is not modified, i.e it still displays my custom Selection screen
and not one by the LDB.
Is there some way of disabling this selection or this check.
and also how do I go about programming to use the fields selected in the dynamic selection
for my select statments.
Am assuming will be able to get the fieldname once the user selects it ,and then will be able to us them
Appreciate any input
Thank u
LalithaHad u got the solution , i am facing the same problem
Thanks -
Values of dynamic selections for LDB DDF
Hi
I have to customize a SAP standard program which is using LDB-DDF. As per client requirement, we have to add a few select statement and there we have to add the selection criteria of dynamic selections.
The problem I am facing is that I dont know how and where i can track the values given in the dynamic selection screen.
I did some research and I found out that values entered in the dynamic selections is stored in complex data object (deep structure) but I am not able to find it where and how we can use it.
The name of the SAP standard program is RFDZIS00.
Thanks in advance
BhavHi,
In SE36-> DDF-> select the Selections radio button.
Menubar Extras->Selection Views-> Here you can change the "origin of view" which is created by SAP or we can create our own views under "origin of view" CUS.
Best Regards,
Mohan, -
Dynamic select using jsp?
grrrrr............ok so I'm kinda new to this, and just a little frustrated. I'm gonna ramble here, so any time I sound like I don't know what I'm talking about it 's because I don't..correct me. I want to include a bean in a jsp which will buil d a dynamic select box on the fly. That is, connect to an LDAP db and place each value returned in the query in a select box. Now, I can compile and run the bean in my IDE and watch the output in the console. It's correct because I see "<select><option value = hall>hall....</select>". In the buildSelectBox() method I'm using System.out.println to display each line of my select box (is that right?). Now, when I copy the .class file over to the server I was initially getting an error because the bean wasn't found. I resolved that by properly compiling the bean in a package. Problem is that if I call the bean.buildSelect() method in the .jsp nothing comes back. The page is left blank. What in the world is that about? Can someone push me toward a tutorial that can push me in the right direction or sumthin? Why am I having so much trouble with this? Should I be building the select on the jsp?
regards,
matHi!
If i understand you correctly :-) you are doing not very right things. I don't want it to seem like I'm going to teach you, but:
The Bean that has buildSelect() method is not a bean at all. Usualy Beans contain getter/setters and accumulate data. If you want to build html code dynamicaly then you should use servlets(Which is not very flexible in your situation, I think), not JSPs. And if you are using JSPs then you have to make Tag which will do this everything.
Other way is to use Struts framework which is very good and flexible for building web applications - it has it's own tags for many cases. You can make loops in JSPs, use beans and all that stuff.
Guys will correct me if I missed something.
Good luck -
Error on a Dynamic Select using Pro*C
I am a new user on Pro*C and I am facing an error for which I could not find a solution in the Pro*C/C++ Programmer’s Guide. The problem occurs when I do a dynamic SELECT to retrieve sequence of numbers (from 0 to 10) from a very simple table in a database.
The program is retrieving the following sequence: {705, 961, 1217, 1473, 1729, 1985, 2241, 2497, 2753, 3009} rather than the sequence {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
It’s very interesting to notice that the retrieved sequence, in hexadecimal, is equal to {2C1, 3C1, 4C1, 5C1, 6C1, 7C1, 8C1, 9C1, AC1, BC1}.
I am quite sure that I'm missing a small detailed here and I would appreciate
any help. Please find below the code that I am using.
Thanks a lot!
#include <string>
#include <iostream>
using namespace std;
#include <sqlca.h>
#include <sqlcpr.h>
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR username[30];
VARCHAR password[30];
VARCHAR db_name [30];
VARCHAR dns_name[30];
EXEC SQL END DECLARE SECTION;
void SQL_Error ( void )
char msg[200];
size_t buf_len = sizeof ( msg );
size_t msg_len;
sqlglm( msg, &buf_len, &msg_len );
if ( msg_len > buf_len )
msg_len = buf_len;
cout << msg << endl;
bool OpenDBConnection( char uname, char pword, char dns, char dbname )
// Assign the database identifications to the ORACLE variables
username.len = (unsigned short) strlen ( strcpy( (char *) username.arr, uname ) );
password.len = (unsigned short) strlen ( strcpy( (char *) password.arr, pword ) );
dns_name.len = (unsigned short) strlen ( strcpy( (char *) dns_name.arr, dns ) );
db_name.len = (unsigned short) strlen ( strcpy( (char *) db_name.arr , dbname ) );
/* Register sql_error() as the error handler */
EXEC SQL WHENEVER SQLERROR goto err;
/* Connect to the non default database */
EXEC SQL CONNECT :username IDENTIFIED BY :password AT :db_name USING :dns_name;
return ( true );
err:
SQL_Error();
return ( false );
** Select the database using a dynamic method
long SelectIDRecord ( void )
EXEC SQL BEGIN DECLARE SECTION;
// Define the dynamic statement
char dyn_statement[4000];
// Define the bind variables
long db_id = 0;
long db_id_type = 2; /* NUMBER */
long db_id_len = 10;
EXEC SQL END DECLARE SECTION;
// Initialize the dynamic statement
memset ( dyn_statement, 0, sizeof( dyn_statement ) );
strcpy ( dyn_statement, "SELECT ID FROM TEST_DB ORDER BY ID" );
EXEC SQL AT :db_name PREPARE s1 FROM :dyn_statement;
// Declare and initialize the output descriptor
EXEC SQL ALLOCATE DESCRIPTOR 'out';
EXEC SQL AT :db_name DESCRIBE OUTPUT s1 USING DESCRIPTOR 'out';
EXEC SQL SET DESCRIPTOR 'out' value 1 TYPE = :db_id_type,
LENGTH = :db_id_len, DATA = :db_id;
// Declare and open the cursor
EXEC SQL AT :db_name DECLARE test_db_cursor CURSOR FOR s1;
EXEC SQL AT :db_name OPEN test_db_cursor;
EXEC SQL WHENEVER NOT FOUND DO BREAK;
long nRec = 0;
while ( true )
EXEC SQL AT :db_name FETCH test_db_cursor INTO DESCRIPTOR 'out';
EXEC SQL GET DESCRIPTOR 'out' VALUE 1 :db_id = DATA;
nRec++;
cout << "ID = " << (long) db_id << endl;
// Close the cursor
EXEC SQL AT :db_name CLOSE test_db_cursor;
EXEC SQL DEALLOCATE DESCRIPTOR 'out';
return ( nRec );
err:
SQL_Error();
return ( 0 );
int main ()
char *uname = "test";
char *pword = "test";
char *dns = "test_db";
char *dbname = "test";
OpenDBConnection ( uname, pword, dns, dbname );
long nRec = SelectIDRecord ();
}No need to specify the length if the data type is number and pointing to Long.
You can directly map the values using INTO clause. -
Read Dynamic Selections for LDB ADA
Hi,
I have a report program using Logical Database ADA, but for performance reasons needed to include a wrapper program , so that the wrapper program schedules a job in case the report is run for huge volume comp codes.
Now the actual program uses the logical database ADA, which gives them the option of dynamic selections,So needed to add it to the wrapper also, since we they need to have the option to be able to enter conditions in Dynamic selections also. Now How do I pass the dynamic selections made in the wrapper to the actual program.Was planning to export the selection to memory and then import it.
I schedule the job or run it in foreground based on the selection made using the SUBMIT functionality.
Would be great if someone can let me know how to read the dynamic selections entered.
Thank you
LalithaHi,
You have to use SUBMIT statement with FREE SELECTIONS. Declare RSDS structure and fill them.
Just refer this block, similar type of code
Re: Reg: SUBMIT WITH Free Selections
Thanks & Regards
Bala Krishna -
Hi,
I am using logical database PSJ. I need to use dynamic selections for fields PROFIT CENTER,COST CENTER.
But not PROJECT,WBS ELEMENT ETC. For this u can run the transaction s_alr__87013573 .
Kindly help me immUse
Loop at screen.
if screen-name = 'XXX'.
screen-active = 1.
endif.
modify screen.
Endloop. -
Dynamic Selection using Summarization Fields Missing in TCODE CN43N
If Using TCODE CN43 I can select using Summarization Fiields from PSMERK via Dynamic Selections.
However, when I use TCODE CN43N the "Summarization Fields" node is not displayed.
Does anyone know if it is possible to activate this option for CN43N.Hi,
Please refer sap note 679705.
hope it will be helpful
thanks
abdul -
Want to have own selection screen in HR-ABAP report using LDB
Hi experts,
I am working on HR-ABAP report using LDB pnp and infotypes..But, here we get the built in selection criterion..but I want my own selection screen to be displayed..whats the solution for this??? Is it possible to create my own selection screen instead of default one..and how???
Please help me..its very urgent..Hi,
chk this out:
Create Report Categories
In this step, you define the report categories and determine the layout
of the standard selection screen for these report categories. You can
create report categories for programs or queries that are based on the
PNP or PNPCE logical databases.
The definition of report categories is divided into two sections:
o In the Change Report Category view, you define general attributes
such as sort order, input fields for date, and so on.
o In the Change Selection Criteria view, you define which selection
fields of the logical database should be avaliable on the selection
screen.
Example
You want to set up your system so that your employees can only start
evaluation reports for Payroll if they use a payroll area. Within a
payroll area, you should be able to select according to personnel
number. Additional selection criteria should not be possible and you
should not be allowed to enter a sort sequence.
Standard settings
The standard system already contains report categories. You can find the
attributes of the report categories in the table.
Note the following five report categories in particular:
o Report category ' ' is the SAP default report category for
programs that are based on the PNP logical database.
o Report category PNPCE is the SAP default category for programs that
are based on the PNPCE logical database.
o Report category '00000000' is the customer-specific default category
for programs that are based on the PNP logical database.
o Report category '0PNPCE' is the customer-specific default category
for programs that are based on the PNPCE logical database.
o Report category __X2001 is the default category for Queries that
are based on an InfoSet of the PNP LDB.
o Report category QUEPNPCE is the default category for queries that
are based on an InfoSet of the PNPCE LDB.
The default report categories are used when a report is called if
the report has not been assigned a report category.
Parameters and Options for Report Categories of the LDB PNP and PNPCE
Parameters and Options in Screen Area General Data
If you activate this parameter, you can only enter data on the data
selection period if you use reports that have been assigned. The
same date entries are then used for the person selection as for the
date selection.
o Matchcode allowed
If you activate this parameter, you have use of a Matchcode
pushbutton (search help) if you use reports that have been assigned.
This pushbutton enables you to perform the person selection.
o Sort allowed
If you activate this parameter, you have use of a Sort pushbutton if
you use report that have been assigned. This pushbutton enables you
to define a sort order before you execute the report.
o Organizational structure allowed
If you activate this parameter, you have use of an Org.Structure
pushbutton if you use reports that have been assigned. This
pushbutton enables you to perform the person selection.
Note:
For more information about these options, see the online
documentation under this path:
SAP Library -> Human Resources -> Reporting in Human Resources
Management -> Standard HR Reports -> Report Selection Screen in
Human Resources Management.
Parameters and Options in Screen Areas Data Selection Period/Person
Selection Period/Payroll Area/Period/Year
o Options for data selection period and person selection period (key
date and so on)
Here you define which options for date and person selection are
available for reports that have been assigned.
o Options for payroll area/period/year
Here you define which options for selection using payroll
area/period/year are available for reports that have been assigned.
Parameters and Options in Screen Area Selection View
o Type/Name
This parameter enables you to use selection views to define report
categories. You use the selection view selected here to determine
which fields are available in the Dynamic Selectionsy.
Note:
You create selection views for the PNP and PNPCE logical databases
in the Object Navigator (SE80):
1. Start the Object Navigator (SE80)
2. Choose Workbench -> Edit Object.
3. Choose the More... tab page and the Selection view on this tab
page.
4. Choose Create.
5. In the Create Selection View dialog box, choose the For any
tables option.
6. In the Name of view field, enter a name for your selection view.
7. In the Tables dialog box, enter the name of the table from which
you want to use fields.
Note:
When you enter the table name, observe the naming convention in
Personnel Administration:
Infotype number: nnnn -> table name: PAnnnn
8. Choose Continue.
9. In the Functional groups area, define functional groups by
assigning a name and a number.
10. Assign fields from the selected tables to the functional groups
by entering the number of the desired functional group in front of
each field.
11. Save your entries.
For more information about adjusting the dynamic selections using
your own selection views, see the online documentation under the
following menu path:
SAP Library -> Human Resources -> Reporting in Human Resources
Management -> HR Standard Reports -> Report Selection Screen in
Human Resources Management -> Enhancing the Selection Screen -
Dynamic Selections.
If you do not want to offer dynamic selections, make the following
settings:
- LDB PNP: In the Selection view field, enter PNP_NO_FREE_SEL.
- LDB PNPCE: Leave the Selection view field empty.
Parameters and Options in Screen Area Data Selection Period/Person
Selection Period/Payroll Area/Period/Year
o Available input parameters, date or period entry (today, key date,
all, and so on), and standard value.
Using the Standard value option, you define which of the selected
options is shown.
Parameters and Options in Screen Area CE Selection Fields
o CE selection fields (external person ID, grouping reason, grouping
value)
Using the options in this area, you define whether the external
person Id, grouping reason, or grouping value are available on the
selection screen.
Note:
These parameters are only relevant for you if you implement
Concurrent Employment (see also note 517071).
Parameters and Options in Screen Area Selection view
o Dynamic selections as dialog box
If this switch is set, you can call the dynamic selections as a
dialog box.
o Dynamic selections active
If this switch is set, the dynamic selections of the logical
database are active at the start of the report.
Note that the following combinations are possible for the last two
options mentioned:
Dyn.Sel. as dialog box/Dyn.Sel. active: inactive/inactive
Dyn.Sel. as dialog box/Dyn.Sel. active: inactive/active
Dyn.Sel. as dialog box/Dyn.Sel. active: active/inactive
Activities
1. Choose Edit -> New entries.
2. Enter an abbreviation and a long text for the report category.
The customer name range for report categories is 0-9.
3. Select the For the PNPCE logical database checkbox, if you want to
create a report category for a program or for queries of the PNPCE
logical database.
4. In the General Data screen area, choose the desired options.
If you want to use selection IDs, you must have first created and
grouped selection Ids. The IMG path to do this is given in the
parameter description section.
5. In the Data selection period/person selection period or Selection
period screen area, choose the desired options.
6. In the Selection view screen area, choose the desired options.
7. In the CE selection fields screen area, choose the desired (only
possible for report categories of the LDB PNPCE).
8. Save your entries.
9. Choose the subactivity Permitted selection criteria.
10. Choose Edit -> New entries.
11. In the Select option field, use the input help to select each field
that should be available on the selection screen.
12. Select the checkbox in the 1.page column, if you want this selection
field to be available directly when you call the selection screen.
Further notes
13. If you want to copy entries, you still have to enter the selection
parameters again in the subsequent screen.
o If you create the report category '000000000', a selection screen is
generated according to report category '00000000'for all reports for
which a report category has not explicitly been assigned.
Assign Report Categories
In this step, you assign a report category to your reports.
Example
You have created your own report, for example ZPCTEST1, and would like
it to have the selection screen that corresponds to that of the
evaluation report for Payroll, which is assigned to report category
'__M00001'.
Assign report category '__M00001' to the report.
Requirements
You must have defined the Report Categories.
Standard settings
SAP Standard Reports:
In the standard system, reports are assigned a report category. If you
want to override these assignments, perform the activities described
here. If you want to assign report categories to standard reports using
SE38, this represents a modification.
Customer-Specific Reports:
For reports you have developed yourself, you can either assign report
categories by performing the activities described here or directly in SE38.
Recommendation
Only assign a report category if you have created your own reports or if
the selection screens in the standard system do not meet your
requirements.
Activities
1. Choose Edit -> New entries.
2. Perform the required assignment using the Program name and Report
category fields.
3. Save your entries.
reward if helpful
regards,
madhumitha -
Want to use ldb selection screen with select queries
I want to use ldb selection screen with select queries since ldb having performance issue .How can I use the fields of the dynamic selection of LDB in the select queries
Hi,
Check the code snippet below: Here 'XXXX' is the table for your select query.
DATA L_DS_CLAUSES TYPE RSDS_WHERE.
MOVE 'XXXX' TO L_DS_CLAUSES-TABLENAME.
READ TABLE DYN_SEL-CLAUSES WITH KEY L_DS_CLAUSES-TABLENAME
INTO L_DS_CLAUSES.
SELECT * FROM XXXX
WHERE field1 IN ...
AND field2 ....
AND (L_DS_CLAUSES-WHERE_TAB).
PUT XXXX.
ENDSELECT.
You can also try using the FM 'RS_REFRESH_FROM_DYNAMICAL_SEL' passing SY-CPROG in curr_report and 'M' for mode to get the dynamic selection screen values.
Regards,
Munesh. -
Hi Friends,
I have a basic question. What is the use of dynamic selections in LDB?
Thanks in advance.
Regards,
nathan.Nathan,
SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE <node>.
If the node <node> is requested by the user of the logical databases, the dynamic selections are included in the selection screen. A user can then choose Dynamic selections to enter extra selections for the corresponding fields. If you call the logical database using the function module LDB_PROCESS, you can pass a corresponding parameter. You can use these selections in dynamic statements in the logical database program to read data. The values of the program-specific selection criteria that you defined for a node for which dynamic selections were available are also passed to the logical database. The user can also define the fields for dynamic selections as a selection view for the logical database.
The selection screen of a logical database is part of the standard selection screen (number 1000) of the executable program to which the logical database is attached. It has a standardized layout - the selection criteria and parameters appear on separate lines in the order in which they were declared. You can change the layout using the SELECTION-SCREEN statement.
The runtime environment generates the selection screen with number 1000 for every program in which the attributes do not contain a different selection screen version. You can prevent certain input fields from the selection screen of a logical database from appearing on the selection screen by defining selection screen versions with a screen number lower than 1000 in the selection include, and entering this version number in the program attributes. By pressing F4 there, you can get an overview of the selection screen versions defined in the logical database concerned. To define a selection screen version, use the statements SELECTION-SCREEN BEGIN|END OF VERSION. Within these statements you can use SELECTION-SCREEN EXCLUDE to specify fields that you do not want to appear on the selection screen.
If the attributes of an executable program contain the number of a selection screen version, the version is used in the standard selection screen. Although the input fields that you excluded from the selection screen are not displayed, the corresponding selections still exist, and you can still edit them in the program or by calling the function module LDB_PROCESS.
Pls. Mark if useful -
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 -
Dynamic selections with FBL1N transaction
Hello,
I want to add new fields to do dynamic selections using FBL1N transaction.
I have "House bank" field in the company code fields, but I want this field in the document fields.
How could I do it?
Thank you very muchDear Beatriz
Yes this is possible. You need to extend the selection view for the logical database KDF using transaction SE36, to have more selection fields available in the dynamic selections of the line item display.
Call up Transaction SE36 and enter the logical database KDF.
Choose "Extras --> Selection views".
Select the origin of view.
Choose "Display" or "Change".
Vendors: logical database: KDF
Permitted tables:
LFA1, LFB1: All fields are permitted that are contained in the VF_KRED
view. If necessary, you have to include additional fields in
the view fields category using Transaction SE11.
BSIK: all fields
Change the source code in program SAPDBKDF, Form INIT as explained in the SAP note 310886.
If this helps please reward with points.
Best Regards
Kesav
Maybe you are looking for
-
How to connect a "Clear Network" Modem to my Airport Xtreme?
Hello friends. I recently purchased the clear network modem. I need to know how to connect it to my Airport Extreme and get my local network at home working with 4 computers. Thank you!
-
Hello , I need to update "KEY MODE" in forms6i to "Non-Updateable" value.and then will have to compile the forms. Please let me know. how can I update this ?? I am new to forms. Thanks, Rajeev
-
IPhone 4gs 16GB "the network connection could not be made" when downloading apps
IPhone 4s 16GB brand new, "the network connection could not be made" when downloading apps. This problem occurs using Wifi, 3g, and even when pluggin into a computer. Please help
-
Error message when trying to export pdf to excel
i keep getting an error message when trying to export a pdf to excel
-
my microphone will not record in videos or voice memos and i had it for only 7 months