how to restrict the number of table columns in bapi output - response

While querying BAPI, we are generally interested in only few columns of a table.
For example PO_ITEMS table (under BAPI_PO_GETITEMS) has 58 columns. While querying, I am interested in only 10 of those columns. But the BAPI response contains all the columns which is a
overhead.
In SQL world, we can always select which columns we want to retrieve. The query response contains only those columns, not all the columns.
I remember I have read somewhere that we can disable unwanted columns coming in response. But when I need it now, I am not able to find information about it.
Can anybody share a code snippet to achieve this? Or specific online resource/pointers would help?
Thanks

Depending on which technology you use to call the BAPI, you can sometimes restrict which parameters are transferred. For example, if you use the SAP Java Connector (JCo 3), you can use the method setActive of a parameter to restrict whether the parameter is transferred. However:
As far as I know, you can only enable or disable entire TABLES parameters or other parameters. You can't enable or disable individual columns.
As far as I know, the BAPI itself does not know about this setting - and even if it would know, few implementations would care.
Sometimes there are additional parameters that allow you selectively enable or disable fields, but that is part of the actual BAPI implementation and not some omnipresent basic technology.

this is not exact answer for your question.i hope it will help.I think we have no option to select certain number of column from a function module tables.but we can access particular row from that table like passing mandatory values from java side .....like this sample code here i did for function module(not table table).
JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME);
JCoFunction jf=destination.getRepository().getFunction("ZUSER_DET");
jf.getImportParameterList().setValue("FIRST_NAME","username");
jf.execute(destination);
String jfex=jf.getExportParameterList().getString("some column name from return table");
System.out.println(jfex);
it will return a row of table value.you can manipulate whatever you want

Related

Google Sheet function to Split the Data Accordingly

I have a worksheet being fed by a Google Form. I want the responses on the Google Form to populate two fields in the next tab. The B column in the second tab is the one beyond my skillset. I have written out how the field should display, based on the form responses for reference. I also have used comments on the sheet to explain the rules for each field.
I know split function can be used but it wont adjust it. any possible solution.
Here the Sheet link
https://docs.google.com/spreadsheets/d/1ueKCNdcn1xmJHYtrzKKKkj_FSraRfpvJS4Oi3BHNUvk/edit?usp=sharing
I've added an answer on your sheet. Since the data is all delineated by semi-colons, this formula seems to match what you want.
=SPLIT('Import Data'!B1,";",0,0)
Let us know if it doesn't do what you want, or if this helps.
Updated: After checking with you, I realise that you want only some of the data split, and some kept concatenated. But since all of the data "fields" look the same, separated by semi-colons, and since there could be various numbers of fields in each response category, I don't think there is a simple logic that can tell where to split, and where to keep things like dress styles or sizes concatenated. So I understand that this is not your desired answer.

When using QUERY, how can I make it so that data moves together when using filter?

I am creating a tool for a video game I play.
Link to the example spreadsheet (Please make a copy to edit so that this copy stays intact for additional helpers).
Sheet 1 is “Choose Owned”. It contains a list of all of the champions available in the game and includes their attributes.
Column A contains checkboxes. Checking a checkbox indicates that the user owns that champion, and brings it to Sheet 2.
Sheet 2 is called “Owned”. It contains a list of the champions checked off in “Choose Owned” (aka the champions the user owns). “Owned” includes the champion attributes too, as first seen in “Choose Owned”.
Beyond those same attributes, “Owned” contains 8 additional columns.
These columns are from Columns G:N and are labeled ‘Level’, ‘Rank’,
‘Ascension Lvl’, and ‘Team Label(s)’ (‘Team Label(s)’ takes up
columns J:N). This data is all unique information and requires the
user to input the information themselves depending on their
champions.
Because there are so many champions, I want the user to be able to use the Filter function in “Owned” so they can easily locate the champion they need or sort the table however they wish.
However, because I use the QUERY function to get the data from “Choose Owned”, the Filter function tends to break. The most obvious error comes when you try to sort A-Z or Z-A; this simply cannot be done. I was fine with this, and have even included a note at the top telling the user to avoid sorting alphabetically.
Everything else works correctly until the user tries to add a new champion from “Choose Owned”. When the champion is added to “Owned”, the additional, unique data in columns G:N go out of order because they don’t move with their original champions.
Example:
I choose my champions. These champions are copied to “Owned”.
I pick their relative data in columns G:N.
A few days later, I obtain new champions and check them off in “Choose Owned” so they are added to “Owned”. However, when I do this, the champions stay in the same order as they are in “Choose Owned”, and columns G:N do not move with their champions so now, that information is with the wrong champion.
I want the additional data (G:N) to move with their champions when the table is edited due to champions being added. Or, in other words, I want those columns to stay linked to the first columns.
If there is a different way to achieve all of this like if I have to use a function other than QUERY, that is fine!
Please share any solutions you may have. I would prefer to not use a script but will consider the idea if it works.
this is a common issue within Google Sheets and it's solvable in 2 ways:
either by introducing a common value (unique ID) and then linking the manual input to query and aligning it by ID
or easier approach in your case - using timestamp/linear ID so every new entry would be added to the bottom and then the query would be sorted based on this order.

