Posts

SAP ABAP - Remove Special Character With Regex

Image
REPORT yregex. DATA mystring1 TYPE string. DATA mystring2 TYPE string. mystring1 = 'mystringa)aksak*1<>!@#$%^&*()~'. mystring2 = 'mystringa)aksak*1<>!@#$%^&*()~'. REPLACE ALL OCCURRENCES OF REGEX '[^0-9a-zA-Z]+' IN mystring2 WITH space. WRITE:/ mystring1. WRITE:/ mystring2.

SAP ABAP - Upload G/L Account (FS00) Custom Program

Image
Custom Structure for program Screen Element List Screen FLow Logic Gui Status Download template  Here   TYPES:   BEGIN OF ty_excel,     bukrs      TYPE bukrs,     saknr      TYPE saknr,     glacc_type TYPE char1,     ktoks      TYPE ska1-ktoks,     txt20      TYPE txt20,     txt50      TYPE txt50,     waers      TYPE waers,     kdfsl      TYPE skb1-kdfsl,     bewgp      TYPE skb1-bewgp,     mwskz      TYPE skb1-mwskz,     xmwno      TYPE skb1-xmwno,     mitkz      TYPE skb1-mitkz,     altkt      TYPE skb1-altkt,     infky      TYPE skb1-infky,     togru      TYPE skb1-togru,     zuawa      TYPE skb1-zuawa,     fstag      TYPE skb1-fstag,     xintb      TYPE skb1-xintb,     xnkon      TYPE skb1-xnkon,     xmitk      TYPE skb1-xmitk,     fdlev      TYPE skb1-fdlev,     xgkon      TYPE skb1-xgkon,     hbkid      TYPE skb1-hbkid,     hktid      TYPE skb1-hktid,   END OF ty_excel,   BEGIN OF ty_data,     icons      LIKE icon-id,     snote      TYPE char255,     ccell      TYPE lvc_t_scol,  

SAP ABAP - PDF Viewer From Application Server Directory

Image
  AL11 REPORT ysap_pdf_viewer. DATA : lt_data TYPE TABLE OF x255. DATA : wa_line TYPE x255. DATA: lo_docking_container TYPE REF TO cl_gui_docking_container. DATA: lo_html    TYPE REF TO cl_gui_html_viewer. DATA: lv_url TYPE char255. DATA: ok_code(20). DATA filename TYPE string. PARAMETERS fname TYPE localfile. ** Selection screen value request AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname.   CALL FUNCTION 'KD_GET_FILENAME_ON_F4'     EXPORTING       static    = 'X'     CHANGING       file_name = fname.   IF sy-subrc <> 0. * Implement suitable error handling here   ENDIF. START-OF-SELECTION.   filename = '/usr/sap/attachment/'. "AL11 Directory   filename = |{ filename }{ fname }|. * Read PDF File   PERFORM read_file. * Display to screen   PERFORM display_pdf. *&---------------------------------------------------------------------* *&      Form  read_file *&---------------------------------------------------------------------* *       text *

SAP ABAP - Upload File to OneDrive Folder

Image
  REPORT yupload_file. ** Data Declarations DATA: gv_filename    TYPE string,       lt_data_tab    TYPE TABLE OF x255,       lv_bin_size    TYPE i,       lv_file        TYPE string,       e_filenamefull TYPE string,       e_filename     TYPE string,       e_extension    TYPE string. DATA:   lv_e_pathname TYPE rstxtlg, "   lv_i_filepath TYPE rsfilenm, "   lv_e_filename TYPE rsawbnobjnm. " ** Parameters PARAMETERS : gv_name TYPE localfile. ** Selection screen value request AT SELECTION-SCREEN ON VALUE-REQUEST FOR gv_name.   CALL FUNCTION 'KD_GET_FILENAME_ON_F4'     EXPORTING       static    = 'X'     CHANGING       file_name = gv_name.   IF sy-subrc <> 0. * Implement suitable error handling here   ENDIF. START-OF-SELECTION.   PERFORM upload_attachment. FORM upload_attachment.   CLEAR : lv_i_filepath.   gv_filename   = gv_name.   lv_i_filepath = gv_name. ** upload the file data from desktop/localfile   CALL FUNCTION 'GUI_UPLOAD'     EXPOR

SAP ABAP - Multiple Header ALV List

REPORT ZALV_LIST_MULTIHEADER NO STANDARD PAGE HEADING. TYPE-POOLS: slis. DATA :t_fieldcat TYPE slis_t_fieldcat_alv,       w_fieldcat TYPE slis_fieldcat_alv,       layout     TYPE slis_layout_alv,       t_sort     TYPE slis_t_sortinfo_alv,       t_event    TYPE slis_t_event WITH HEADER LINE,       d_repid    LIKE sy-repid,       d_layout   TYPE slis_layout_alv,       key        TYPE slis_keyinfo_alv. TYPES : BEGIN OF ty_data,           store(50),           price      TYPE dmbtr,           quantity   TYPE p,           total      TYPE dmbtr, "(10) TYPE p DECIMALS 2,           price2     TYPE dmbtr,           quantity2  TYPE p,           total2     TYPE dmbtr, "(10) TYPE p DECIMALS 2,           curr       TYPE waers,         END OF ty_data. DATA : t_data TYPE ty_data OCCURS 0 WITH HEADER LINE. START-OF-SELECTION.   PERFORM f_process_data.   PERFORM f_write_data. *&---------------------------------------------------------------------* *&      Form  F_PROCESS_DATA *&---

SAP ABAP - Display Message in Popup Table

Image
*&---------------------------------------------------------------------* *& Report YBULK_MESSAGE *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ybulk_message. TYPES: BEGIN OF ty_message,          msgid  LIKE sy-msgid,          msgty  LIKE sy-msgty,          msgno  LIKE sy-msgno,          msgv1  LIKE sy-msgv1,          msgv2  LIKE sy-msgv2,          msgv3  LIKE sy-msgv3,          msgv4  LIKE sy-msgv4,          lineno LIKE mesg-zeile,        END OF ty_message. DATA:   lt_message TYPE TABLE OF ty_message. START-OF-SELECTION.   PERFORM display_message. FORM display_message.   REFRESH lt_message.   lt_message = VALUE #(        ( msgid = 'FB'          msgty = 'E'          msgno = '000'          msgv1 = 'Material XXX01'          msgv2 = 'Not'          msgv3 = 'Found'          msgv4 = ''          lineno = '1