Blogs

ABAP/4 Example Code: Download OTF Spool to PDF

*** This program receive spool id and destination file name ***
DATA: it_pdf TYPE TABLE OF TLINE WITH HEADER LINE,
      gv_string TYPE string.

PARAMETERS: p_spool LIKE TSP01-RQIDENT,
            p_file LIKE RLGRAP-FILENAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION ’KD_GET_FILENAME_ON_F4’
    EXPORTING
*     PROGRAM_NAME        = SYST-REPID
*     DYNPRO_N

Google Inc. and eBay Inc.'s Skype are investing in a startup that plans to help hotspot owners charge for Wi- Fi access, a plan that could face significant opposition from Internet service providers.WCNC.com | News for Charlotte, N.C. | U.S. News

Bandwidth Minimization Problem

My colleague has organized Windows Supercomputing Contest 2006 at Kasetsart University. It is a kind of MPI programming contest but all codes must be compiled and ran on Windows Compute Cluster Server 2003. Anyway, this contest is just the first time so he made focus on students inside Kasetsart University including all bachelor degrees from 1st to 4th year. However, all competitors had to attend a short 2-day training course to learn basic of parallel programming and how to implement MPI application especially for Windows Cluster. The contest problem is to write a program to solve specified problem in 3 weeks at home.

How to define macro in ABAP/4

We can define macro by apply statement DEFINE ... END-OF-DEFINITION.

Example


DATA: itab TYPE TABLE OF sflight WITH HEADER LINE.
RANGES: r_carrid FOR sflight-carrid.
DEFINE append_range.
  &1-sign = &2.
  &1-option = &3.
  &1-low = &4.
  append &1.
END-OF-DEFINITION.
INITIALIZATION.
  append_range r_carrid ’I’ ’EQ’ ’AA’.
  append_range r_carrid ’I’ ’EQ’ ’AB’.
START-OF-SELECTION.
  SELECT * FROM sflight INTO TABLE itab
           WHERE carrid in r_carrid.
  IF SY-SUBRC = 0.
    LOOP AT itab.
      WRITE:/ itab-carrid, itab-connid, itab-fldate.
    ENDLOOP.
  ENDIF.
Note: You can define parameters only 9 (&1 ...

ABAP/4 Example Code: How to call SAPscript form from ABAP report

Now we already have SAPscript form name ’ZFORM001’ and in this form we have element ’LINE1’ on window ’MAIN’. We want to call this form from ABAP report.

Example:


START-OF-SELECTION.
  PERFORM OPEN_FORM.
  PERFORM START_FORM.
  PERFORM WRITE_FORM USING ’LINE1’.
  PERFORM END_FORM.
  PERFORM CLOSE_FORM.

*&---------------------------------------------------------------------*
*&      Form  OPEN_FORM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM OPEN_FORM .
  CALL FUNCTION ’OPEN_FORM’
*   EXPORTING
*     APPLICATION                       = ’TX’
*     ARCHIVE_INDEX                     =
*     ARCHIVE_PARAMS                    =
*     DEVICE                            = ’PRINTER’
*     DIALOG                            = ’X’
*     FORM                              = ’ ’
*     LANGUAGE                          = SY-LANGU
*     OPTIONS                           =
*     MAIL_SENDER                       =
*     MAIL_RECIPIENT                    =
*     MAIL_APPL_OBJECT                  =
*     RAW_DATA_INTERFACE                = ’*’
*     SPONUMIV                          =
*   IMPORTING
*     LANGUAGE                          =
*     NEW_ARCHIVE_PARAMS                =
*     RESULT                            =
   EXCEPTIONS
     CANCELED                          = 1
     DEVICE                            = 2
     FORM                              = 3
     OPTIONS                           = 4
     UNCLOSED                          = 5
     MAIL_OPTIONS                      = 6
     ARCHIVE_ERROR                     = 7
     INVALID_FAX_NUMBER                = 8
     MORE_PARAMS_NEEDED_IN_BATCH       = 9
     SPOOL_ERROR                       = 10
     CODEPAGE                          = 11
     OTHERS                            = 12
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ABAP/4 Example Code: SAVE_TEXT

You can create and save long text by apply function module ’SAVE_TEXT’.

Example: We will create program for create standard text. The created text will be contained text ’Test Create Text’. you can input name of long text on selection screen. After you run this program, you can check the output of program in transaction SO10 (Standard Text).


DATA: GW_THEAD LIKE THEAD,
      IT_LINE TYPE TABLE OF TLINE WITH HEADER LINE.
PARAMETERS: P_TXTNAM LIKE THEAD-TDNAME.
START-OF-SELECTION.