Creating Dynamic Sheet Cell Reference List for pulling numbers to SUM

I've been working on building a data analysis sheet, which is quite verbose at the moment and a bit more complicated than it should be as I've been trying to figure this out. Please note, I work doing student data in a school.
Basically, I have two sets of input data:
Data imported from a CSV file that includes test data and codes for Common Core Standards and the questions tied to those standards as a whole class summary
Data imported from a CSV file that includes individual scores by question
I am looking to construct 2 views:
A view that collates and displays data of individual standards per student that includes a dropdown to change the standard allowing a teacher to see class performance by standard in a broad view. The drop-down is populated dynamically from the input data (so staff could eventually dump data and go directly to reports)
A view that collates and displays data of individual students broken down by performance on each standard allowing a teachers to see the broader spectrum for each student. The student drop-down is populated from Source list 2.
I have been able to build the first view, but am struggling with the second. I've been able to separate the question codes and develop strings of cell references to the scoring data, including a dynamic reference to the row the selected student's score data appears on in the second source set from above.
I tried to pass through an indirect() formula into a sum() so as to process for a mean evaluation, and have encountered errors. I think SUM() doesn't process comma-separated cell reference lists from Indirect() [or in general] or there is something that I am missing to help parse it. Here is the formula I have tried:
=Sum(vlookup(D7,CCCodeManip!$A:$C,3,false))
CCCodeManip!C:C includes the created text (based on the dynamic standards and question codes, etc), here's an example of what would be found there:
'M-ADI'!M17, 'M-ADI'!N17, 'M-ADI'!O17, 'M-ADI'!P17, 'M-ADI'!Q17, 'M-ADI'!R17, 'M-ADI'!J17
I need these to be dynamic so that teachers can input different sets of standards, question, and student data and the sheet automatically collates and reports it in uniform ways (with an upward bound of 20 standards as I currently have it built)
Here is a link to the sheet I built, with names and ID anonymized. There's a CRAP TON of sub-tabs, and that's really just being able to split apart and re-combine data neatly without things error-ing out due to data overlapping, aside from a few different attempts and different approaches to parse the cell reference strings.
The first two tabs are the current status of the data views. I plan to hide a bunch of the functional stuff that is there to help pull data accurately.
The 3rd and 4th tab are the source data sets. 5th is a modified version of source data that allows me to reference things better, and I've tried to arrange the sheets most relevant towards the front of the set.
https://docs.google.com/spreadsheets/d/1fR_2n60lenxkvjZSzp2VDGyTUO6l-3wzwaV4P-IQ_5Y/edit?usp=sharing
Some have a different approach? I am aware that I might be as far as I cn go with this and perhaps should consider scripts - my coding experience is a bit out of date and my strength is more with the formulas, but I can dig into things with some direction, if anyone can help.
Ok so I noticed something.
It seems the failure is in the indirect reference:
=indirect(CCCodeManip!C3)
The string I am trying to parse via indirect is going to be generated into something like this, dynamic from reference to other data:
'M-ADI'!M17, 'M-ADI'!N17, 'M-ADI'!O17, 'M-ADI'!P17, 'M-ADI'!Q17, 'M-ADI'!R17, 'M-ADI'!J17
The indirect returns the error that the above string is not a cell reference with the #REF code.
Can someone give me a clue as to what is causing this? I am going to dig into the docs on Indirect() from google and will post anything that I find.
Perhaps it is that indirect() can't handle lists, but only specific references and arrays, which may require me a to build a sheet to do the SUM formula on for each question set (?)
So I think I figured it out, but i Ended up parsing the data differently, basically doing the sum based on individual cell references and a separate sum formula, bypassing the need to do it all at once, it jsut makes my sheets a lot dirtier! I am eventually going to see if code could do it better if I need to, but this is closed for now.
Basically, I did individual cell references to recall scores in a row, then used a separate SUM formula, and created references / structures to be able to pull those sum() results. Achieves the same end, but with extra crap on the sheet.

