cancel
Showing results for 
Search instead for 
Did you mean: 

JS Conversion file script logic syntax for Time

0 Kudos
286

Hi

I'm trying to load data from an ADSO to BPC. I've a problem with time conversion file logic. I need to populate FY22.JAN if the source record is coming with 2023001

Can you please provide the JS syntax guide or share the snippet of code to write in internal column for above scenario.

I am trying with below syntax.

js:(pasrseInt(%extrernal%.tostring().slice(0,4))-1).toString()+'FY'.'SUBSTR(-2,2).'JAN'

Thanks in advance

Chandu

Former Member
0 Kudos

Welcome to the SAP Community. Thank you for visiting us to get answers to your questions.

Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.

First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Second, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html, as that will help you when submitting questions to the community.

I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

Now for some specific suggestions on how you might improve your question:

* Outline what steps you took to find answers (and why they weren't helpful) -- so members don't make suggestions that you've already tried.

* Share screenshots of what you've seen/done (if possible), as images always helps our members better understand your problem.

Should you wish, you can revise your question by selecting Actions, then Edit.

The more details you provide (in questions tagged correctly), the more likely it is that members will be able to respond. As it stands, I don't know if there is enough information here for members to understand your issue. So please consider revising your question because I'd really like to see you get a solution to your problem!

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

former_member186338
Active Contributor
0 Kudos

Strange idea to create code for single month only. You can create a single line JS to work with all months.

Accepted Solutions (1)

Accepted Solutions (1)

N1kh1l
Active Contributor

chanduguduru9

Try this below code in INTERNAL Column

js:'FY'+(Number(%extrernal%.toString().substring(0,4))-1).toString().slice(-2)+'.JAN'

I tested the code snippet in javascript online editor and got the required output

Please accept/upvote if this helps you.

Nikhil

Answers (1)

Answers (1)

0 Kudos

Hi Nikhil,

Thanks for providing the corrected syntax. Going forward i will follow the testing approach using Java Script editor.

Regards,

Chandu Guduru