Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Format field output in SAPScript

Former Member
0 Likes
1,165

Hello,

I want to mask all but the last 4 digits of a bank account that is output to SAPscript. The bank account number is populated through &REGUH-ZBNKN&. The bank account number length can vary, so it is not possible to set a constant offset like &REGUH-ZBNKN+4&. The SAPscripty itself is called by a standard SAP program therefore do not want to make any chnages in teh SAP program itself.

Can you advise if there is any way within the SAPscript itself to ensure only the last 4 digits contained in &REGUH-ZBNKN& are output? If this has to be done by the PERFORM statement, can I design a new own Z program (independent of the SAP calling program) and dynamically call that from within the SAPscript to output the last 4 digits?

Can you advise the general approcah please?

Thanks for any ideas

Mik

5 REPLIES 5
Read only

Former Member
0 Likes
982

hi Michael,

Try &REGUH-ZBNKN(4)&  hopefully it will work out your requirement.

Read only

0 Likes
982

Unfortunatley Sai this will only pick the 1st 4 digits of the field, not sure if there is anyway to pick teh last 4 digits of the field. Note the field can have contents which vary in length, so saying &REGUH-ZBNKN+6& etc is not possible

Read only

Former Member
0 Likes
982

You can always call an external perform from inside the SAPScript.

Neal

Read only

Former Member
0 Likes
982

Perform statement needs to be used which will call subroutine of your custom program.

Here is SAP Help and wiki article with example.

Read only

Former Member
0 Likes
982

Hi Michael,

Create a Sub Routine Pool Program with a form in SE38. Call the same in your SAPScript Window where you want to do play with values. The structure out_tab and in_tab have values.

Eg :-

and,

form F140_LOGO TABLES     p_in_tab  STRUCTURE itcsy

                          p_out_tab STRUCTURE itcsy.

*-- <logic>

Endform.

BR,

Ankit.