Dynamically count the field
I have a scenario where the target field of one idoc segment should get populated ie. field should count how many other different segments are generated in the target.for example
segment A comes to 2 times then say field of segment C should be 2 in the target
You can use the following UDF's for increment and initialisation of the counter
Increment the Global Variable Counter
public String incrementCounter(String a,Container container){
//write your code here
if(a.equals(" "))
Object o = container.getGlobalContainer().getParameter("CNTR");
Integer ii;
if( o == null ) ii = new Integer(0);
else ii = (Integer)o;
ii = new Integer( ii.intValue() + 1);
container.getGlobalContainer().setParameter("CNTR", ii);
String temp = ii.toString();
return temp;
else return " ";
<b>Intialise the Counter</b>
Object o = container.getGlobalContainer().getParameter("CNTR");
Integer ii = new Integer(0);;
container.getGlobalContainer().setParameter("CNTR", ii);
return "1";
Similar Messages
-
Counting the Field characters.
Hi Experts,
Can you tell me how to count the field character.Suppose i want to maintain the equipment description then how can i know how many characters it will accept.i know i can count by putting the character but can you tell me the way such that system should tell.
There is someway like press F1 and so on.
ARHi Amit,
The equipment discription is stored in table ITOB field SHTXT.
use tcode SE11. give input as ITOB and go to line having field SHTXT. There you will be able to see character length. -
How to dynamically hide the Field Label in the overview page's form view?
Hi Experts,
How to dynamically hide, for certain condition, the Field Label in the overview page's form view?
Please reply me.
Regards,
VishalHi Vishal,
It is not possible to dynamically hide/display fields if the UI is build using configurations.
The work around is to have multiple configurations, and based on the condition, load the
corresponding configuration at runtime.
The other approach is to code the complete htm view(htm coding) without using the configuration provided by the framework.
Regards,
Leon -
Dynamically passing the fields to the data base through bdc
hi,
I need to pass the fields dynamically to the database uploading. Can anyone tell me, how we can get the 'datatype and length' of all fields in hr module. Is there any table for it.
Please give me the answer if anyone know this.
thanks & regards,
sekhar.hi,
This is the fm to get the datatype and length of the field. Where as i want to pass my irregular format of my presentation file to the database by sorting the fields as per the structure of database fields.
bye. -
Dynamically stating the field name in the WHERE clause
Hello All,
Consider the following select statement.
SELECT kunnr INTO TABLE gt_kunnr
FROM kna1
FOR ALL ENTRIES IN gt_table
WHERE kunnr = gt_table-<b>cust_id</b>.
Suppose there is a case where I do not know the name of the internal table field
(say, "cust_id" in the above case) with which comparison is to be done in the WHERE clause. Only at runtime that fieldname is available. So in the WHERE clause can I mention it dynamically?
I tried using the following.
lv_fieldname = 'cust_id'.
SELECT kunnr INTO TABLE gt_kunnr
FROM kna1
FOR ALL ENTRIES IN gt_table
WHERE kunnr = gt_table-<b>(lv_fieldname).</b>
But this is giving a syntax error.
Could anyone suggest an alternate approach?
Regards
Indrajit.Hi,
It is fine with Enterprise version but when I am trying to run the following code in Rel 4.6C, I am getting a syntax error.
TYPES: BEGIN OF ty_wherecond,
data(72) TYPE c,
END OF ty_wherecond.
DATA: gt_itab1 TYPE STANDARD TABLE OF kna1,
gt_itab2 TYPE STANDARD TABLE OF kna1.
DATA: BEGIN OF gt_kunnr OCCURS 0,
kunnr TYPE kunnr,
END OF gt_kunnr.
PERFORM fill_itabs TABLES gt_itab1
gt_itab2.
*& Form fill_itabs
text
-->P_T_TABLE text
FORM fill_itabs TABLES p_t_table
pt_table_dummy.
DATA: lv_fieldname(30) TYPE c VALUE 'pt_table_dummy-kunnr'.
DATA: lt_wherecond TYPE STANDARD TABLE OF ty_wherecond,
lt_condtab TYPE STANDARD TABLE OF hrcond,
ls_condtab TYPE hrcond.
FIELD-SYMBOLS <fs_wherecond> TYPE ty_wherecond.
pt_table_dummy[] = p_t_table[].
CLEAR ls_condtab.
REFRESH: lt_wherecond[],
lt_condtab[].
ls_condtab-field = 'KUNNR'.
ls_condtab-opera = 'EQ'.
ls_condtab-low = lv_fieldname.
APPEND ls_condtab TO lt_condtab.
CALL FUNCTION 'RH_DYNAMIC_WHERE_BUILD'
EXPORTING
dbtable = space " can be empty
TABLES
condtab = lt_condtab
where_clause = lt_wherecond
EXCEPTIONS
empty_condtab = 01
no_db_field = 02
unknown_db = 03
wrong_condition = 04.
LOOP AT lt_wherecond ASSIGNING <fs_wherecond>.
REPLACE '''' WITH '' INTO <fs_wherecond>-data.
REPLACE '''' WITH '' INTO <fs_wherecond>-data.
ENDLOOP.
SELECT kunnr INTO TABLE gt_kunnr
FROM kna1
FOR ALL ENTRIES IN pt_table_dummy
WHERE (lt_wherecond).
IF sy-subrc EQ 0.
ENDIF.
ENDFORM. "fill_itabs
The syntax error says "The WHERE condition does not refer to the FOR ALL ENTRIES table".
Even after using the FM 'RH_DYNAMIC_WHERE_BUILD' as suggested by you, the syntax error is coming.
Could you please suggest how to ignore this?
Regards
Indrajit. -
Using TVARVC to Dynamically Set the Payroll Period in Standard Reports
Hi,
I am trying to define the selection screen parameters for the Pay Scale Reclassification (RPIPSR00) program such that the payroll period chosen is always +1 of the current period (i.e. the next payroll period).
I understand that I can use TVARVC to dynamically determine the field value of a selection screen variant. The question is after I have created a variable in the table, how do I go about ensuring that the program uses the next payroll period?
Regards,
AugustineTry reading the help first: http://help.sap.com/saphelp_nw04s/helpdata/en/c0/980398e58611d194cc00a0c94260a5/content.htm
You have to update TVARVC with the desired value - either via a batch program or manually.
matt -
How to count the number of lines dynamically,
In the below code am trying to read the lines which are selected using a check box, also am categorizing the contents depending on the follow up material.
after displaying one category contents am displaying a line
which also counts to a line in the internal table.
My question is how to count the number of lines(ULINE) displayed dynamically.
FORM GET_LINES .
DATA: LV_LINES TYPE I,
LV_TIMES TYPE I,
LV_TABIX TYPE SY-TABIX.
DESCRIBE TABLE IT_REC LINES LV_LINES.
DO LV_LINES TIMES.
LV_TIMES = SY-INDEX .
READ LINE LV_TIMES FIELD VALUE IT_REC-CHECK INTO GV_CHECK.
IF SY-SUBRC EQ 0 AND GV_CHECK IS NOT INITIAL.
LV_TABIX = LV_TIMES.
READ TABLE IT_REC INDEX LV_TABIX INTO GWA_UPDATE.
IF SY-SUBRC EQ 0.
APPEND GWA_UPDATE TO GT_UPDATE.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. " GET_LINESIn the below code am trying to read the lines which are selected using a check box, also am categorizing the contents depending on the follow up material.
after displaying one category contents am displaying a line
which also counts to a line in the internal table.
My question is how to count the number of lines(ULINE) displayed dynamically.
FORM GET_LINES .
DATA: LV_LINES TYPE I,
LV_TIMES TYPE I,
LV_TABIX TYPE SY-TABIX.
DESCRIBE TABLE IT_REC LINES LV_LINES.
DO LV_LINES TIMES.
LV_TIMES = SY-INDEX .
READ LINE LV_TIMES FIELD VALUE IT_REC-CHECK INTO GV_CHECK.
IF SY-SUBRC EQ 0 AND GV_CHECK IS NOT INITIAL.
LV_TABIX = LV_TIMES.
READ TABLE IT_REC INDEX LV_TABIX INTO GWA_UPDATE.
IF SY-SUBRC EQ 0.
APPEND GWA_UPDATE TO GT_UPDATE.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. " GET_LINES
The display function is:
FORM DISPLAY_DATA .
ULINE.
WRITE : /1 SY-VLINE, 'check',
10 SY-VLINE, 'Plant',
20 SY-VLINE, 'Material number',
50 SY-VLINE, 'Follow up material',
70 SY-VLINE, 'Safety stock',
100 SY-VLINE, 'Partc'.
ULINE.
LOOP AT IT_MARC.
MOVE: IT_MARC-WERKS TO IT_REC-WERKS,
IT_MARC-MATNR TO IT_REC-MATNR,
IT_MARC-NFMAT TO IT_REC-NFMAT,
IT_MARC-EISBE TO IT_REC-EISBE,
IT_MARC-PARTC TO IT_REC-PARTC .
APPEND IT_REC.
CLEAR IT_MARC.
ENDLOOP.
DATA: GV_TABIX TYPE SY-TABIX.
LOOP AT IT_REC.
GV_TABIX = SY-TABIX.
READ TABLE GT_TOTAL WITH KEY WERKS = IT_REC-WERKS
NFMAT = IT_REC-NFMAT.
IF SY-SUBRC EQ 0.
IT_REC-PARTC = GT_TOTAL-PARTC.
MODIFY IT_REC INDEX GV_TABIX TRANSPORTING PARTC.
ENDIF.
ENDLOOP.
LOOP AT IT_REC.
WRITE : /1 SY-VLINE, IT_REC-CHECK AS CHECKBOX,
10 SY-VLINE, IT_REC-WERKS,
20 SY-VLINE, IT_REC-MATNR,
50 SY-VLINE, IT_REC-NFMAT,
70 SY-VLINE, IT_REC-EISBE,
100 SY-VLINE, IT_REC-PARTC.
AT END OF NFMAT.
ULINE.
ENDAT.
ENDLOOP.
ULINE.
ENDFORM. " DISPLAY_DATA
Solved -
Problem in dynamically generating the file upload field
Hello all
I am using netbeans 5.5 and visualwebpack for my jsf project.
i have a problem in dynamically generating the file upload field and using it.
I have a panel say "panelA" which holds file upload fields.
Depending upon the count value i generate the file upload field using following code snippet:
Upload upload1 = new Upload();
upload1.setId("upload1");
getPanelA.getChildren().add(upload1);
The page successfully shows up the file upload fields. While the user clicks the submit button, i have used following logic to perform upload:
List components = getPanelA().getChildren();
for(int i = 0; i<components.size(); i++){
if(components.get(i) instanceof Upload){
UploadedFile uploadedFile = ((Upload)components.get(i)).getUploadedFile();
I am getting this UploadedFile object null.
How can i solve this problem.Anyway,
I solved the problem.
Actually i was using label property of the upload field due to which i got null pointer exception.
I removed the label property of the upload field and things worked as i wanted. -
Dynamic Pie Chart: Counting the number of instances for each value
Hello my name is Tim and I am at a roadblock concerning a chart for a dashboard design.
I have a list with two fields:
Platform and Status. The list is customized in InfoPath. The
Platform field is located on the form as a drop-down menu with 6 entries.
Status is a choice field with 3 selection that is updated through the lifespan of the project (once item created, it is updated to "In process", once the project is closed, the field is updated to "closed."
My hurdle is viewing these dynamically in a Pie Chart. I am trying to display the number of project's "In process" for each Platform. So, if Platform A has 6 projects "In process" and Platform B has 3 projects "In process"
how can this be displayed in a pie chart?
At the moment, I figured there are two options: Chart View WebPart or importing an Excel worksheet.
Any ideas or solution on how to accomplish this?
-Tim DempseyThree options:
1. Create a list that holds your statuses. Then in your original list, create a lookup to the status list. In your status list, make a lookup to the lookup. This creates a circular reference which, for whatever reason, returns a count. You can then connect
a chart web part to this. Repeat for the other column.
2. Go to your sharepoint list and export to spreadsheet. Save the file. This is a query file that you can use as a data connection. From that file, set it to auto-update and then create a chart from a pivot table. Then use Excel Services Web Part to display
the file.
3. The other option is to use Google Charts API. Connect to the list, run some jQuery and JavaScript and then export out a chart. Pretty cool tool.
Andy Wessendorf SharePoint Developer II | Rackspace [email protected] -
How to get the co-ordinates of a dynamically created input field
Hello Frn's
i have created a dynamic text view . but this text view is not appearing at proper position . I want palce it infront of a dynamically created input field . how can i do this ?
as i am thinking ...i should first of all get info about the co-ordinates of dynamaclly creatd input field . and with respect to these co-ordinates ...set the position of text View .
Please suggest your thoughts .
Thanks and Regards
Priyank DixitHi,
There is no provision in WD for getting screen coordinates and then placing the UI element.
You to add the UI element to layout editor and based on the layout type it will add the UI element to respective position.
I would advice not to create dynamic UI elements( instead you can create them statically and then play with visibility status through context binding ). This will be more effective way and less error prone. This is also recommended practice.
still,For dynamic creation you can refer to following wiki:
http://wiki.sdn.sap.com/wiki/display/WDABAP/CreatingUIElementsDynamicallyinAbapWebdynpro+Application
regards
Manas Dua -
How do I set the value of a dynamic row text field
I have a repeated row form which contains a button and multiple text fields. There is a text field (Input Data Field) further up with some information I want to place in the table and multiple buttons that I want to read the value of and set to the table. I apologize there are multiple questions I have and I am using pseudocode to describe it.
Top form looks like
InputField
| ButtonX1 | ButtonY1 | DescriptionX1 (read only Text Field)
| ButtonXn | ButtonY1 | DescriptionXn
OutputRow looks like
| ButtonOutput | OutputField1 | OutputField2 | OutputField3 |
So I would like it to do
ButtonX1.click
OutputTable.OutputRow.addInstance(true) //this works - everything else I have questions on
OutputTable.OutputRow.OutputField1.rawValue = DescriptionX1.rawValue
Question 1
How do I address the location in each table to set a value
Question 2
How do I get the value of the description field in the same table and row as the button
I would like to say something to the effect of OutputTable.OutputRow[??].OutputField1.rawValue = this.parent.DescriptionX
OutputTable.OutputRow.OutputField2 = InputField.rawValue
Same question as above - how do I specify a dynamic row - is this the proper syntax for getting the value from the input field?
OutputTable.OutputRow.OutputField3 = this.ButtonLabel
Question 3
How can I get the value of the button's label to set in the field
There should be very many of these buttons and buttons will be added - I would prefer to set the value based on the button's label to make the value easier - not requiring changing the code
Question 4 - unrelated to those above.
Is it possible to build the first table
| ButtonX | ButtonY | Description |
from an XML File. I have seen examples of how to build if it is just data, but can the XML be pushed into a form with code to do the above actions?Each object in a form must have a unique name. I doing so it is not neccessarily the name but the path or SomExpression associated with that object that must be unique. In your case you have a Table.Row.object configuration. The Row is the part that is repeating so to give each object a unique name an instance number is placed on the repeating part. So objects in the 1st row woudl be Table.Row[0].object...objects in the second row woudl be Table.Row[1].object etc .....You can see this by adding a debug instruction on the Enter event of the description field. Put the code app.alert(this.somExpression) and when you enter the field you will see what the somExpression is. Do this for a few rows and you will see the pattern (don't forget to remove the debug code from the enter event). Now you know what you have to use to address the fields. If no instance is given it is assumed to be 0 ..that is why only the 1st row is being affected.
So now to answer your questions:
Question1: The square bracket notation is an issue for javascript (this is the notation for an array) so we have to use a different means of addressing the field to include the instance number. So to address the Description in the 3rd row we woudl use:
xfa.resolveNode("Table.Row[2].Description").rawValue = "This is my new description";
Note that the instance number is 2 for the 3rd row because the instance numbers are 0 based.
Question2. The resolveNode notation allows you to pass a string so you can also concatinate expressions to make the string. If you are writing code on a button in the same row you can get the instance that you are on by using the expression this.parent.index. The "this" portion refers to the current object (the button) and the parent.index gets you th eindex of the Buttons parent. If the button is embedded deeper in a hierarchy then you can continue to add parent indicators until you get back to the node that you want. So rewriting your expression from Q1 it woudl be:
xfa.resolveNode("Table.Row[" + this.parent.index + "].Description").rawValue = "This is my new description";
Question3: The buttons caption can be retrieved by using ButtonName.caption.value.text.value
Question4: When you say build from an XML file. What are you expecting to come from the XML file? The caption that goes on the button? Typically the XML file carries data (not to say that it cannot carry other things). Just need a bit of clarification on this one first.
Hope that helps
Paul -
How to dynamically get the SOM expression of a field?
As a follow up to the note below, I would really appreciate any help as of how to get the SOM expression of a field dynamically, by this, I mean how to get the SOM expression of a field at running time using JavaScript.
Thanks,
Isis
That does make things clearer. You will have to save the change information in the XML. I realize that you don't want to save an xml node for every field, but there is a better way. You can use scripting to add data nodes to the XML data in the form. I'm thinking of the following:
Include an empty container node in your XML schema: <HighlightedFields></HighlightedFields>
When a field is changed, in the field's change event call a common script: HighlightChangedField, passing in the object. The script will highlight the field (set the border a certain color or whatever). It will also add node underneath the HighlightedFields data node with the SOM expression of the field. The SOM expression is the "path" of the object in the form heirarchy, sort of like an xpath. So if you have a subform named Subform1 and you change the Name and Address textfields, you might end up with something like:
<HighlightedFields>
<HighlightedField>
<SOMExpression>xfa[0].form[0].myform[0].Subform1[0].Name[0]</SOMExpre ssion>
</HighlightedField>
<HighlightedField>
<SOMExpression>xfa[0].form[0].myform[0].Subform1[0].Address[0]</SOMEx pression>
</HighlightedField>
</HighlighedFields>
The upside of this is that you only store XML nodes for what is changed instead of needing a specific XML node for each field. The downside is that you will need a call to the common script in every field's change event: HighlightChangedField(this);
Now, to make this work when a form is loaded the next time, in the initialize event at the topmost subform in the hierarchy you add a script that walks the HighlightedFields data node, and for each HighlighedField entry you highlight the contained object. You can get a reference to an object using its SOM expression, so just take the SOM expression from each entry and do an xfa.resolveNode(SOMExpression) to get the object, then set whatever attributes you want to highlight the field.
The big issue I see with this would be if you have dynamically added objects on your form. In that case you would probably need to store the instance index along with the SOM expression for each changed object, then use that instance number when highlighting on form load.As a follow-up, I had said I would try to put together an example for you. The setting of the change indications and the highlighting of the fields is not a problem, but I did have an issue that perhaps one of the experts on the forum can help with:
The problem is how to detect a change in a text field without a lot of overhead. You can't just place a call to the highlight method in the Exit event without checking for a change, since the user can just tab from field to field without changing anything. Unfortunately the properties that show the old text and new text of a field are not valid on the Exit event. An alternative is to use the Change event, but with a text field the event fires for every character typed. This seems like a lot of extra processing..
Anyone know a better way? I went as far as using the extras collection on fields to hold the last value, but that adds a lot of complexity since it needs to be set to the initial raw value when the form is first loaded. I'd like to find a solution that doesn't require a lot of code to be added to every field on the form. -
With a PDF Dynamic form using show/hide actions, how to ensure that when the completed form is saved, closed and re-opened, the form still show the fields as before it was closed?
I have developed a form with fields hidden by default, that become visible based on box ticked or radio button selections.
My problem is that, when I close the form and re-open it, it comes back to it's default presentation, regardless of the information already recorded in the form (including in the now hidden fields.
How to correct that
Thanks in advance for any hint you can provide.I've had the same problem. This solved it...
Go to the "Form properties..." in the File-menu. Select "Run-time" to the left and in the box "Scripting" Preserve scripting changes to form when saved: choose Automatically (Script-based state changes are saved locally in an insecure fashion. This option cannot be used for certified forms).
Hope it works for you to... -
Changing the field properties (editabel/greyed out) dynamically?
Hello
I am developing an Adobe interactive form. My requirement is dynamically changing the filed properties based on the other field values/selections/inputs.
1) For example in the form, if user puts value_A in field_1, then, the field_2 should be greyed out.
2) If user puts value_B in field_3, then, system automatically populate the value_C in field_4 in order to let the user make easy- user friendly
3) If user puts value_D in field_5, then, only allowed value in field_6 is value_E, if by mistake user puts value_F in field_6, then, system should throw error message
Pls. let me know how to achive this DYNAMIC functionality in the FORM or do we need to handle from WEbDynPro ABAP side?
Thank youHi,
Everything you have mentioned is possible in the form itself. Just write the valid script at valid event of valid field.
1) For example in the form, if user puts value_A in field_1, then, the field_2 should be greyed out.
Ans: Write on change event of Field1:
if($.rawValue eq "value_A")
then
Field2.access = "readOnly"
Field2.fillColor = "192,192,192"
endif
2) If user puts value_B in field_3, then, system automatically populate the value_C in field_4 in order to let the user make easy- user friendly
Ans: Write on change event of Field3:
if($.rawValue eq "value_B")
then
Field4.rawValue = "value_C"
endif
3) If user puts value_D in field_5, then, only allowed value in field_6 is value_E, if by mistake user puts value_F in field_6, then, system should throw error message
Ans: Write at exit event of Field6:
if(Field5.rawValue eq "value_D" and $.rawValue ne "value_E")
then
xfa.host.messageBox("Wrong Value", "Error", 0)
endif
For such type of scripts you can refer to designer help also. So please check there before posting your query that would save your time.
Regards,
Vaibhav -
Counting the number of digits in a field
Hello friends,
does anyone know of any function module by which we can count the number of digits in a field.
Say i have a priority field which is numc2, and the the user fills in a 5 digit number in it, i was to calculate this and raise an error if the number of digits is more than 2.
Thanks in advance.
charu.data : text(10),
len type i.
text = <your variable which user is passing>
len = strlen( text ).
if len gt 2.
message 'Length incresed' type 'E'.
endif.
regards
shiba dutta
Maybe you are looking for
-
Error while creating a procedure (PLS-00103)
Hi Am create the follwing Procedure:- create or replace PROCEDURE XL_SP_ROGUEUSERS ( csrresultset_inout IN OUT sys_refcursor, intuserkey_in IN NUMBER, strsortcolumn_in IN VARCHAR2, strsortorder_in IN VARCHAR2, intstartrow_in IN NUMBER, intpagesize_in
-
Custom Error Report for Truested Recon in OIM 11.1.1.5
Hi, We are planning to have a custom scheduled task to generate csv report for failed recon events. We have some 4 trusted recons (2 custom + 2 GTC) in our environement. Does a DB query would be sufficient to meet our requirement. If yes please sugge
-
Can't switch buttons when playing on a dvd player
I searched the discussions and was unable to find an answer to my problem. How do you get the dvd to select different buttons when played on a dvd player? When I play the dvd on a computer the buttons are highlighted when the mouse is placed on them,
-
This is sort of a curious one. I have to keep CS4 installed to edit Camtasia files as their codec is a 32 bit no-go with 64 bit CS5... Oddly, when I double-click any PPro project (most were created in CS5), they will launch CS4, not CS5. When i go
-
How do I re-install iPhoto in 10.5.8 ???
I used to have iPhoto, but after updating (p.t. 10.5.8) I no longer have iPhote on my eMac++ What do I do to get it back? I bought iLife 11, only to find that it requires an intel, but I have a powerPC G4. Please someboby help me !