Reorganizing Google Sheets data dynamically

I'm currently working with Google Sheets to import data from Contact Form 7 in Wordpress. All the data is coming over fine, but I wanted to see about formatting it in more user friendly fashion. I've simplified the example a bit, but the gist of the form I have created allows the user to request multiple versions of a graphic file with different wording as needed, up to 5(my example has just 2 for simplicity sake).
All the data is imported using the CF7 variables and ideally I wanted to clean this up a bit. What I had thought of as a solution was creating a second sheet that pulls in this data submitted in the first sheet into a more user friendly format, as I intended to use this as a work form for a designer to create the requested graphic once the data is received. With each request the name/department/email/date all stay the same, but I'd like to display the version and line 1 and 2 data on another line. Is it possible to reorganize data like this on the fly, so when a new form is submitted and adds data to sheet 1, sheet 2 would then update with the properly formatted info?
Is this even possible to do? I did some looking online, but didn't anything that really related to this type of data manipulation.
Solution:
Here's what ended up working for my example
=ArrayFormula(QUERY({
Sheet1!A2:D,Sheet1!E2:G,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!H2:J,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!K2:M,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!N2:P,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!Q2:S,ROW(Sheet1!A2:A)
},"select Col1,Col2,Col3,Col4,Col5,Col6,Col7 where Col5<>'' order by Col8",1))
Yes, it's possible.
One way is to use arrays and the QUERY function.
For simplicity, let say that
Columns A and B have the general information of the order
Columns C and D have the data for version 1
Columns E and F have the data for version 2
Columns G and H have the data for version 3
On the output sheet, add the headers.
Below of them add a formula like the following:
=ArrayFormula(QUERY({A2:B,C2:D,ROW(A2:A);IFERROR(LEN(A2:B)/0),E2:F,ROW(A2:A);IFERROR(LEN(A2:B)/0),G2:H,ROW(A2:A)},"select Col1,Col2,Col3,Col4 where Col3<>'' order by Col5"))
References start on row 2 to skip the headers to avoid to include them on the output sheet.
ROW(A2:A) is used to keep the order
IFERROR(LEN(A2:B)/0) is a "trick" used to "hide" the order (general information) data for the second and following rows for the same order. On the select parameter of the QUERY function, it's referrey as Col5 on the order by clause.
It's assumed that lookup-choice-1 will never be empty.
NOTES:
If more columns were added, the column numbers should be updated accordingly
Don't use the order by clause to sort the result by the general information columns because the "trick" to hide the "labels". If you need to apply a sort, do it' before applying the above formula, you could do this by sorting the source range through the Data > Sort range... feature, so the data is sorted before it's transformed by the above formula.
See also
Sort and filter your data, an official help article describing Data > Sort range...

How do I use Macros to copy select data from one worksheet to another on Excel?

I need to create a Macro on Excel to keep track of changing contracts. There's already an existing macro that updates the contract data so I need to create another macro...
There are two worksheets. On the first worksheet is a bunch of data with each row representing one contract. There are several categories (Contract #, Date, Price, etc.).
I need to write a Macro that finds only certain contracts fitting specific criteria (like, contacts at a specific date or a certain price), copies and pastes them into the second worksheet.
What I've done so far:
I've figured out a bit of a convoluted way of doing it using IF and OR functions. So using OR I specify the criteria and IF to basically find the corresponding data if things are TRUE.
When things are false, a 0 is entered. The problem is I have tons of rows of zeroes---rows/contracts that didn't fit the criteria. When I try to use the find command (CTRL+F) to find, highlight, and properly delete (with rows shifted up) all the zeroes, Macro doesn't record it and I'm not sure how to write it in the code.
Any insight would help!
Just change your formula to:
=IF(OR(TermSheet!$E40=41220,TermSheet!$M40="bpxx"),TermSheet!E40,"")

Resources