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

using upper case in SAPSCRIPT

Former Member
0 Likes
1,734

hello

in a SAPSCRIPT form, is there a way to print something in UPPER CASE.

in our system, our vendor name is in mixed case and they are requesting that we print the vendor name in upper case so that we can use a positive pay feature that matches on the vendor names and they have to be in upper case. we were thinking of updating the tables to put all of the vendor names in upper case but I was wondering if there is a way to print in upper case. I haved checked thru the forums and I could not find anything

thanks in advance for the help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,227

in SAP-SCRIPT itself it is NOT possible.

but you may do an external Perform like:


/:   define &flv_vendor_name_uppercase&
/:   perform transform_vendorname in program your_program
/:   using &vendor_name&
/:   changing &flv_vendor_name_uppercase&
/:   endperform
A1 &flv_vendor_name_uppercase&

in the program your_program, which is just a dummyname you may use one of your programs here, you need to add the routine transform_vendorname like following:


form transform_vendorname      TABLES in_tab   STRUCTURE itcsy
                                                           out_tab STRUCTURE itcsy.

  DATA:  lv_vendor_name        type char40.

  read table in_tab
  with key name = ''.
  if sy-subrc = 0.
    lv_vendor_name = in_tab-value.
  endif.

  CALL FUNCTION '2054_TRANSLATE_2_UPPERCASE'
    EXPORTING
      i_string            = lv_vendor_name
    IMPORTING
      E_STRING            = lv_vendor_name
    EXCEPTIONS
      ERROR_OCCURED       = 1
      OTHERS              = 2
            .
  IF sy-subrc <> 0.

  ENDIF.

  read table out_tab
  with key name = 'flv_vendor_name_uppercase'.
  if sy-subrc = 0
    out_tab-value = lv_vendor_name.
    modify out_tab index sy-tabix.
  endif.

endform.

Edited by: Florian Kemmer on Apr 30, 2008 2:12 PM

8 REPLIES 8
Read only

Former Member
0 Likes
1,227

Use the function module: SWA_STRING_TO_UPPERCASE.

and pass the string which u want to convert to uppercase.

Reward if helpful.

Thanks.

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,227

hi Tim,

You can only solve this in the print program (not in the Script). Let's say you read the name of the vendor into field it_lfa1-name1. Than you have to do the following in the program:

TRANSLATE it_lfa1-name1 TO UPPER-CASE.

Changing the vendor name to upper case in the vendor master is probably not the right solution, because than you have the name upper case all the time (all reports, printouts, etc.), which probably you don't want.

hope this helps

ec

Read only

Former Member
0 Likes
1,228

in SAP-SCRIPT itself it is NOT possible.

but you may do an external Perform like:


/:   define &flv_vendor_name_uppercase&
/:   perform transform_vendorname in program your_program
/:   using &vendor_name&
/:   changing &flv_vendor_name_uppercase&
/:   endperform
A1 &flv_vendor_name_uppercase&

in the program your_program, which is just a dummyname you may use one of your programs here, you need to add the routine transform_vendorname like following:


form transform_vendorname      TABLES in_tab   STRUCTURE itcsy
                                                           out_tab STRUCTURE itcsy.

  DATA:  lv_vendor_name        type char40.

  read table in_tab
  with key name = ''.
  if sy-subrc = 0.
    lv_vendor_name = in_tab-value.
  endif.

  CALL FUNCTION '2054_TRANSLATE_2_UPPERCASE'
    EXPORTING
      i_string            = lv_vendor_name
    IMPORTING
      E_STRING            = lv_vendor_name
    EXCEPTIONS
      ERROR_OCCURED       = 1
      OTHERS              = 2
            .
  IF sy-subrc <> 0.

  ENDIF.

  read table out_tab
  with key name = 'flv_vendor_name_uppercase'.
  if sy-subrc = 0
    out_tab-value = lv_vendor_name.
    modify out_tab index sy-tabix.
  endif.

endform.

Edited by: Florian Kemmer on Apr 30, 2008 2:12 PM

Read only

Former Member
0 Likes
1,227

Florian

I have changed my Z program for the code that you sent

I also changed the CHECKADD window to put the code for calling the routine. the name is still appearing in mixed case.

is the CHECKADD window the correct place to put the code to change the print the name in uppercase on the check?

thanks in advance for the help

Read only

