Logic to fetch multiple records from BKPF, SRGBTBREL and SOOD
Hi All
Need help in developing a login for a report.
We are trying to display records of a/c documents which have an associated note with them. This involves 4 categories.
1) My Document, I attached the note.
2) My Document, someone else attached the note.
3) No note attached.
4) All.
The logic desired is as below:
1) BKPF-BUKRS + BKPF-BELNR + BKPF-GJAHR = SRGBTBREL-INSTID_A. (SRGBTBREL can have multiple records for this combination if multiple notes attached)
2) a) SOOD-OBJTY = SRGBTBREL-INSTID_B+17(3).
b) SOOD-OBJYR = SRGBTBREL-INSTID_B+20(2).
c) SOOD-OBJNO = SRGBTBREL-INSTID_B+22(12).
Unique combination.
I have fetched the details from the three database tables but finding it challenging to put it across in one output internal table. It doesnu2019t cover the scenario where multiple notes are attached to the document (One can be from the same person who created the document and another ones can be from different person or both from the different people).
Thanks in advance,
Harsh
Code Snippet Part 2.
* Approved Document.
IF rb_app = 'X'.
CLEAR wa_sood.
* READ TABLE gt_sood INTO wa_sood WITH KEY objtp = lv_objtp
* objyr = lv_objyr
* objno = lv_objno.
LOOP AT gt_sood INTO wa_sood WHERE objtp = lv_objtp
and objyr = lv_objyr
and objno = lv_objno.
* IF sy-subrc = 0.
IF wa_bkpf-usnam <> wa_sood-cronam.
* Company Code.
wa_output-bukrs = wa_bkpf-bukrs.
* A/c Document No.
wa_output-belnr = wa_bkpf-belnr.
* Fiscal Year.
wa_output-gjahr = wa_bkpf-gjahr.
* Document Type.
wa_output-blart = wa_bkpf-blart.
* Document Date.
wa_output-budat = wa_bkpf-budat.
* Day On Which Accounting Document Was Entered.
wa_output-cpudt = wa_bkpf-cpudt.
* User name.
wa_output-usnam = wa_bkpf-usnam.
* Reverse Document Number.
wa_output-stblg = wa_bkpf-stblg.
* Transaction Code.
wa_output-tcode = wa_bkpf-tcode.
* Short description of contents.
wa_output-objdes = wa_sood-objdes.
* Creator Name.
wa_output-cronam = wa_sood-cronam.
* Date created.
wa_output-crdat = wa_sood-crdat.
* Time created.
wa_output-crtim = wa_sood-crtim.
* Status.
WRITE icon_green_light TO wa_output-light.
APPEND wa_output TO gt_output.
* CLEAR: wa_output,
* wa_sood.
* ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
* All Documents.
IF rb_all = 'X'.
* Company Code.
wa_output-bukrs = wa_bkpf-bukrs.
* A/c Document No.
wa_output-belnr = wa_bkpf-belnr.
* Fiscal Year.
wa_output-gjahr = wa_bkpf-gjahr.
* Document Type.
wa_output-blart = wa_bkpf-blart.
* Document Date.
wa_output-budat = wa_bkpf-budat.
* Day On Which Accounting Document Was Entered.
wa_output-cpudt = wa_bkpf-cpudt.
* User name.
wa_output-usnam = wa_bkpf-usnam.
* Reverse Document Number.
wa_output-stblg = wa_bkpf-stblg.
* Transaction Code.
wa_output-tcode = wa_bkpf-tcode.
CLEAR wa_sood.
* READ TABLE gt_sood INTO wa_sood WITH KEY objtp = lv_objtp
* objyr = lv_objyr
* objno = lv_objno.
LOOP AT gt_sood INTO wa_sood WHERE objtp = lv_objtp
and objyr = lv_objyr
and objno = lv_objno.
* ELSE.
IF wa_bkpf-usnam <> wa_sood-cronam.
* Status.
WRITE icon_green_light TO wa_output-light.
* Short description of contents.
wa_output-objdes = wa_sood-objdes.
* Creator Name.
wa_output-cronam = wa_sood-cronam.
* Date created.
wa_output-crdat = wa_sood-crdat.
* Time created.
wa_output-crtim = wa_sood-crtim.
ELSE.
* Status.
WRITE icon_yellow_light TO wa_output-light.
* Short description of contents.
wa_output-objdes = wa_sood-objdes.
* Creator Name.
wa_output-cronam = wa_sood-cronam.
* Date created.
wa_output-crdat = wa_sood-crdat.
* Time created.
wa_output-crtim = wa_sood-crtim.
ENDIF.
* ENDIF.
ENDLOOP.
IF sy-subrc <> 0.
WRITE icon_red_light TO wa_output-light.
ENDIF.
APPEND wa_output TO gt_output.
* CLEAR: wa_output,
* wa_sood.
ENDIF.
ENDLOOP.
Similar Messages
-
Abap logic not fetching multiple rows from master data table
Hi
I just noticed that my logic is fetching only 1 row from master data table.
ProdHier table
PRODHIERACHY Level
1000 1
1000011000 2
10000110003333 3
10000110004444 3
'10000110005555 3*
logic only fetches one row of level 3, I would like to fetch all level 3 rows.
DATA: ITAB type table of /BI0/PPROD_HIER,
wa like line of ITAB.
Select * from /BI0/PPROD_HIER INTO wa where /BIC/ZPRODHTAS = 3.
IF wa-PROD_HIER(10) = SOURCE_FIELDS-PRODH2.
RESULT = wa-PROD_HIER.
ELSEIF wa-PROD_HIER(5) = SOURCE_FIELDS-PRODH1.
RESULT = wa-PROD_HIER.
ENDIF.
ENDSELECT.
thanksHi,,
I have implemented the logic in end routine and it still reads only the first row.
I am loading only PRODH1 and PROD2 but now I want to get all values of PRODH3 from the master data table.
The first 5 values are PRODH1 and first 10 values belongs to PRODH2.
Whenever PRODH2 = 1000011000 in source I should get the following values
10000110001110
10000110001120
10000110001130
I have multiple rows of 1000011000 so my result should be
1000011000 10000110001110
1000011000 10000110001120
1000011000 10000110001130
DATA: ITAB type table of /BI0/PPROD_HIER,
wa like line of ITAB.
data rp type _ty_s_TG_1.
Select * from /BI0/PPROD_HIER INTO table itab where /BIC/ZPRODHTAS = 3.
LOOP AT RESULT_PACKAGE INTO rp.
read table itab into wa with key PROD_HIER(5) = rp-PRODH1.
IF sy-subrc EQ 0.
rp-PRODH3 = wa-PROD_HIER.
ELSE.
read table itab into wa with key PROD_HIER(10) = rp-PRODH2.
IF sy-subrc EQ 0.
rp-PRODH3 = wa-PROD_HIER.
ENDIF.
ENDIF.
MODIFY RESULT_PACKAGE FROM rp.
ENDLOOP.
Edited by: Bhat Vaidya on Sep 10, 2010 11:27 AM
Edited by: Bhat Vaidya on Sep 10, 2010 11:37 AM -
Fetching multiple records from a cursor
Hi all!
I am kind of stuck and am not able to understand how to get out of this. please help me. here is what I have to do.
I have a change log which has a record for each attribut changing in a table. Of all the changes, we are interested in a few,say 4 out of 5. All these records have same change group id.
Now I have a cursor declared which will pick up the 4 rows,I am interested in and group them by change group id.
What I want to do now is to loop through all these 4 records to check if one of them is for an attribute"process code". If it is then I do a delink and link call with the old and new value respectively.If not, I send a normal update call querying the database tables.
Now my question is how do I get all 4 records and process them all at same time. I need to use some if conditions on these records too.
Message was edited by:
user542022Hi
I think u can try PL/SQl collection
declare
TYPE tab_typ IS TABLE OF table%ROWTYPE;
l_tab_typ tab_typ;
begin
l_str :='select ...from table group by.....;
l_str BULK COLLECT INTO l_tab_typ;
FOR i in 1..l_tab_typ.count
loop
if (.....) then
end if;
update table .....;
end loop;
end;
try this
Thanks
Suni -
Selecting multiple records from the list and append it into internal table.
hi
there is a list of 10 records in the output screen with check boxes. if the user select any 3 records then those records should get appended in some other internal table of same structure.
this is the requirement. can anybody help me it is very urgent.
regards
samiHi,
Loop at the internal table which contains the value in table control and move it to a work area. apend the work area to the next internal table. Like:
loop at it1 into wa1 where sel = 'X'.
append wa1 to it2.
endloop.
or
loop at it1 into wa1.
if wa1-sel = 'X'.
append wa1 to it2.
endif.
endloop.
Regards,
RM -
Placeholder fetching multiple records
Hi,
From the below piece of code in placeholder i am fetching multiple records.
How can i show those multiple records to the user?
<cq:contentQuery logic="and">
<cq:contentPropertyComparison logic="and" propertySet="UCMRepository/IDC:Folder" name="dDocAuthor" type="string">
<cq:equals>
<cq:literal>weblogic</cq:literal>
</cq:equals>
</cq:contentPropertyComparison>
</cq:contentQuery>
Thanks in Advance,
Venu--Placeholders will, by design, select and display a single returned content item. If you would like to render more items, look to the Content Selector technology rather than Placeholder.
This document might be of assistance: [Choosing the Type of Interaction Management to Develop|http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/interaction/interaction.html#wp1009277]
Brad -
Creating multiple records from 1 record in the source file for Import DM
Hi Experts,
Today I am working on an interface/import where I want to get the following result:
Source file contains a records like:
Account, Entity, DriverX
Sales,EntityA,ZZ
The BPC appset contains the 2 dimensions Account and Entity next to CostCenter dimension. The DriverX field in the source file is just additional information in the source file. However based on this DriverX we need to determine what CostCenter to choose but we also need to have the same record assigned to a second record in BPC.
Following my example, based on DriverX value I need to create 2 records:
Account, Entity, CostCenter,
Sales,EntityA,CC1
Sales,EntityA,CC2
I don't have a problem assigning the record to 1 CostCenter based on DriverX value but I have a problem creating my second record. Does any of you have had the same "challenge" and if so would you like to share the solution for this?
Best regards,
Johan
PS: I am working on SAP BPC, version 7.0 Microsoft version.Hi Greg,
Many thanks for your answer. And yes this would be a solution. However I just simplified my case as the decision to create an second record and where to post is depending on more than 1 field in the source.
But I will keep it in mind, because I also can opt for a solution to store data differently in BPC fac-tabels which will help me to use script logic.
If it is not possible to create multiple records from a single records in the standard functionality in the Transformation and/or Conversion file, I have to create a custom DTSX or change my way of storing data.
Anyone else who is having an alternative idea like Greg came up with?
Please let it know!
Best regards,
Johan -
How to select multiple records from a TREE in the table
HI,
I have a tree structure which is in the table.When I open the node of the tree,all the subnodes are coming as one-one records in the table.I want to slect multiple record from this table.I applied onLeadSelect for this table,I can select only 1 record from the table.
Can any one plz suggest me how to select multiple records from the table so that I can get all the data of those selected record.
Regards
-SandipRashmi/Kukku,
First of all, Thanks for your help!
Is there any other way in which we can access tables other than using BAPIs or RFCs?
In my case, there is a table structure which has to be updated with values after validating a key. i don't think there is any RFC available now. do i need to create bapi/rfc for that?
Krishna Murthy -
say i have emp table
eno ename sales
1 david 1100
2 lara 200
3 james 1000
1 david 1200
2 lara 5400
4 white 890
3 james 7500
1 david 1313
eno can be duplicate
when i give empno is 1
i want to display his sales i.e 1100,1200,1313
first time i will go to database and fetch the records
but next time onwards i dont go to database; i will fetch the records from cache;
i thought doing it using hashmap or hasptable ;both those two don't allow duplicate values(empno has duplicate values);
How to solve this problem.Hi,
Ever considered splitting that table up. You are thinking about caching thats a
very good idea. But doesnt it make it vary evident that the table staructure that you have
keeps a lot of redundant data. Specially it hardly makes a sense to have sales
figures in a emp table. Instead you can have Emp table containing eno and
ename with eno as the primary key and have another table called sales with eno
and sales columns and in this case the eno references the Emp table.
If you still want to continue with this structure then I think you can go ahead with
the solution already suggested to you
Aviroop -
Posting multiple records from file to idoc
Hi Exerts,
i have done scenario to post one record from file to IDOC, to post multiple records from file to idoc what are the options to be modified in the scenario.
thanks,
dhanushHi Dhanush,
You need to change the occurance of idoc to 0 to unbounded ie need to opt idoc packaging.
Just download the xsd of you idoc to the desktop and change the occurance tag as "<xsd:element name="IDOC" type="COND_A.COND_A02" maxOccurs="unbounded" />" and then reimport it into External definition and use it in your message mapping and then map it with you source structure.
Regards,
Prasanthi. -
Fetch last record from database table
hi,
how to fetch last record from database table.
plz reply earliest.
Regards,
Jyotsna
Moderator message - Please search before asking - post locked
Edited by: Rob Burbank on Dec 11, 2009 9:44 AMabhi,
just imagine the table to be BSEG or FAGLFLEXA... then what would be performance of the code ?
any ways,
jyotsna, first check if you have a pattern to follow like if the primary key field have a increasing number range or it would be great if you find a date field which stores the inserted date or some thing..
you can select max or that field or order by descending using select single.
or get all data.. sort in descending order.(again you need some criteria like date).
read the first entry. using read itab index 1 -
Allow multiple records from this table to be displayed in the form is greyed out.
I'm trying to add a second table to my main data source in an InfoPath 2010 form (database template), but the option to allow multiple records from this table to be displayed in the form is greyed out and I can't select it.
Can someone please tell me how to correct this? I'm guessing that there might have to be something change in MS SQL because on other occasions I've have not encountered this problem when adding a second table.
Any help would be greatly appreciated.
Thanks.So I've found a work around, but I still don't know why I'm having the problem in the first place.
I've been trying to relate the two tables by using the primary key in the parent table to a view of the child table that also includes primary key in the parent, e.g. the ORDER ID in the order table relating to the ORDER ID in the view of the order detail
table. For whatever reason whenever I did that InfoPath prohibited the data source from returning multiple order details.
My work around is to use views of both the order table and order details table that include the customer ID and to relate the two table in InfoPath using the customer ID. Now I get a data source that allows multiple order detail records. In order to get
just the order details that I want that relate to a particular order, I use a rule that sets the order id in both the order and order details query data sets before executing the query (as opposed to just the order data set).
Hope that's a clear explanation. -
Delete Multiple Records from Item Master
Hi,
We received wrong master data which has been uploaded and two groups have to be deleted. All the items in those particular groups have also to be deleted. Can anyone suggest how to delete multiple records from Item Master?
Currently I am navigating through each Item and doing a Right Click + Remove. It is very painful given the huge number of records.
Regards
SudattHi Sudatt.....
I recommend you not to run any kind of delete or update SQL query as it harms DB.
You can create your own front end application with the help of any technical consultant which can be
achieved very easily. Else such problems create a big problem during upgradation to next version.......
Regards,
Rahul -
Update multiple records from a list
Just trying to find some tutorials on how to update multiple
records from 1
page of checkboxes
easiest example is hotmail
i would like to be able to give my clients the ability to
delete or update
multiple records from 1 page... mind you that this type of
update woudl only
be for simple status changes, flags that need to be changed
and so on...
Delete... well if they made it to this page they are already
sure and have
been warned that they are going to delete the records..
where can i find such a tutorial on how to complete multiple
record updates
or deletes from 1 form...
thanksServer model and software below.
And hotmail has nothing to do with anything.. its an example
of what i would
like to be able to do...
If you log into hotmail. you have the option to check all the
emails you
want to delete.
well thats what i want to do with my clients sites...
Each record would have its own checkbox, they select the
records they want
to delete or update and they hit submit to process there
request.
Using ASP, SQL2005 and DW8
"bregent" <[email protected]> wrote in
message
news:f21upb$nop$[email protected]..
> >Just trying to find some tutorials on how to update
multiple records from
> >1
>>page of checkboxes
>
> What server model?
>
>>easiest example is hotmail
>
> What does hotmail have to do with this. -
Insert multiple records from web dynpro
Hi,
How to insert multiple records from web dynpro applications to SAP backend system ?
Thanks,
sowmyaHi soumya..
if want to multiple row selected then save into the Sap back End..
value node--table.
Backend value node=table_bapi_input;
back end internal table --tableback.
int size=wdcontext.nodeTable().size();
int lead=wdcontext.nodeTable().getLeadSelection();
table_bapi_input in=new table_bapi_input();
wdcontext.nodetable_bapi_input().bind(in);
for(int i=size-1;i>0;i--){
tableback set=new tableback()
if(lead==i || wdcontext.nodeTable().ismultiSelection(i)){
set.setName(wdContext.nodeTable().getTableElementAt(i).getName();
in.addZc_input(set);
wdContext.currenttable_bapi_inputElement().modelobject().excute();
wdContext.nodeOutput().invalidate();
thanks
jati -
Displaying the selected multiple records from node using onleadselect event
Hi all,
How to display the selected multiple records from node to node using onleadselect event.
i came to know tht to fulfill this requirement i need to use the method get_selected_elements,
how to use this method in my event??
sreeHi Sree,
Try below code..
DATA : lo_nd_it_lips TYPE REF TO if_wd_context_node, // This is first node
lo_el_it_lips TYPE REF TO if_wd_context_element,
ls_it_lips TYPE wd_this->Element_it_lips,
lt_it_lips TYPE wd_this->Elements_it_lips.
DATA: wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
* navigate from <CONTEXT> to <IT_LIPS> via lead selection
lo_nd_it_lips = wd_context->path_get_node( path = `ZRETURN_DEL_CHANGE.CHANGING_3.IT_LIPS` ).
CALL METHOD lo_nd_it_lips->get_selected_elements
EXPORTING
INCLUDING_LEAD_SELECTION = ABAP_true
RECEIVING
set = lt_temp.
DATA lo_nd_pack_mat TYPE REF TO if_wd_context_node. //Second Node
DATA lo_el_pack_mat TYPE REF TO if_wd_context_element.
DATA ls_pack_mat TYPE wd_this->Element_pack_mat.
DATA lt_pack_mat TYPE wd_this->Elements_pack_mat.
* navigate from <CONTEXT> to <PACK_MAT> via lead selection
lo_nd_pack_mat = wd_context->get_child_node( name = wd_this->wdctx_pack_mat ).
lo_nd_pack_mat->get_static_attributes_table( importing table = lt_pack_mat ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_it_lips.
ls_pack_mat-vbeln = ls_it_lips-vbeln.
ls_pack_mat-material = ls_it_lips-matnr.
ls_pack_mat-vgbel = ls_it_lips-vgbel.
append ls_it_lips to lt_unpack.
CLEAR ls_pack_mat.
ENDLOOP.
Cheers,
Kris.
Maybe you are looking for
-
Ridiculous problem with Flex!!!
Actually, just kidding :) I've had a few, the ridiculous part being my lack of understanding :). I just want to say I'm really enjoying working with Flex, I love the Apps I've created, and I couldn't have done any of it without all of the excellent h
-
Can we add more than one interative report in one page
Hi all, Can i add two interactive reports in one report region. Regards
-
Can anyone offer a solution for my problem? When I hit <F1> to open the help from my application, the TOC highlights to the correct Context ID Tag. If I close the help and then <F1> from a different application form, the Help opens correctly, with th
-
Interruption handling in Flashlite
Hi I am new to flash lite. I am basically more on the j2me side in j2me application we have options like hidenotify shownotify for handling event like call interruption and we can pause the game. In flashlite I think the application will get automati
-
Other users get application errors.
I am having an odd problem with my mac. I have an admin account which I installed all of my programs (in the applications folder) and I can use them just fine. But when I switch to a different user on that computer most of the applications ask me to