Saturday, 30 May 2015

Want to Call any URL from ABAP Program?

-------------------------------------------------------------------------------------------------------------------------------
Code:
---------------------------------------------------------------------------------------------------------------
CALL METHOD cl_gui_frontend_services=>execute
  EXPORTING
*   document               =     " Path+Name to Document
    application            'www.google.com'   " Path and Name of Application
*   parameter              =     " Parameter for Application
*   default_directory      =     " Default Directory
*   maximized              =     " Show Window Maximized
*   minimized              =     " Show Window Minimized
*   synchronous            =     " When 'X': Runs the Application in Synchronous Mode
*   operation              = 'OPEN'    " Reserved: Verb für ShellExecute
  EXCEPTIONS
    cntl_error             1
    error_no_gui           2
    bad_parameter          3
    file_not_found         4
    path_not_found         5
    file_extension_unknown 6
    error_execute_failed   7
    synchronous_failed     8
    not_supported_by_gui   9
    OTHERS                 10.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.



---------------------------------------------------------------------------------------------------------------

Step1. cl_gui_frontend_services=>execute method can be used to call any URL. It can be used to call any webdynpro/fpm application from the program as every webdynpro/fpm application have an uniuqe URL.


Step2. Here it calls the URL.







 Step3. Still we can open any document by specifying the appropriate executable file, location of the directory of the file and providing the file name.


Step4. Here is one example how we can open a PDF file by the method cl_gui_frontend_services=>execute.


-------------------------------------------------------------------------------------------------------------------------------

Calling Calculator in ABAP Program!

-------------------------------------------------------------------------------------------------------------------------------
Step1. Call the FM : FITRV_CALCULATOR  to open up the calculator in program.

Step2. User can do any operation .



Step3. At last select the continue button.


Step4. The output/final value of the calculator is displayed in the program list.






-------------------------------------------------------------------------------------------------------------------------------

Reading program text pool!

-------------------------------------------------------------------------------------------------------------------------------

Step1. 'READ TEXTPOOL' reads al text elements/selection texts/program title defined inside a program or in any other program.






Step2. Here is the program title. Execute the program.

Step3. It displays the program title as a part of the text pool.


Step4. Define some text symbols and run the program.



Step5. It displays all the text symbols.


Step6. Define some list heading or selection texts. Execute the report.




Step7. The READ TEXTPOOL statements reads all these and displays as below.

-------------------------------------------------------------------------------------------------------------------------------

How to create a Single Quote ?

-------------------------------------------------------------------------------------------------------------------------------




















------------------------------------------------------------------------------------------------------------------------------

Friday, 29 May 2015

Conversion: Raw to String

------------------------------------------------------------------------------------------------------------------------------
Conversion:  RAW to STRING
Code:
---------------------------------------------------------------------------------------------------------------
DATA lt TYPE TABLE OF zapp_rej_reason,                                                                    
       ls TYPE zapp_rej_reason,                                                                                        
       ls_str TYPE          string,                                                                                           
       lt_str TYPE TABLE OF string,                                                                                    
       ls_x   TYPE          etxml_line_str" rawstring                                                           
                                                                                                                                     
SELECT FROM zapp_rej_reason INTO TABLE lt.                                                            
                                                                                                                                     
LOOP AT lt INTO ls.                                                                                                        
                                                                                                                                     
  ls_x ls-ret_text.                                                                                                        
                                                                                                                                   
      CALL METHOD cl_abap_conv_in_ce=>create                                                            
        EXPORTING                                                                                                            
          input    ls_x                                                                                                    
        RECEIVING                                                                                                            
          conv     data(lr_conv).                                                                                     
                                                                                                                                     
      CALL METHOD lr_conv->read                                                                                    
        IMPORTING                                                                                                              
          data ls_str.                                                                                                        
                                                                                                                                     
  APPEND ls_str TO lt_str.                                                                                              
ENDLOOP.                                                                                                                       
                                                                                                                                     
CLEAR ls_str.                                                                                                               
LOOP AT  lt_str INTO ls_str.                                                                                           
  WRITE :/ ls_str.                                                                                                            
ENDLOOP.                                                                                                                      


---------------------------------------------------------------------------------------------------------------
RAW dictionary data type is similar to hexadecimal .





 Step1. A table that stores raw data.


Step2. Table contents.

Step3. program that converts RAW to STRING.

Step4. So here is the output.

------------------------------------------------------------------------------------------------------------------------------

Thursday, 28 May 2015

Conversions (2) : XSTRING to STRING

-------------------------------------------------------------------------------------------------------------------------------
Conversions : XSTRING to STRING
Code:
---------------------------------------------------------------------------------------------------------------
PARAMETERS str TYPE string.
DATA xstr TYPE xstring,
       strc TYPE string.
" converting string to xstring *
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
  EXPORTING
    text   str
  IMPORTING
    buffer xstr.
