1 1 1 1 1 Rating 0% (0 Votes)

I had a thought one day to use a code saved in database table for easy change of some calculation rules and I've prepared code to run SE38 like editor for such code. Maybe some of you also had such need, so today I will explain briefly how to do this. I will use FM 'EDITOR_TABLE_WITH_STATUS' to display an editor which you know from SE38/SE80 , 'SAPGUI_SET_FUNCTIONCODE' for setting OK_CODE for editor, 'PRETTY_PRINTER' to make our code looks readable. I will also use one trick that allows you to assign data which is available in calling program but not in our function. But before we need to prepare our own GUI status with some basic buttons like 'Patern' or 'Pretty Printer'.

Add a comment
Read more ...

5 1 1 1 1 1 Rating 100% (1 Vote)

You might have a task to use or download one or all files attached to document saved via CV01N transaction. This is not a big deal really, you just need to use some FMs available in standard of SAP like  'CVAPI_DOC_GETDETAIL''CVAPI_DOC_CHECKOUTVIEW' or  SCMS_DOC_READ'.  These FMs allows you the check the details of document, check it and then read its content. Of course sometimes you'll have to zip the files before the downloading and here in my code I used method "zip" for which code you can find here.  While reading the code you may also find another Z-method called "get_filename_from_path", its code is posted here. The method I'm posting bellow allows you to choose if during download of files from document you want to zip them all together into one zip file or if you want to zip them separatelly. In table ET_FILES you'll find all files that were attached to document, field "UPDATEFLAG" will be set to 'D' if file was succesfully downloaded to PC. If you don't want to download the file but you want to get it for futher use you'll have to request ET_XSTRING table. In other case do not request this parameter as it is a sign for method that you don't want to donwload the files.

Types:

TT_RA_FILENAME type range of CVAPI_DOC_FILE-FILENAME.
TT_XSTRING type table of xstring.

Importing:

I_DOKAR TYPE DRAW-DOKAR ->Document Type
I_DOKNR TYPE DRAW-DOKNR ->Document number
I_DOKTL TYPE DRAW-DOKTL   ->Document Part
I_DOKVR TYPE DRAW-DOKVR  ->Document Version
I_DOWNLOAD_DIRECTORY TYPE STRING -> path to download the fiels
I_ZIP_FILES TYPE C OPTIONAL -> mark it 'X' if you want to zip the files before downloading
I_ZIP_SEPARATELY TYPE C OPTIONAL -> mark it 'X' if you want to zip each file found in document separately
I_NAME_FILTER TYPE TT_RA_FILENAME OPTIONAL -> Range for filter filenames - select which documents you want to download
I_FILENAME TYPE CSEQUENCE OPTIONAL -> filename for zip - used if you zip all files into zip container

Exporting:

ET_FILES TYPE CVAPI_TBL_DOC_FILES -> Table with all files found in document 
ET_XSTRING TYPE TT_XSTRING -> TT_XSTRING -> Table of xstrings (each file in separated line)

Exceptions:

ZIP_ERROR -> Error while zipping
DOCUMENT_ERROR -> Error while reading document

Add a comment
Read more ...

1 1 1 1 1 Rating 0% (0 Votes)

Although our connections are now so fast we may still need sometimes to compress data before attaching to mail or downloading into PC. SAP has possibilities to ZIP the content in class CL_ABAP_ZIP and I've used this class to create a method to simplify the process of zipping.

First of all class CL_ABAP_ZIP is zipping xstrings so I'll provide you the possibility to pass not only xstring variables but also a string, soli_tab or solix_tab. These are commonly used type when coding files content.

Add a comment
Read more ...

5 1 1 1 1 1 Rating 100% (1 Vote)

I guess all of us often had to work with files in ABAP usign some of available FM like 'GUI_UPLOAD', 'GUI_DOWNLOAD' etc. When doing so sometimes there is a need to display in ALV the filename with or without extension . There are plenty of FM that helps to do so but the have one disadvantage -> they base on 3 digit extension and sometimes they have limited path size.

But where stadard SAP cannot help you, then you have to helpyourself with ABAP. There is a really simple way to split filename/extension without any restrictions known from standard FM. Here is a code for a method, but you can use it also to create form or FM. 

Add a comment
Read more ...

1 1 1 1 1 Rating 0% (0 Votes)

You've seen many times that in standard SAP transactions the dates can be presented in days, weeks and months although in database it's saved as normal DATS type. For sure in same table you can find the field called "External date type" which is used to convert standard date to external one. If you're designing a program in which you want to use same functionallity then FM 'PERIOD_AND_DATE_CONVERT_OUTPUT' and 'PERIOD_AND_DATE_CONVERT_INPUT' comes with a help.

Add a comment
Read more ...

ABAP Favorites Eclipse plugin

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client