Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Programatically checking syntax errors for DDIC objects

Former Member
0 Likes
5,554

Hello experts,

I am faced with a task wherein I may be given an object of ANY type i.e. the object type (E071-OBJECT) can be anything and I have to programatically check if it has any syntax errors/warnings. I am aware of previous posts like - http://scn.sap.com/thread/1262153. But these deal with objects that have a source code (like reports, function groups, includes etc). How do I go about doing the syntax check programatically for DDIC objects like tables (TABL), table types (TTYP), domains (DOMA), data elements (DTEL) etc. I tried debugging how SAP does the syntax check of a table/table type etc and tried mimicing the same, but could not succeed.

Any suggestions/ideas?

1 ACCEPTED SOLUTION
Read only

laurent_fournier2
Contributor
0 Likes
4,693

Hi,

Try Using Function " RS_DDIC_CHECK ".

Regards.

17 REPLIES 17
Read only

laurent_fournier2
Contributor
0 Likes
4,694

Hi,

Try Using Function " RS_DDIC_CHECK ".

Regards.

Read only

0 Likes
4,693

Hi Laurent,

Yes, I am aware of RS_DDIC_CHECK. The problem is: This function module directly displays the error log like the following screenshot:

I don't want this display. I want just the internal table with the error and warning messages if any. In fact I entered /h in the command bar and pressed Ctrl+F2, to find how SAP does the syntax check. But I wasn't able to identify where this error log (internal table) is getting generated.

Read only

0 Likes
4,693

Well, SAP uses the same to get the Syntax check done.

You can call this in a Temporary program or Subroutine Pool and Export the list ot memory.

1) Create a Temporary program using INSERT REPORT or Generate Subroutine Pool and Call the FM inside.

2) Run DELETE REPORT to delete the Temp report.

3) Read the list from Memory to an Internal table.

Thanks,

Shambu

Read only

0 Likes
4,693

Hi Shambu,

I must confess I don't have a lot of experience and therefore did not understand the steps that you mentioned. Can you please be a little more elaborate. Just take an example of an object of type TABL and explain. I don't expect you to give the full code. Just give small code snippets/pseudocode of the main steps involved. It would be very helpful.

Thanks for your time and effort.

Read only

0 Likes
4,693

Run this piece.

  DATA : itab TYPE TABLE OF string WITH HEADER LINE,

prog TYPE sy-repid,

gt_list TYPE TABLE OF abaplist,

gt_txtlines TYPE STANDARD TABLE OF char1024,

iv_logname_memory LIKE tstrf01-filename,

enqtype LIKE rsdeo-objtype,

pt_lines TYPE TABLE OF trlog,

lt_log LIKE trlogm OCCURS 0.

* Create Report

itab = 'REPORT yactiv1.'.

APPEND itab.

itab = 'PARAMETERS : p_name TYPE rsedd0-ddobjname,'.

APPEND itab.

itab = ' p_type TYPE rsedd0-ddobjtype.'.

APPEND itab.

itab = `CALL FUNCTION 'RS_DD_CHECK'`.

APPEND itab.

itab = ' EXPORTING'.

APPEND itab.

itab = ' objname = p_name'.

APPEND itab.

itab = ' objtype = p_type.'.

APPEND itab.

itab = 'DATA : iv_logname_memory LIKE tstrf01-filename,'.

APPEND itab.

itab = ' enqtype LIKE rsdeo-objtype, '.

APPEND itab.

itab = ' pt_lines TYPE TABLE OF trlog,'.

APPEND itab.

itab = ' lt_log LIKE trlogm OCCURS 0.'.

APPEND itab.

itab = ` CALL FUNCTION 'INTERN_TRANSL_EUTYPE' `.

APPEND itab.

itab = ' EXPORTING'.

APPEND itab.

itab = ' eutype = p_type'.

APPEND itab.

itab = ' IMPORTING'.

APPEND itab.

itab = ' enqueue_type = enqtype.'.

APPEND itab.

itab = ` CONCATENATE 'CHE' enqtype p_name INTO iv_logname_memory.`.

APPEND itab.

itab = ' IMPORT lt_log FROM MEMORY ID iv_logname_memory.'.

APPEND itab.

itab = `EXPORT lt_log TO MEMORY ID 'TEST'.`.

APPEND itab.

prog = 'YACTIV1'.

 

* Insert Temp report

 

INSERT REPORT prog FROM itab.

