Manual binding of fields in print form
I'm evaluating ADS as a tool for printing.
Nearly all problems that we have with SmartForms (that are more or less depend on very tricky formatting of the documents we have to print) can be solved with LifeCycle designer. The tool is very nice.
Stil, I have some questions.
For example (let's assume we are using standard SFLIGHT table). We want to print table with items selected from SFLIGHT into internal table LT_SFLIGHT. Table will have CARRID, CONNID and FLDATE fields.
When adding this fields the standard way (just by drag and drop) it works fine and the system prints a table with 3 independent columns.
But what to do if we want to join CARRID and CONNID in one field (so it could look like 'AZ-170') and output it in one column (let's call it FLIGNT_NO)?
While it's impossible to attach two or more data fields to one form field using the binding tab of the object palette, I'm trying to use scripting to make the join. Used several events (initialize, calculate, form:ready) and different syntax (using 'concat' function).
But with no luck.
Can someone explain how to address individual table fields from data source of the form to use them in concatenation? And what event to use?
I know at least onew solution - using special field in form context and concatenating the data in ABAP program, but it seems not to be very nice..
Juergen Hauser replied
I would recommend using a script in the form:ready event.
Follow these steps:
Do not bind the field that is used to display the value.
Add a script like the following (language FormCalc):
$.rawValue = Concat($record.table1.r[$.parent.index].a, $record.table1.r[$.parent.index].b)
$.parent.index is the number of the row. The script uses this value to access the correct data.
Use $record to access data.
"table1" has several rows ("r") with two fields "a" and "b".