Downloading Internal Table as a ZIP file on the Presentation Server

DATA : lt TYPE TABLE OF scarr, ls TYPE scarr, lv_string TYPE string, lv_xstring TYPE xstring, lr_zip TYPE REF TO cl_abap_zip, lt_bin TYPE TABLE OF x255. START-OF-SELECTION.   SELECT * FROM scarr INTO TABLE lt.   LOOP AT lt INTO ls.     CONCATENATE lv_string ls INTO lv_string SEPARATED BY cl_abap_char_utilities=>newline.   ENDLOOP. * Convert String to X String CALL FUNCTION ‘SCMS_STRING_TO_XSTRING’ EXPORTING text   = lv_string IMPORTING buffer = lv_xstring. CREATE OBJECT lr_zip. * Add teh X String as a Zip file CALL METHOD lr_zip->add EXPORTING name    = ‘flight’ content = lv_xstring. CALL METHOD lr_zip->save RECEIVING

Continue reading

Rate this:

Locking DB table in SAP by Standard Function Module

PARAMETERS : p_table TYPE  tabname. * FM to lock a table CALL FUNCTION ‘ENQUEUE_E_TABLE’ EXPORTING mode_rstable   = ‘E’ tabname        = p_table *   VARKEY         = *   X_TABNAME      = ‘ ‘ *   X_VARKEY       = ‘ ‘ *   _SCOPE         = ‘2’ *   _WAIT          = ‘ ‘ *   _COLLECT       = ‘ ‘ EXCEPTIONS foreign_lock   = 1 system_failure = 2 OTHERS         = 3. IF sy–subrc = 0. MESSAGE ‘Table locked’ TYPE ‘I’. ENDIF. * FM to unlock the table CALL FUNCTION ‘DEQUEUE_E_TABLE’ EXPORTING mode_rstable = ‘E’ tabname      = p_table *   _COLLECT     = ‘ ‘

Continue reading

Rate this:

Function Module that provides details of a table

PARAMETERS : p_table TYPE dfies–tabname DEFAULT ‘VBAK’. DATA : lt TYPE TABLE OF dfies, ls_layout TYPE slis_layout_alv. * FM that provides details of a Table CALL FUNCTION ‘DDIF_NAMETAB_GET’ EXPORTING tabname   = p_table status    = ‘A’ TABLES dfies_tab = lt. ls_layout–colwidth_optimize = ‘X’. CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’ EXPORTING i_callback_program = sy–repid i_structure_name   = ‘DFIES’ is_layout          = ls_layout TABLES t_outtab           = lt.      

Continue reading

Rate this:

FOR Loop in ABAP

DATA : lt1 TYPE TABLE OF spfli. SELECT * FROM spfli INTO TABLE lt1. LOOP AT lt1 ASSIGNING FIELD–SYMBOL(<fs1>). WRITE :/ <fs1>–carrid, <fs1>–connid, <fs1>–cityfrom, <fs1>–cityto. ENDLOOP. ULINE. TYPES : lt2 TYPE TABLE OF spfli WITH EMPTY KEY. DATA(lt2) = VALUE lt2( FOR ls IN lt1 WHERE (  carrid = ‘LH’ ) ( carrid = ls–carrid connid = ls–connid cityfrom = ls–cityfrom cityto = ls–cityto ) ). LOOP AT lt2 ASSIGNING FIELD–SYMBOL(<fs2>). WRITE :/ <fs2>–carrid, <fs2>–connid, <fs2>–cityfrom, <fs2>–cityto . ENDLOOP. The FOR Loop runs on the table LT1 with

Continue reading

Rate this:

1 55 56 57 58 59 113