Former Member
0 Likes
1,227

I am trying to get the address name on the check to print in upper case. I have modified the CHECKADD window and added the code tomy program based on the above suggesstion by Florian, but it is still not working. can someone take a look at the attached code and let me know if there is something that I have coded incorrectly that would not be changing the name to upper case

thanks..

AS

/

/: ADDRESS PARAGRAPH AS

/* start 06/02/08 THIXSON

/: DEFINE &ZNME1_UC& = ''

/: DEFINE &ZNME2_UC& = ''

/: DEFINE &ZNME3_UC& = ''

/: DEFINE &ZNME4_UC& = ''

/: PERFORM TRANSFORM_VENDORNAME IN PROGRAM ZFR_US_CHEQUE

/: USING &REGUH-ZNME1&

/: CHANGING &ZNME1_UC&

/: ENDPERFORM

/: PERFORM TRANSFORM_VENDORNAME IN PROGRAM ZFR_US_CHEQUE

/: USING &REGUH-ZNME2&

/: CHANGING &ZNME2_UC&

/: ENDPERFORM

/: PERFORM TRANSFORM_VENDORNAME IN PROGRAM ZFR_US_CHEQUE

/: USING &REGUH-ZNME3&

/: CHANGING &ZNME3_UC&

/: ENDPERFORM

/: PERFORM TRANSFORM_VENDORNAME IN PROGRAM ZFR_US_CHEQUE

/: USING &REGUH-ZNME4&

/: CHANGING &ZNME4_UC&

/: ENDPERFORM

/* end 06/02/08 THIXSON

/: TITLE &REGUH-ZANRE&

/* start 06/02/08 THIXSON

/: NAME &ZNME1_UC&, &ZNME2_UC&, &ZNME3_UC&, &ZNME4_UC&

/* NAME &REGUH-ZNME1&, &REGUH-ZNME2&, &REGUH-ZNME3&, &REGUH-ZNME4&

/* end 06/02/08 THIXSON

/* NAME &REGUD-ZNM1S&, &REGUD-ZNM2S&

/: STREET &REGUH-ZSTRA&

/: POBOX &REGUH-ZPFAC& CODE &REGUH-ZPST2& CITY &REGUH-ZPFOR&

/: POSTCODE &REGUH-ZPSTL&

/: REGION &REGUH-ZREGI&

/: CITY &REGUH-ZORT1&, &REGUH-ZORT2&

/: COUNTRY &REGUH-ZLAND&

/: FROMCOUNTRY &T001-LAND1&

/: ADDRESSNUMBER &REGUH-ZADNR&

/: ENDADDRESS

Read only

Former Member
0 Likes
1,227

I am still having problems with this. earlier I have attached the code that I am using. I am not sure how the new fields would get printed. I am not sure if I have to add some code to the CHECK window to print the new field names.

I am also trying to put a break in the section that I added to the program where it does the function to change the case but everytime that I run the process, It does not stop in the code. I think the the program is running as a different user so it is not stopping.

is there a awy to put a break to stop the program for any user that is calling the progtram?

Read only

Former Member
0 Likes
1,227

I am trying to change the Uppercase option in the Paragraph formats for the T6 Check recipients tabulator etc. I checked the uppercase box and do the save. is states that is saved successfully but when I go back into the form, this option is still unchecked. I am not sure what is going on with this either

Read only

0 Likes
1,227

hello

I have the problem of printing the name in upper case solved. I had to comment out the line where it passes the address number to the print program.

*/: ADDRESSNUMBER &REGUH-ZADNR*/: ENDADDRESS

I then had to print the new address in the CHECKADD window

/ &ZNME1_UC&

/ &ZNME2_UC&

/ &ZNME3_UC&

/ &ZNME4_UC&

/ &REGUH-ZSTRA&

/ &REGUH-ZPFAC& &REGUH-ZPST2& &REGUH-ZPFOR&

/ &REGUH-ZPSTL&

/ &REGUH-ZREGI&

/ &REGUH-ZORT1&, &REGUH-ZORT2&

/ &REGUH-ZLAND&

/ &T001-LAND1&

the address is printing the blank lines for ZNME2,ZNME3, ZNME4 as well as the other fields when there is no data in the fields. I have to modify my program that is doing the translation to drop the blank lines and pass back the fields that only have data

thanks for the help on this