Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🏭 generate Markdown table from internal table or structure in ABAP

License

NotificationsYou must be signed in to change notification settings

Keller-Michael/markdown_from_table_or_structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

Executable classes (F9) and theABAP Development Tools console as an output area for information are particularly useful when using the SAP Business Technology Platform (SAP BTP). With thisexample class you are able to generate aMarkdown table from an internal table or structure in your ABAP code.

The advantage is that a Markdown table can be easily prepared and processed: You can use online editors such asDillinger or offline editors such asVisual Studio Code with suitable plugins such as "Markdown All in One" and "Markdown Emoji". Not to forget: Markdown plays a huge role on GitHub 😉

Example

Here are some example calls to generate a Markdown table from a structure (example 1), from internal table (example 2) and from BAPI messages (example 3).

METHODif_oo_adt_classrun~main.DATA markdown_table TYPE string_table.DATA(markdown)= zmke_cl_markdown=>get_instance( )." example 1SELECTSINGLE*FROM I_currencyINTO @DATA(currency).  markdown_table= markdown->generate_from_structure(currency ).  out->write( markdown_table )." example 2SELECT*FROM I_CurrencyINTO TABLE @DATA(currencies).  markdown_table= markdown->generate_from_table( currencies ).  out->write( markdown_table )." example 3DATA(bapi_messages)=VALUE bapirettab( ( type='E'id='SY'number='499' message_v1='Hi' message_v2='there!' )                                          ( type='A'id='SY'number='499' message_v1='Hi' message_v2='there!' )                                          ( type='I'id='SY'number='499' message_v1='Hi' message_v2='there!' )                                          ( type='W'id='SY'number='499' message_v1='Hi' message_v2='there!' )                                          ( type='S'id='SY'number='499' message_v1='Hi' message_v2='there!' ) ).    markdown_table= markdown->generate_from_bapi_return( bapi_messages ).    out->write( markdown_table ).ENDMETHOD.

Here's the result for example 1:

FieldValue
CURRENCYAED
DECIMALS2
CURRENCYISOCODEAED
ALTERNATIVECURRENCYKEY784
ISPRIMARYCURRENCYFORISOCRCY

Here's the result for example 2 (showing only two entries, there are more):

CURRENCYDECIMALSCURRENCYISOCODEALTERNATIVECURRENCYKEYISPRIMARYCURRENCYFORISOCRCY
AED2AED784
AFN2AFN971
ALL2ALL008

Here's the result for example 3:

ICONTYPEIDNUMBERMESSAGELOG_NOLOG_MSG_NOMESSAGE_V1MESSAGE_V2MESSAGE_V3MESSAGE_V4PARAMETERROWFIELDSYSTEM
🔴ESY499000000Hithere!0
🔴ASY499000000Hithere!0
🟡ISY499000000Hithere!0
🟡WSY499000000Hithere!0
🟢SSY499000000Hithere!0

Notice

I stumbled across some problems during development involving non-released development objects for SAP BTP, specifically methods of typical classes like CL_ABAP_STRUCTDESCR (really missing GET_DDIC_FIELD_LIST). In an on-premises system, some things such as the column headings of the Markdown table could certainly be designed better (CamelCase).

More important note is that I didn't implement any suitable error handling. Maybe someone wants to add that to this project? 😉

About

🏭 generate Markdown table from internal table or structure in ABAP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp