cancel
Showing results for 
Search instead for 
Did you mean: 

Read First letter of the fields and concatenate it - not working

former_member181966
Active Contributor
0 Kudos

All ,

I have three fields on the adobe form , pernr , first name and last name . I want concatenate First letter of first name , First letter of last name and employee number .

I am able to concatenate it without breaking it . I used CONCAT statement . I used the value in binding .

Here the tricky part how I can read it the way I want it , I used Left(S,N) . Where is S is the variable name and N is position . It is not working fine with binding variable name. I also created 3 global variable, but still getting error u201CArgument mismatch in property of function argument u201C.

Please advice. Any example would be great

Thanks,

Saquib

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Hi This code working for me.


var s = "tttt"
var n = 1
xfa.host.messageBox(Left(s,n))

Initialize the variable n with any numeric value and try this.

Kind Regards,

Mukesh

former_member181966
Active Contributor
0 Kudos

I have a variables not string . So if you have a variables e.g $record.IT_0001_nachn.DATA[].field .

Please advice.

Answers (4)

Answers (4)

OttoGold
Active Contributor
0 Kudos

I have absolutely no experience with ISR. But I hope ABAP and JS works even in ISR:))

YOu say you have completely custom form. That means you can do anthing inside it:)) If you´re not an author of the form and you cannot contact him try this:

- in the form check the binding for the drop down you need to enhance

- you have a context/ data node which is to be changed

- before the form is displayed, some initialization must happen

- in this initialization i would do all the concatenations etc. so in the form will appear the texts you want

I don´t know for sure, this is possible with ISR. If not my last idea is to work with the drop down object properties in the designer (layout of the form). Here:

- you can specify texts on tab Object - Field - List items

- you can specify which texts are bound to which internal codes on Object - Binding tab

That means you can have internal (DB/ ABAP) code "01" and in drop down you see "Mariah Carey":))

You can also experiment with dynamic binding using Object - Binding tab - Specify items values (here you don´t work with the tab below but click on the text "Specify items values").

Hope some of these helps. Otto

OttoGold
Active Contributor
0 Kudos

First: in JS there are no types, there is just VAR variable type.

Second: Can you do the coding in the ABAP?

Do you have your function modules to generate the form, pass data etc.? Or WD app? You´d better add your coding here.

If not, you can use the interface initialization to do this, but I cannot recommend doing this if it is not necessary.

You can use the usual ABAP style VAR+2(2) etc.

former_member181966
Active Contributor
0 Kudos

We are not on the same page . We are implementing ISR processes via T-code HRASR_DT. I donu2019t see any BADI because we have totally custom process and form . We want to do the followings

- On form there is position , when drop down It should show position and position description .

- Read first letter from first name, First letter from last name and EE# and update IT105 field in back end . ( pa0105)

I think I can code:-), That what I`ve been doing from last 10 years ....

Thanks,

Khan

Former Member
0 Kudos

Hi

Try this,


var pos = $record.IT_0001_<PLANS>.DATA[].field 
var fn = $record.IT_0001_<Firstname>.DATA[].field 
var ln = $record.IT_0001_<Lastname>.DATA[].field 

var mail = Concat(Left(fn,1), Left(ln,1), pos )
 $record.IT_0015_<mailid>.DATA[].field  = mail

Kind Regards,

Mukesh

OttoGold
Active Contributor
0 Kudos

SAP recommends not to script in forms if you do not need it. And imho you don´t need it. You´d better do this concatenation in your ABAP coding.

former_member181966
Active Contributor
0 Kudos

Where in ABAP ? Interface?

Please advice! BTW we are implementing ISR processes/scenarios ( T-code HRASR_DT).

Khan

.

Former Member
0 Kudos

Hi,

To get the substring form a string you can use the below code snippet.


var l_str1 = "Adobe Forms";
var l_str2 = l_str1.substring(0,1); // or l_str1.substr(0,1);

Regards

Pradeep Goli