cancel
Showing results for 
Search instead for 
Did you mean: 

Display the year using a floating field

Former Member
0 Kudos

Dear,

I want to display the year by using a floating field.

There are fields available in the template provided by SAP (HAP_PDF_OFFLINE_FORM).

I want to use the AP_START_DATE field but when I try this it gives no value.. Does anybody know how this value is passed through the form? I have a Badi to test my adobe form that I have designed but there is no date in a field somewhere. Is this necessary?

Thanks in advance.

Kr,

Tom

Accepted Solutions (0)

Answers (1)

Answers (1)

OttoGold
Active Contributor
0 Kudos

Maybe this is possible, maybe not. But for me it sounds hihly unproffesional.

Anyway: you cannot only assignt the value into the field I believe, you need to cut out the right part of the date and assign only a part into the field you want. Well... not sure it this could work (like pass the checks etc.), but your can try.

Otto

Former Member
0 Kudos

Otto,

I tested my form in transaction SFP with F8. I've put a breakpoint on the AP_START_DATE field and I saw the value was 00000000 so I changed it to 20100101 and it was displayed in the field.

How can I test in transaction PHAP_ADMIN if the value is passed? Because at this moment it doesn't show a date eventhough the field is displayed. There is a start date entered in the Badi so it should normally display the date that is in that field.

Thanks for your help.

Kr,

Tom

Former Member
0 Kudos

Hi Tom,

I am not sure u r requirement is format or data being passing to form but thought the below script might help you some how.

This is done in form ready event.


 var valArray = this.rawValue.split("."); // Assuming you get data in mm.dd.yyyy from backend if its not . replace the split accordingly.
 var actualVal = Date.parse(valArray[1]+"/"+valArray[0]+"/"+valArray[2]);
 var monthWord=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
 var dayWord = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
 var dateType=new Date(actualVal);
 var day=dateType.getDate();
 var month=dateType.getMonth();
 var year=dateType.getFullYear(); 
 var weekDay = dateType.getDay();
 var dateFormat= dayWord[weekDay]+", "+day+" "+monthWord[month]+" "+year;
// This displays date 09/12/2010 as  "Thursday, 9 December 2010" modify the above line w.r.t your requirement.
  this.rawValue = dateFormat;

If its that you need current year just use the below


var dateType=new Date();
 var year=dateType.getFullYear(); 
this.rawValue = year;

Cheers,

Sai

Former Member
0 Kudos

Sai,

The year needs to be obtained from the field AP_START_DATE. When I go to transaction PHAP_ADMIN --> select a Badi --> click the print icon --> print preview it doesn't show anything on the form.

That is the issue I need to solve.

Kr,

Tom