Showing posts with label SAPScript. Show all posts
Showing posts with label SAPScript. Show all posts

Tuesday, December 11, 2012

Useful programs for SAPScript

RSTXFCONConverts SAPScript page formats
RSTXSCRPUpload and download SAPScript layout sets

Add Local SAPScript to Transport Request

At times developers develop SAPScript as local object. Unlike reports where we can change the development class using the attributes option , nothing such is available for SAPScripts.

However we can use the program RSWBO052 to change the development class.

Following are the step by step screenshots to change the development class

Click on the Object Directory and change the package

Friday, January 20, 2012

Convert SAPSCRIPT to SMARTFORMS

There are two ways through which you can convert SAPSCRIPT into SMARTFORMS as follows:

1. Function module, FB_MIGRATE_FORM.
You can start this function module via SE37, or create a small ABAP which migrates all SAPscript forms automatically.

2. You can also do this one-by-one in transaction SMARTFORMS, under
Utilities -> Migrate SAPscript form.
When converting SAPSCRIPT into SMARTFORMS, only the layout is passed. The logic is still required to be done in the SMARTFORMS.

Sample ABAP Program for Search Layout sets for given String

*****************************************************************
*
* Program : ysearchl
* Purpose : Searches all Y and Z layout sets for a given string
*
*****************************************************************


REPORT  ysearchl.

TABLES: stxl.

PARAMETERS: string(128).

DATA: BEGIN OF tlinetab OCCURS 0.
        INCLUDE STRUCTURE tline.
DATA: END OF tlinetab,
      subrc LIKE sy-subrc.

SELECT tdname 

  FROM stxl 
  INTO (stxl-tdname)
 WHERE tdobject = 'FORM' 

   AND ( tdname LIKE 'Y%' OR tdname LIKE 'Z%' )
   AND tdid = 'TXT'.

  PERFORM display_status_text USING stxl-tdname.

  REFRESH tlinetab.
  PERFORM get_text_table  TABLES tlinetab
                           USING 'FORM' 

                                 'TXT' 
                                 stxl-tdname
                        CHANGING subrc.
  LOOP AT tlinetab.
    IF tlinetab-tdline CS string.
      WRITE : / stxl-tdname, tlinetab-tdline.
    ENDIF.
  ENDLOOP.


ENDSELECT.


* Display a message on the status bar
FORM display_status_text USING value(text) TYPE c.
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
      text = text.
ENDFORM.                    "DISPLAY_STATUS_TEXT
*
* Get the long texts for the object
*
FORM get_text_table TABLES tlinetab
USING value(tdobject) LIKE thead-tdobject
value(id) LIKE thead-tdid
value(tdname) LIKE thead-tdname
CHANGING subrc LIKE sy-subrc.

  DATA: BEGIN OF xthead OCCURS 0.
          INCLUDE STRUCTURE thead.
  DATA: END OF xthead.

  DATA: eintraege LIKE sy-tfill.

  DATA xtdname LIKE thead-tdname.
  REFRESH xthead.
  CLEAR xtdname.
  xtdname = tdname.

  CALL FUNCTION 'SELECT_TEXT'
    EXPORTING
      id         = id
      language   = sy-langu
      name       = tdname
      object     = tdobject
    IMPORTING
      entries    = eintraege
    TABLES
      selections = xthead.

  REFRESH tlinetab.

  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id              = id
      language        = sy-langu
      name            = tdname
      object          = tdobject
    IMPORTING
      header          = xthead
    TABLES
      lines           = tlinetab
    EXCEPTIONS
      id              = 01
      language        = 02
      name            = 03
      not_found       = 04
      object          = 05
      reference_check = 06.
  subrc = sy-subrc.
ENDFORM. " FILL_ITEM_TEXT

Tuesday, August 16, 2011

How to change development class of a SAPscript

At times developers develop SAPScript as local object. Unlike reports where we can change the development class using the attributes option , nothing such is available for SAPScripts.

However we can use the program RSWBO052 to change the development class.

Following are the step by step screenshots to change the development class