SUBMIT yactiv1 WITH p_name = 'MARA'

WITH p_type = 'T'

EXPORTING LIST TO MEMORY

AND RETURN.

 

* Get Output table

 

IMPORT lt_log FROM MEMORY ID 'TEST' .

 

* Convert to readable format

 

CALL FUNCTION 'TRINT_CONVERT_LOG'

TABLES

it_log = lt_log

et_lines = pt_lines.

DELETE REPORT prog.

The table PT_LINES will have the messages.

Here I have given constant values to the Submit statement. You can pass values dynamically for your requirement.

Thanks,

Shambu

Read only

0 Likes
4,693

Why did you created the program at runtime exactly? Is there any advantage for this?

Read only

0 Likes
4,693

Well, when you run the FM 'RS_DD_CHECK' it does the syntax check and writes the comment into a list as you can see in the above screen shot.

He doesnt need that list to be displayed, and there is not option to turn it off in the FM also.

The only option was to call this FM in a Temp prog and exporting the list to memory without displaying the output.

Thanks,

Shambu

Read only

0 Likes
4,693

Shambu,

That worked !!!. Thanks a million. This was a big problem for me but you solved it in a very simple and elegant manner. I greatly appreciate your time and effort involved in creating the sample code. 

Your conceptual clarity and breadth of knowledge is amazing. Keep up your great work in the forum.

Read only

0 Likes
4,693

Hi Shambu,

I have a question that is closely related to this thread. That is the reason I am replying to you even though the thread is closed.

What exactly is the difference between the following object types:

TABL and TABD.  (R3TR TABL = Table ,  LIMU TABD = Table Definition)

DOMA and DOMD (R3TR DOMA = Domain,  LIMU DOMD = domain definition)

DTEL and DTED (R3TR DTEL = Data Element,  LIMU DTED = Data Element Definition).

And how do can I do the syntax checks for these object types (i.e . LIMU TABD, LIMU DOMD etc)

Thanks for your time and effort.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,693

So you tried to debug TRINT_INSPECT_OBJECTS ?

Regards,

Raymond

Read only

0 Likes
4,693

Hi Raymond,

No I did not debug the function module that you mentioned. I entered "/h" in the command field and then hit Ctrl+F2 to see how SAP does the syntax check, with the hope that I could mimic it. But I could not find where exactly the log (with all the error and warning messages) is getting filled/populated.

Anyway, I did not understand much about TRINT_INSPECT_OBJECTS. Could you please explain what it does - ie I see that I must pass the TR/Task no (which is very close to what I need). But what exactly does it return? What are the output params - EV_CURRENT EV_ERROR_TYPE ? Could you please explain a bit?

Read only

0 Likes
4,693

This FM can return you flags indicating an error, internally it use SCI, try to call this FM with SAT/SE30 to find how SCI is called.

(If you are not able to follow the debug/trace, jump to class CL_CI_TRANSPORT_CHECK)

Regards,

Raymond

Read only

Former Member
0 Likes
4,693

Hi,

Run RS_DD_CHECK function module with the Object name and Type.

Check the domain values of OBJTYP for allowed values.

Thanks,

Shambu

Read only

0 Likes
4,693

Hi Shambu,

Please see my reply to Laurent Fournier . RS_DD_CHECK actually displays the errors/warnings in the same the GUI would if you were to hit CTRL+F2. I dont want it to display anything. I just want the internal table having the error and warning messages.

Thanks for your time. Any other advice?

Read only

Former Member
0 Likes
4,693

Why do you need to create a custom program to do something that SAP provides.

Google for "Source Code Inspector". You can get your DDIC checked.

The transaction is SCI.

Read only

0 Likes
4,693

Hi Chinmay,

Well..that is my requirement. Like it or not...I have to do it. The customer has asked for this functionality. Basically the customer wants a program that is similar to SE09 (and does slightly more than se09). ie. the code must take in a TR No., and display all objects registered under it and specify for each object its active/inactive status and syntax check result. All this must be automated and displayed in an ALV. Is there a way I can call the SCI transaction and pass the object name, object type to it and get an internal table that has errors/warning messages etc....Again I don't want the SCI transaction to "display " those messages. I just want the internal table of errors and warnings.

Read only

0 Likes
4,693

Yes, SCI Allows it.

I just dont want someone to work really hard towards reinventing the wheel.

Anyway, All the best.