WRITE :'string:'str.
WRITE :'xstring:',xstr.
ULINE.
" converting xstring to string *
CALL METHOD cl_abap_conv_in_ce=>create
  EXPORTING
    input xstr    " Input Buffer (X, XSTRING)
  RECEIVING
    conv  DATA(lr_conv).

lr_conv->read(
  IMPORTING
    data    strc ).    " Data Object To Be Read

WRITE :'xstring:'xstr.
WRITE :'string:',strc.
---------------------------------------------------------------------------------------------------------------
Steps.






--------------------------------------------------------------------------------------------------------------------------------

Conversions : XSTRING to STRING

---------------------------------------------------------------------------------------------------------------------------------

Conversions : XSTRING to STRING
Code:
---------------------------------------------------------------------------------------------------------------
PARAMETERS str TYPE string.
DATA xstr TYPE xstring.
* converting string to xstring*
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
  EXPORTING
    text   str " pass the string
*   MIMETYPE       = ' '
*   ENCODING       =
  IMPORTING
    buffer xstr " get the xstring
 EXCEPTIONS
   FAILED 1
   OTHERS 2.

WRITE :'string:'str.
WRITE :'xstring'xstr.

ULINE.
* converting string to string*
data ls_bin type LENGTH 255,
       lt_bin like TABLE OF  ls_bin,
       len type i,
       strc TYPE string.
*converting xstring to binary *
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    buffer     xstr
*   APPEND_TO_TABLE       = ' '
 IMPORTING
    OUTPUT_LENGTH         len
  TABLES
    binary_tab lt_bin.
*converting binary to string *
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
  EXPORTING
    input_length        len
 IMPORTING
   TEXT_BUFFER         strc
  tables
    binary_tab          lt_bin
 EXCEPTIONS
   FAILED              1
   OTHERS              2.

WRITE :'xstring:'xstr.
WRITE :'string:'strc.


---------------------------------------------------------------------------------------------------------------

Steps.






















-------------------------------------------------------------------------------------------------------------------------------

Conversions : STRING to XSTRING

-------------------------------------------------------------------------------------------------------------------------------
Conversion : STRING to XSTRING
Code
--------------------------------------------------------------------------------------------------------------
PARAMETERS str TYPE string.
DATA xstr TYPE xstring.


CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
  EXPORTING
    text   str " pass the string
*   MIMETYPE       = ' '
*   ENCODING       =
  IMPORTING
    buffer xstr " get the xstring
 EXCEPTIONS
   FAILED 1
   OTHERS 2.

WRITE :'string:'str.
WRITE :'xstring'xstr.

------------------------------------------------------------------------------------------------------------





-------------------------------------------------------------------------------------------------------------------------------

Monday, 25 May 2015

SAP Script Important Standard Programs!

-----------------------------------------------------------------------------------------------------------------------------------
  • RSTXCNVR - Converting a SAPscript Standard Text to RAW or ITF Format and Download the File
  • RSTXCPDF- Routines for Converting OTF Format to PDF Format
  • RSTXDBUG- Activate/Deactivate Form Debugger
  • RSTXFDEL-  Delete and Repair the Forms
  • RSTXHTML-Conversion of SAPscript Texts (ITF) to HTML
  • RSTXLDMC - Uploading TIFF Files to SAPscript Texts
  • RSTXSCRP -SAPscript Export to Dataset / SAPscript Import from Dataset
  • RSTXSITF - Report For Unloading an ITF Format to a Dataset
  • RSTXFCAT-  Find Forms
  • RSTXSCAT -Find Styles
  • RSTXTCAT -Find Standard Texts
  • RSTXTRAN -Transfer of SAPscript Texts to a Correction
  • RSTXSCPY - Copy Styles Between Clients
  • RSTXICON - List of SAP icons and their names and SAP numbers 
------------------------------------------------------------------------------------------------------------------------------------

How to use User Parameter ID ?

----------------------------------------------------------------------------------------------------------------------------------
Step1. Go to Tx- SU01













Step2. Provide the user name and click on display.


Step3. Go to Parameters tab. Its displays a list of parameters and the values for the user.



Step4. Open the Tx- VA01.


Step5. The user responsible for creating the sales order of a particular sales organization. The value should come automatically when the user opens Tx- VA01.

Press F1 for the sales Organization field.

Step6. Click on the marked button.

Step7.  Note the Parameter Id.

Step8. Go to the Parameter tab and click on change button.

Step9.  Provide the parameter Id and the value 1000.

Step10. Save it.

Step11. Again lunch the Tx- VA01.

Step12. The sales org value is filled automatically from the parameter ID.



------------------------------------------------------------------------------------------------------------------------------------

Saturday, 23 May 2015

How to call Maintenance View Programatically?

--------------------------------------------------------------------------------------------------------------------------------------
Step1. We have the maintenance view.









Step2. Create a program and call the FM - 'VIEW_MAINTENANCE_CALL' and pass action - U - for change mode or S- display mode and pass the maintenance view name. Execute the program.

Step5. The below output appears.




--------------------------------------------------------------------------------------------------------------------------------------

Comments system

Disqus Shortname