cancel
Showing results for 
Search instead for 
Did you mean: 

Manual binding of fields in print form

Former Member
0 Kudos

Hello!

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..

Best regards,

Pjotr Perstnev

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Pjotr,

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".

Best regards

Juergen Hauser

Adobe Systems

Former Member
0 Kudos

Hi Juergen,

as it is usually said "Works like a charm!"

Thanks a lot!

For the future reference & if anyone cares, the final script will be (taking into consideration the example provided, and specifics of SAP->Adobe interface):

<b>$.rawValue = Concat($record.LT_SFLIGHT.DATA[$.parent.index].CARRID, "-", $record.LT_SFLIGHT.DATA[$.parent.index].CONNID)</b>

This code must be included (as mentioned above) in event form:ready of the text field (use langage FormCalc, runat Server).

At the same time it was tested (and it also works) that the same code (but without '$.rawValue =' prefix) can be added to <calculate> or <initialize> events of the same text field:

<b>Concat($record.LT_SFLIGHT.DATA[$.parent.index].CARRID, "-", $record.LT_SFLIGHT.DATA[$.parent.index].CONNID)</b>

Even though the result is equal, but maybe second variant in not so good on performance - so, please, rely on the first variant as recommended by the pros'.

Answers (0)