HR Logical database PNP. OO to fill table dynamic table from PNP ?
Hi all
I want to get some stuff from the HR logical database into a dynamic table
Here's a real simple example that writes info out to a normal list.
(report is based on using Logical DB PNP)
tables: pernr.
INFOTYPES: 0001, "Organizational Assignment
0002. "Personal Data
SELECT-OPTIONS: language FOR p0002-sprsl.
INITIALIZATION.
pnptimed = 'D'.
GET pernr.
PROVIDE * FROM p0002 BETWEEN pn-begda AND pn-endda.
CHECK language.
WRITE: / p0002-pernr,
sy-vline,
p0001-ename,
sy-vline,
p0002-sprsl,
sy-vline,
p0002-gbdat.
ENDPROVIDE.
endform.
Now what I want to do is replace the write stuff by appending the entries into a dynamic table which I will display as an ALV Grid.
so I add my structure in the data declarations
types: begin of s_elements,
pernr type p0002-pernr,
ename type p0001-ename,
sprsl type p0002-sprsl,
gbdat type p0002-gbdat.
drop_down_handle type int4.
types: end of s_elements.
include zz_jimbo_incl.
build the dynamic table
create data dref type s_elements.
assign dref->* to <fs>.
i_routine = 'POPULATE_DYNAMIC_ITAB'.*
i_names = 'NAME_COLUMNS'.
i_gridtitle = 'HR TEST'.
invoker = sy-repid.
i_zebra = 'X '.
i_edit = ' '.
call function 'ZZ_CALL_SCREEN'
exporting
invoker = invoker
my_line = <fs>
i_gridtitle = i_gridtitle
i_edit = i_edit
i_zebra = i_zebra
i_names = i_names
i_routine = i_routine
importing
z_object = z_object
dy_table = dy_table.
Now to populate the dynamic Itab the routine below is entered.
form populate_dynamic_itab changing dy_table.
assign dy_table->* to <dyn_table>.
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
However I can't use GET / PROVIDE / ENDPROVIDE in a Form.
Anyway round this ---seems HR has an aversion to OO.
Cheers
jimbo
Hi,
well, GET_PERNR is a so called event_statement. It has nothing to do with ABAP 00.
Normally it will be like this:
START-OF-SELECTION.
GET_PERNR.
PROVIDE ....
END-OF-SELECTION.
-> and here the CALL SCREEN NNNN for ALV-Display.
Provide-statements you can use in forms of course, and as many times you want during GET and END-OF-SELECTION.
But as I understood : you just want to save the write-statements?
I always develop a DDIC-Structure, declarate the data objects in the programm, read the data via Provide into the infotypes, and then make a move-corresponding to my structure. and display it.
Normally no problem.
kind regards
maik
Similar Messages
-
Read a csv file, fill a dynamic table and insert into a standard table
Hi everybody,
I have a problem here and I need your help:
I have to read a csv file and insert the data of it into a standard table.
1 - On the parameter scrreen I have to indicate the standard table and the csv file.
2 - I need to create a dynamic table. The same type of the one I choose at parameter screen.
3 - Then I need to read the csv and put the data into this dynamic table.
4 - Later I need to insert the data from the dynamic table into the standard table (the one on the parameter screen).
How do I do this job? Do you have an example? Thanks.Here is an example table which shows how to upload a csv file from the frontend to a dynamic internal table. You can of course modify this to update your database table.
report zrich_0002.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: it_fldcat type lvc_t_fcat,
wa_it_fldcat type lvc_s_fcat.
type-pools : abap.
data: new_table type ref to data,
new_line type ref to data.
data: xcel type table of alsmex_tabline with header line.
selection-screen begin of block b1 with frame title text .
parameters: p_file type rlgrap-filename default 'c:Test.csv'.
parameters: p_flds type i.
selection-screen end of block b1.
start-of-selection.
* Add X number of fields to the dynamic itab cataelog
do p_flds times.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = sy-index.
wa_it_fldcat-datatype = 'C'.
wa_it_fldcat-inttype = 'C'.
wa_it_fldcat-intlen = 10.
append wa_it_fldcat to it_fldcat .
enddo.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
* Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
* Upload the excel
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '200'
i_end_row = '5000'
tables
intern = xcel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
* Reformt to dynamic internal table
loop at xcel.
assign component xcel-col of structure <dyn_wa> to <dyn_field>.
if sy-subrc = 0.
<dyn_field> = xcel-value.
endif.
at end of row.
append <dyn_wa> to <dyn_table>.
clear <dyn_wa>.
endat.
endloop.
* Write out data from table.
loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <dyn_field>.
else.
write: <dyn_field>.
endif.
enddo.
endloop.
REgards,
RIch Heilman -
Static Tables Creation In oracle & Diff Between Static table ,Dynamic table
Static Tables Creation In oracle & Diff Between Static table ,Dynamic table
972471 wrote:
Static Tables Creation In oracle & Diff Between Static table ,Dynamic tableAll tables in a well designed application should be static tables.
Whilst it's possible to execute dynamic code and therefore create tables dynamically at run time, this is considered poor design and should be avoided in 99.99% of cases... though for some reason some people still think they need to do this, and it's never really justified.
So what issue are you facing that you need to even bother considering dynamic tables? -
Logical database PSJ: How to access and link tables inside that???
Hi,
I have a requirement like :
I have to write one report which will display project statuses (PSmodule) using the LDB PSJ.. I am using LDB because I neeed dynamic selection screen.
I need to acees the data from table like 1. PROJ, prps_r and JCDS under the LDB PSJ.. but when I found the hirarchy of these table in the LDB , then all 3 tables are at same level.
then How to access and link data from theses 3 tables using GET and LATE command.
I did like below, but wrong number of records are coming
START-OF-SELECTION.
GET proj.
GET prps_r.
GET elm_ps .
GET jcds.
can anyone tell me, what 's wrong here.
points will be rewarded
for proper answer.
Regards,
Mrunalhi ...get is like a loop in ldb. then if you use the 3 get statements then it will loop with in a loop with different data..
-
Problem in Using Logical Database PNP
Hi Guru's,
I am using PNP logical database and rp_provide_from_last
macros statements to fetch data from PA Tables.
When i am doing extended syntax check it is showing more
than 60 error's in ECC 6.0 for below statements:
1) Tables: Pernr
2) Infotypes: 0001,0002. and
3) RP_PROVIDE_FROM_LAST statements.
Could any please provide soloution how to clear all these.
Its very urgent.
Thanks in advance.
Regards,
SunilHi Ramesh,
These are the type of error messages in exetnded syntax check:
The current ABAP command is obsolete
In the OO context either an INTO or an ASSIGNING specification or the addition
"TRANSPORTING NO FIELDS" must be used . be used. be used. be used. be used. be
used.
Internal Message Code: READ 018
(The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
EXTENDED CHECK OFF/ON)
Program: Z_INT_I_PY_BONUSPAYMENT Include: Z_PY_F01_BONUSPAYMENT Row: 279
The current ABAP command is obsolete
At "LOOP AT itab" one of the additions "INTO", "ASSIGNING" or "TRANSPORTING NO
FIELDS" is required in the OO context . .
Internal Message Code: LOOP 012
(The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
EXTENDED CHECK OFF/ON)
Program: Z_INT_I_PY_BONUSPAYMENT Include: Z_PY_F01_BONUSPAYMENT Row: 282
The current ABAP command is obsolete
In the OO context either an INTO or an ASSIGNING specification or the addition
"TRANSPORTING NO FIELDS" must be used . be used. be used. be used. be used. be
used.
Internal Message Code: READ 018
(The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
EXTENDED CHECK OFF/ON)
Program: Z_INT_I_PY_BONUSPAYMENT Include: Z_PY_F01_BONUSPAYMENT Row: 282
The current ABAP command is obsolete
At "LOOP AT itab" one of the additions "INTO", "ASSIGNING" or "TRANSPORTING NO
FIELDS" is required in the OO context . .
Internal Message Code: LOOP 012
(The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
EXTENDED CHECK OFF/ON)
Please suggest me some way to clear these if it is possible. -
Tables or Logical database to create standard report for Equipment BOM?
Dear All
My client has requirement for the report with fields like to see the status of Equipment BOM(input of Equipment number in selection screen) or for Particular set of Materials(input of component number in selection screen) available stock quantity,storage location of stock,description of component,price of component,Pending PR of component(if any),Pending PO of component(if any) etc
I want to develop the report with standard infoset query instead of going for abap development.is there any logical database to map the report or what tables can i use for table joins??
Required sample report with fields as below
BOM Component
Stock available/Not available indicator
Description of Components
BOMQty/ UOM
Price
Part Number
Plnt
Sloc
Stock Qty
Bin
Pending PR
Pending PO
1000001121
YES
BEARING
NO
2000
ERS22
1000
MECH
4
A1
300012431
Regards
M.ManojkumarManoj,
The following is the tested solution.
Table join
Output
This figure shows the case of a Equipment BOM where 3 components are there. Installed Quantity are 4, 1, 1 respectively. Last two columns are showing the Storage Locations and the Stocks available.
Fields taken to output are
From STPO : IDNRK MENGE MEINS
From MARD LGORT LABST
As said before, more than this you can not do in SQVI. With this basic join in SQ02, using codes in Extras you can do much more.
Jogeswara Rao K -
How to use a Logical Database in Function Module.
Hi Experts,
I want to use a logical database in a Function Module to fetch data from a standard SAP table into a Internal table for certain filter conditions.
How can I get get this done????
I called LDB_PROCESS FM in my FM, but I could not figure out how to store the extract in my IT table since we cant use GET in FM.
Please provide me a sample code if possible.
Thanks in Advance,
Alex.Hi,
i had an example program like this ,in this i want to get the data using pnp logical database with 5 fields in an interface program.
data: begin of it_final occurs 0,
pernr like pa0002-pernr,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
usrid like pa0105-usrid,
usrid_long like pa0105-usrid_long,
end of it_final.
get pernr.
clear : p0000,p0002,p0105.
rp-provide-from-last p0000 space p_date p_date.
if p0000-stat2 = '3'.
v_pernr = pnppernr-low.
else.
reject.
endif.
*---Get employee pernr, First name ,Last name into final table
rp-provide-from-last p0002 space p_date p_date.
if pnp-sw-found = '1'.
it_final-pernr = p0002-pernr.
it_final-vorna = p0002-vorna.
it_final-nachn = p0002-nachn.
else.
*---Error message if not infotype 0002 maintained
T_ERROR-PERNR = pnppernr-low.
CONCATENATE TEXT-EMI '0002'
INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
APPEND T_ERROR.
CLEAR T_ERROR.
endif.
**--Get SYSTEM USERNAME to final table
rp-provide-from-last p0105 0001 p_date p_date.
if pnp-sw-found = '1'.
it_final-usrid = p0105-usrid.
else.
*---Error message if not SYSTEM USERNAME maintained
T_ERROR-PERNR = pnppernr-low.
CONCATENATE TEXT-003 '0105'
INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
APPEND T_ERROR.
CLEAR T_ERROR.
endif.
**--Get Email ID to final table
rp-provide-from-last p0105 0010 p_date p_date.
if pnp-sw-found = '1'.
it_final-usrid_long = p0105-usrid_long.
else.
*---Error message if not Email ID maintained
T_ERROR-PERNR = pnppernr-low.
CONCATENATE TEXT-004 '0105'
INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
APPEND T_ERROR.
CLEAR T_ERROR.
endif.
append it_final.
clear it_final.
reward points if useful,
venkat. -
Copy/create program with logical database
Hi
I need to create a program with the same selection-screen as SAP standard program RPRAPA00.
RPRAPA00 is using a logical database, but even that I have passed in the PNP in the attributes of my own progam, I don't get the selection in the top (buttons, key-date info + selection info).
The rest of my program looks fine.
Any ideas how I get the missing selections into the selection-screen?Hi,
Define pernr table under tables statement then and use GET PERNR event.This get event is followed by End-Of-Selection.
Syntax: Tables pernr.
Get pernr.
Try, activate and test. This should solve your problem.
Regards,
Abhijeet -
Hi,
I have selected the logical dtaabase pnp in my attributs screen.
i have read that logical databases can have a maximum of 300 tables.
So what tables can i access using the pnp LDB.
Also i have heard that if we select a LDB a standard selection screen appears.
But in my case it does not appear.
Please help.
Thanks in advance,
Bala.>
Bala Shanmuga Priyan wrote:
> Also i have heard that if we select a LDB a standard selection screen appears.
> But in my case it does not appear.
please add the following statement in your program
TABLES: pernr.
Please check the link below
[Logical Databases |http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm]
and the following demo programs on LDB
DEMO_SELECTION_SCREEN_LDB_1
DEMO_SELECTION_SCREEN_LDB_2
DEMO_SEL_SCREEN_SELECT_LDB_1
DEMO_SEL_SCREEN_SELECT_LDB_2
Edited by: Rajesh on Oct 23, 2008 5:36 PM
Added additional info -
ABAP query using logical database KDF is not populating custom fields
Hi Experts ,
I created two following queries
1. VENDORCATKDF – uses KDF logical database
2. VENDORCATLFA1 – uses table = LFA1
I’m pulling the same information in both queries:
· Vendor Number
· Country
· Vendor Name
· Vendor Category (custom fields added to LFA1)
The results for the query that uses the logical database KDF is incorrect. It doesn’t pull in the flag on the custom field LFA1-ZMRO. Even though the logical database KDF is made up of the table LFA1 and has these fields.
Is there something that can be done – so that all of these “custom” category fields under LFA1 (such as LFA1-ZZMRO) – get pulled into queries – when we use the logical database KDF ?Hi,
I have got the error removed by ensuring that fields from one table are a part of one line ( taking help of ruler) only. But the underlying problem remains, the output is not ALV but List output.
I do not think having additional fields in the query is reason for this.
Is it bcoz iI am adjusting the output length of columns to ensure no hierarchical error ?
Can we not have a query using LDB which is shown as SAP List?
Regards,
Garima. -
Hi,
Is it common to use logical database for HR report?? How about other module such as SD/MM??
Regards,
KitHi,
Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is still to read data from database tables by linking them to executable ABAP programs.
However, from Release 4.5A, it has also been possible to call logical databases using the function module LDB_PROCESS. This allows you to call several logical databases from any ABAP program, nested in any way. It is also possible to call a logical database more than once in a program, if it has been programmed to allow this. This is particularly useful for programs with type 1.
Logical databases contain Open SQL statements that read data from the database. You do not therefore need to use SQL in your own programs. The logical database reads the program, stores them in the program if necessary, and then passes them line by line to the application program or the function module LDB_PROCESS using an interface work area.
Logical Databases - Views of Data
A logical database provides a particular view of database tables in the R/3 System. It is always worth using logical databases if the structure of the data that you want to read corresponds to a view available through a logical database.
The data structure in a logical database is hierarchical. Many tables in the R/3 System are linked to each other using foreign key relationships. Some of these dependencies form tree-like hierarchical structures. Logical databases read data from database tables that are part of these structures.
The diagram illustrates how the R/3 System might represent the structure of a company. A logical database can read the lines of these tables one after the other into an executable program in a sequence which is normally defined by the hierarchical structure. The term logical database is sometimes used to mean not only the program itself, but also the data that it can procure.
Tasks of Logical Databases
As well as allowing you to read data from the database, logical databases also allow you to program other tasks centrally, making your application programs less complicated. They can be used for the following tasks:
Reading the same data for several programs.
The individual programs do not then need to know the exact structure of the relevant database tables (and especially not their foreign key relationships). Instead, they can rely on the logical database to read the database entries in the right order during the GET event.
Defining the same user interface for several programs.
Logical databases have a built-in selection screen. Therefore, all of the programs that use the logical database have the same user interface.
Central authorization checks
Authorization checks for central and sensitive data can be programmed centrally in the database to prevent them from being bypassed by simple application programs.
Improving performance
If you want to improve response times, logical databases permit you to take a number of measures to achieve this (for example, using joins instead of nested SELECT statements). These become immediately effective in all of the application programs concerned and save you from having to modify their source code
Reward Points if useful
Raghunath.S
9986076729 -
Adding user fieds to logical database ADA - solution?
Hi,
I have problems with adding (by append structure) my user fields (which are added to standard SAP table ANLA) to logical database ADA which is used in AM reporting.
I have found this solution:
Thru SE30 I found, that logical database ADA using view V_ANLAZ (ANLA + ANLZ tables) for selecting data from DB. So I have created append for this view with my added fields to ANLA. Then I added the same append to structure ANLAV of logical database ADA.
My added field are now selected in AM reporting!
Can this solution break some SAP functionality?
Many thanks for answer!So probably NOT...
-
q1]] What is the difference between LOGICAL DATABASE and VIEWS?
q2]] Why are <b>alphaneumeric characters</b> called so ?Hi
<i>q1]] What is the difference between LOGICAL DATABASE and VIEWS?</i>
<b>Logical Databases</b>
Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is still to read data from database tables by linking them to executable ABAP programs.
Logical databases contain Open SQL statements that read data from the database. You do not therefore need to use SQL in your own programs. The logical database reads the program, stores them in the program if necessary, and then passes them line by line to the application program or the function module LDB_PROCESS using an interface work area.
<i>Logical Databases - Views of Data</i>
A logical database provides a particular view of database tables in the R/3 System. <u><i>It is always worth using logical databases if the structure of the data that you want to read corresponds to a view available through a logical database.</i></u>
Please got through the link where you can find how create or modify logical database.
http://www.datamanagementgroup.com/Resources/Articles/Article_1005_2.asp
<i>q2]] Why are alphaneumeric characters called so ?</i>
Alphanumeric characters are combination of alphabets including Uppercase letters (A..Z) and lowercase letters (a..z) , and Numerals(0123456789) .
This Can be defined with character strings.
A character string is a data type that consists of a series of alphanumeric characters.
Each character string has a code attribute (ASCII, EBCDIC, or BYTE). It defines the sort sequence to be used for comparing values.
Regards,
Raghav
Message was edited by:
Raghavendra L -
Logical database excess problem
hi frends,
is it possible to make single report for using multiple logical databases ?Logical database as the name suggests is a logical combination of related tables along with their common selection criteria and database access routines. Now if you want to use more than one logical database, then you are basically accessing unrelated tables (or at least as per the definition of a logical database) and that defeats the purpose of a logical database which offers some benefits of reusable selection criteria and faster database access.
That is the reason why SAP gave you an option to specify only one logical database in the attributes. Apart from this there may some technical limitations in providing such a feature, for instance what if you use 100 logical databases in a report, can the combined selection screens of all the logical databases be generated and handled? Can all the database access routines be loaded at the same time into the memory? So it may be both technical implementation limitations as well as logical reasoning that lead SAP to limit it to one LDB. -
Hi,
<u>Can, programming with LDB, be considered as an object programming.. just VB, which is an object programming language.</u>
That is we r creating an Object directly and using when ever we want. It is different from OOP where we create a class and instantiate the class to create an object.
My next question is:
There are 2 transactions which we will create, which are basically same except for a text field.
<i>First transaction is posting. And the second one is a reverse posting. In the second transaction we have the reason for reverse posting.</i>
I think in this case we can use LDB and it is the typical scenario where we can apply LDB concept.
Please evaluate me.
-Naveen.<b>Hi NaveenKumar,</b>
Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is to read data from database tables by linking them to executable ABAP programs.
However, from Release 4.5A, it has also been possible to call logical databases using the function module LDB_PROCESS. This allows you to call several logical databases from any ABAP program, nested in any way. It is also possible to call a logical database more than once in a program, if it has been programmed to allow this.
Logical databases contain Open SQL statements that read data from the database. You do not therefore need to use SQL in your own programs. The logical database reads the program, stores them in the program if necessary, and then passes them line by line to the application program or the function module LDB_PROCESS using an interface work area.
<b>Tasks of Logical Databases</b>
1.Reading the same data for several programs.
2.Defining the same user interface for several programs.
3.Central authorization checks
4.Improving performance
<b>First part of your question</b>
<b>
So,if i am not wrong, LDB cannot be completely considered as object oriented programmming.</b>
I have highlighted some important points above
For understanding this in detail you can go through the sap help .(if you donot know go through the below path
sap library
+ Basis Components
-Abap Programing and runtime enviornment
-BC-ABAP Programming(noe serach for ldb
<b>Now your second part of question</b>.
In the scenario which you have mentioned we can use ldb.But i am not sure whether it is a typical scenario of ldb.LDB is just a specific access routine to support database access for some application (report generation) needs.We can define a logical database to shorten our ABAP coding .
Here I am mentioning a link which shows a complete implementation of an LDB.
<b>http://homepages.wmich.edu/~r2raviko/HandsOnQuest/HO9.doc</b>
I suppose after going through the reply(or sap help) and the link mentioned above all your doubts regarding LDB will be cleared.
Thanks & Regards
<b>Pawan P. Khilari
*Please Mark Helpful Answer</b>
Maybe you are looking for
-
My adapter got frayed a bit on the cord from the power box to my laptop. I now have a slight grounding problem. My laptop is a Satellite S875D-S7239. The part numbers listed in my owners manual gives me 2 choices for my model. PA3714U-1ACA Toshiba 65
-
Panels preferences in DW 8 for Mac
The help section mentions a Preference where I can check which panels float on top, and which ones drop behind the active document window. I had this set correctly, but when I reinstalled Dreamweaver, I cannot find it. My problem, I have the Files Pa
-
SSM 7.0 - Schedule status calculation of initiatives
Hi, Does anybody know how SSM calculate the schedule status of initiatives? For example: - 1 initiative (I1) with "Rule based on status" with 2 milestones (M1 and M2). - M1 finished before target end date, completion = 100% and importance = high. - M
-
Use search help to populate two screen fields
I've done a search on this and see that plenty of people ask this question but none get answers, hopefully you'll be able to help me out. I have a selection screen with two fields: data: s_house LIKE t012k-hbkid, s_account LIKE t012k-bankn. I
-
Hi I'm not very experienced with Java and I have the fallowing problem - I list all files in drive C, and all folders, then I open all TXT files in turn, read into a List, do some searching, and close it. When all files are processed I do the same wi