SELECT-OPTIONS by arbitrary ABAP variable - abap

I've created a report that contains a selection screen that has select options for fields like : kunnr,sortl etc from standard SAP tables.
In addition, I've created a variable that sums a few fields from a table.
Now I need to add a select option for this field so I can run the report searching By the amount I will enter in it(range or specific amount).
I've searched the web and haven't found a solution.
Would really appreciate any help.
Thank you!

Following is suggestion for your case.
Tables: KNA1,EKKO.
SELECT-OPTIONS: so_kunnr FOR kna1-kunnr.
so_amt FOR ekko-dpamt.
**********
SELECT * FROM KNA1 WHERE kunnr IN so_kunnr
********** Variable Amount
IF lv_var IN so_amt.
******** Your Logic
ENDIF.
regards,
Umar Abdullah

Related

Retreiving ship-to-party country SAP QuickViewer

I've created a QuickView, where I enter Sales Document data as search criterias.
Selection fields are
VBAP-VBELN, VBAP-POSNR, VBAP-MATNR and VBAP-KWMENG
As the Sales Document Item data.
Furthermore I retrieve the Schedule line date from
VBEP-EDATU
From General Data in Customer Header KNA1, I use
KNA1-KUNNR and KNA1-LAND1
Now, all connections and keys works out. My issue is, I wish to list the Country Key for ship-to-part rather than sold-to-party (which is represented by KUNNR). How could this be solved?
Tables are joined as follows:
VBAK-VBELN -> (VBAP-VBELN,-POSNR) -> (VBEP-VBELN, -POSNR)
VBAK-KUNNR -> KNA1-KUNNR
I do know I would probably need a new table in here to retreive what Iæm looking for, but I'm completely blank. Any help would be greatly appriciated. I
Ship-To-Party is stored in table VPBA (Sales Document Partners) in field KUNNR1 for partner function SH, so to select it you should join KNA1 not with VBAK but with VBPA-KUNNR restricting function to SH.
However, SQVI is a very primitive tool which doesn't allow setting complex (neither trivial) conditions so you should switch to ABAP queries tool (SQ01).
But just in case you wanna do this in SQVI here is the workaround:
Join necessary tables in SQVI builder
Add necessary KNA1 fields to layout: KUNNR and LANDX
Go to layout mode and enable selection by partner function PARVW
Run your query by SH partner function
and voilá! You will be shown only the orders with ship-to-party specified with their countries

MS Access & Queries

Looking for a bit of help for an Access/Query question pertaining to a homework assignment that has 6 separate questions. I have completed all but one. The assignment wants me to do the following query.
The name, unit price, and quantity ordered for all products purchased by a customer whose id is entered from the keyboard.
Is there a function I'm overlooking for the ID entity criteria? I've looked and searched but cannot find how to add that part into the query. Thanks in advance for any help.
You can accomplish this by making the ID criteria a parameter. Access will then pop up an input form that lets you enter the value of the parameter.
You can read more here and here.

using a lookup table on a form with Oracle Apex Item

I have an application that uses Oracle Apex 4.2 . It has a form ( form and report on a table) that needs to display descriptions for columns on the table. For instance, there is a column on the table called fund which has a numeric value ( 1 to 6). There is a separate table that gives a description for each of these 6 values. Under EDIT PAGE ITEM, under SOURCE, I chose SOURCE TYPE -> SQL QUERY
I entered this query below:
SELECT DESCRIPTION FROM
"#OWNER#"."BU19ANT",
"#OWNER#"."FUNDCD"
WHERE ANTFUNDCD = CODE
where BU19ANT is the table that used for this form
FUNDCD is the name of the look up table
ANTFUNDCD and CODE and numeric fields on the respective tables and DESCRIPTION is the value that I want to look up and display on the form.
This gives me the correct answer MOST of the time, but not all the time.
The key to the table ( and the field used to link from the report to the form) is the Soc Security Number. If I run this same query against the Oracle table hard coding the SS Number, I always get the correct answer.
This form has 5 look ups that work this way and they all have the same problem.
I assume that I DONT need to include the Social Security Number as part of the query Apex already knows that.
But I tried to add that and can not figure out how to code it.
I tried
WHERE ANTSOCIALSECURITYNUMBER ( column on table) = P2_SOCIALSECURITYNUMBER ( the item on this page)
but that gave this error
ORA-00904: "P2_SOCIALSECURITYNUMBER ": invalid identifier
Is there some other way to code this? Or to say where SS Number = current record?
Or am I on the wrong track here?
Try :P2_SOCIALSECURITYNUMBER (for items on session) or &P2_SOCIALSECURITYNUMBER. (for items on page)

Database Design: Line Items & Additional Items

I am looking for a solution or to be told it simply is not possible/good practice.
I currently have a database whereby I can create new orders and select from a lookup table of products that I offer. This works great for the most part but i would also like to be able to add random miscellaneous items to the order. For instance one invoice may read "End of Tenancy Clean" and the listed product but then have also an entry for "2x Lightbulb" or something to that effect.
I have tried creating another lookup table for these items but the problem is i don't want to have to pre-define every conceivable item before I can make orders. I would much prefer to be able to simply type in the Item and price when it is needed.
Is there any database design or workaround that can achieve this? Any help is greatly appreciated. FYI I am using Lightswitch 2012 if that helps.
One option I've seen in the past is a record in your normal items table labeled something like "Additional Service", and the application code will recognize this item and also require you to enter or edit a description to print with the invoice.
In the ERP system which we have at work, there is a flag in the parts table which allows one to change the description of the part in orders; in other words, one lists the part number in the order and then changes the description. This one off description is stored in a special table (called NONSTANDARD) which basically has two fields - an id field and the description. There is a field in the 'orderlines' table which stores the id of the record in the special table. Normally the value of this field will be 0, which means that the normal description of the part be displayed, but if it's greater than 0, then the description is taken from the appropriate row in the nonstandard table.
You mean something like this?
(only key attributes included, for brevity)

What is "POSNR" an abreviation or acronym for?

I'm working with some data that's coming out of an SAP system. There's a field named
POSNR
that appears to be a line item/database identifier of some kind. What is this an abbreviation for? It's not hyper-critical to what I'm doing, but every time I stare at the word it looks like pure gibberish and can be slightly distracting.
I'm not an SAP expert but could it be "Item number of sales document"?
Position number?
If you look at, for example, VBAP table in german, POSNR is "Positionsnummer des Vertriebsbeleges" so yes, POSNR is POSition NumbeR.
It's very common in SAP tables to use it in combination with doc. number to create the primary key for positions or subdocuments, especially in SD (sales) tables. So you have VBAK-VBELN for purchase order header and VBAP-VBELN + VBAP-POSNR for items in purchase orders. So on in LIKP/LIPS, VBRK/VBRP, VBUK/VBUP...