Tuesday, November 24, 2009

Set Listbox Values At Selection Screen

When you hit F8 , the p_par will have the key fields value of selected list item.

*** Type Pool
type-pools : vrm.
.
.
*** Her's the definition of listbox parameter
parameters : p_par type mara-mtart as listbox visible length 15.
.
.

*** Event Block
at selection-screen output.
  perform at_sel_output.

.
.
.

*&---------------------------------------------------------------------*
*&      Form  at_sel_output
*&---------------------------------------------------------------------*
form at_sel_output.

  data : lt_list  type vrm_values with header line .

  lt_list-key = 'K1'.
  lt_list-text = ' First One'.
  append lt_list.
  lt_list-key = 'K2'.
  lt_list-text = ' Second One'.
  append lt_list.
  lt_list-key = 'K3'.
  lt_list-text = ' Third One'.
  append lt_list.

  call function 'VRM_SET_VALUES'
    exporting
      id              = 'P_PAR'
      values          = lt_list[]
    exceptions
      id_illegal_name = 1
      others          = 2.

endform.                    "at_sel_output

Thursday, November 19, 2009

Get print parameters and submit report to sap spool

      DATA: p_parameters TYPE pri_params,
            a_parameters TYPE arc_params,
            valid(1).

      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          archive_mode           = '1'  " Just print
        IMPORTING
          out_parameters         = p_parameters
          out_archive_parameters = a_parameters
          valid                  = valid
        EXCEPTIONS
          invalid_print_params   = 2
          OTHERS                 = 4.

      CHECK valid EQ 'X'.

  SUBMIT zz_your_report_name WITH p_submit EQ 'X'               
                 TO SAP-SPOOL
                 SPOOL PARAMETERS p_parameters
                 ARCHIVE PARAMETERS a_parameters
                 WITHOUT SPOOL DYNPRO.

Sunday, November 15, 2009

Smartforms related standart demo programs

SF_BATCH_GENERATE              Program for Generating SMART FORMS in Batch
SF_EXAMPLE_01                         Sample Program for Form Printing Using Smart Forms
SF_EXAMPLE_01_BACKUP       Sample Program for Form Printing Using Smart Forms
SF_EXAMPLE_02                         Sample Program for Form Printing Using Smart Forms
SF_EXAMPLE_02_BACKUP       Sample Program for Form Printing Using Smart Forms
SF_EXAMPLE_03                         Sample Program for Form Printing Using Smart Forms
SF_EXAMPLE_03_BACKUP       Sample Program for Form Printing Using Smart Forms
SF_TOTALS                                  Examples for Totalling Different Currencies
SF_XSF_DEMO                            Smart Forms: XSF Output - Demo Program
SF_XSF_DEMO_MAIL                Send Form and Graphics by E-Mail
SF_XSF_DEMO2
SF_XSF_DEMO3

Wednesday, November 11, 2009

Display / Delete Application log (Bal Log)

*** Delete Given log
         call function 'BAL_DB_DELETE'
            exporting
              i_t_lognumber            = lognumber
              i_in_update_task         = space
              i_with_commit_work       = space
            exceptions
              no_logs_specified        = 1
              others                   = 2.


*** Display Given logs

      data: begin of lt_log occurs 10,
              lognumber like balhdr-lognumber,
            end of lt_log.


      refresh lt_log.
      lt_log-lognumber = lognumber . " log
      append lt_log.


      call function 'APPL_LOG_DISPLAY_WITH_LOGNO'
        tables
          lognumbers   = lt_log
        exceptions
          no_authority = 1
          others       = 2.
      if sy-subrc NE 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.

Tuesday, November 3, 2009

IDOC Data Display and Delete

There are two usefull functions for display and delete IDOC data.

First function which displays a single idoc data is no different than we02 transaction. It displays idoc data using a tree structure.

      call function 'EDI_DOCUMENT_DATA_DISPLAY'
        exporting
          docnum               = gv_docnum
        exceptions
          no_data_record_found = 1
          others               = 2.
      if sy-subrc NE 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.






The ohter function which deletes given idoc data helps you to remove idoc related data from edidc , edids and
edi40 (OR edi30c OR edidoc , for older versions) . However you can do it using we11 transaction. Using the standart reports is always recomended. There may be much more idoc related data to remove like application log. Here i just give you an opinion about the function modules behaviour.

          call function 'EDI_DOCUMENT_DELETE'
          exporting
            document_number        = gv_docnum
          exceptions
            idoc_does_not_exist    = 1
            document_foreign_lock  = 2
            idoc_cannot_be_deleted = 3
            not_all_tables_deleted = 4
            others                 = 5.
        if not sy-subrc is initial.
          message id sy-msgid type 'I' number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.