cancel
Showing results for 
Search instead for 
Did you mean: 

Event-related scrambling rule type - Code example?

bruno_esperanca
Contributor
0 Kudos

Hi experts,

I am currently working on an SAP TDMS project which requires me to develop some event-related scrambling rules. As this type of rule doesn't have parameters I'm having trouble understanding how to access the data. I tried to find an example in the forums and searching the internet but I wasn't successful.

Any help will be much appreciated.

Thank you.

Kindest regards,

Bruno Esperança

Edited by: Rob Burbank on Feb 3, 2012 9:37 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Event related rules are to be used for entire record in a table and not for individual fields.

For your need you may want to use domain/field related rules.

bruno_esperanca
Contributor
0 Kudos

First of all, thanks for your reply.

Precisely. The entire record. That's what I want. How do I use it?

That's what that rule type is there for, right?

Bruno

former_member65049
Active Participant
0 Kudos

Hi Bruno,

First of all, let me get it clear that you are trying to use scrambling in TDMS 3.0?

You can apply Event related rule for more than one field at a time.

It applies at the record level and you can change the contents of a complete record using a single rule.

As it does not involve any specific field, you cannot add parameters for an event related rule.

In case you need more help, please open an OSS message.

Our support team would be able to help you.

Thanks and Regards.,

Rupam

bruno_esperanca
Contributor
0 Kudos

Hi Rupam!

Yes, I am using TDMS 3.0.

Thank you very much for your e-mail.

I did not find standard package TDSAD. However, I did find include CNV_MBT_TDSAD_ADDR_SCRAM1 which has the code example for an event-related rule.

Nonetheless, I do have a small concern. This rule was designed to be used by more than one table. Thus, there is a piece of code in the beginning which determines the object (table) that is currently being converted.


  IF g_wa_name IS INITIAL.
* get receiver structure name of the current conv. obj.:

*    CONCATENATE g_dmc_cobj_guid ' = ''' g_dmc_cobj_guid_val
*      '''' INTO g_where_clause_dmc_cobj.

    CONCATENATE g_dmc_cobj_guid ' = ''' _GUID_COBJ
      '''' INTO g_where_clause_dmc_cobj.

    SELECT SINGLE (g_dmc_cobj_rcontainer) FROM (g_dmc_cobj_tabname)
        INTO g_dmc_cobj_rcontainer_into WHERE (g_where_clause_dmc_cobj).

    CONCATENATE g_dmc_stree_container ' = '''
      g_dmc_cobj_rcontainer_into''''
      ' AND' g_dmc_stree_seqnum ' = ''' g_dmc_stree_seqnum_val''''
      ' AND' g_dmc_stree_struclevel ' = ''' g_dmc_stree_struclevel_val
      '''' INTO g_where_clause_dmc_stree.

    SELECT SINGLE (g_dmc_stree_guid) FROM (g_dmc_stree_tabname)
        INTO g_dmc_stree_guid_into WHERE (g_where_clause_dmc_stree).

    CONCATENATE g_dmc_struct_stree ' = ''' g_dmc_stree_guid_into
         '''' INTO g_where_clause.

    SELECT SINGLE (g_dmc_struct_ident) FROM (g_dmc_struct_tabname)
        INTO g_structname WHERE (g_where_clause).

*  select single ident from dmc_struct into g_structname
*    where stree = ( select GUID FROM dmc_stree WHERE container =
*  ( select RCONTAINER FROM dmc_cobj WHERE guid = _guid_cobj )
*      AND seqnum = '0001' AND struclevel = '01' ).
    CONCATENATE '_WA_' g_structname INTO g_wa_name.
    ASSIGN (g_wa_name) TO <g_wa_name>.
  ENDIF.

As you can see this has some selects in it, and I'm affraid these selects might be executed for each record of each table. So, in a performance point of view, this might not be so good...

Is there a reason why I shouldn't use one rule per table, and therefore disregard this piece of code?

Thank you very much!

Bruno

EDIT:

From what I understood from the code, this is a code example if I assume I'm scrambling table ADRC:


ASSIGN ('_WA_R_ADRC') TO <g_wa_name>.
ASSIGN COMPONENT 'NAME1' OF STRUCTURE <g_wa_name> TO <g_name1>.

Does this make sense to you?

Thanks.

bruno_esperanca
Contributor
0 Kudos

Actually, even better, if I assume I'm scrambling table ADRC I do not have to use 'ASSIGN COMPONENT' as I can use a typed field-symbol, thus simplifying my code a lot! (Correct me if I'm wrong)

Bruno

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi experts and Bruno:

I'm also working on event related rules and still not figuring out the followings:

  1. Since export/import parameter are not able to defined in event-related rules, how do rules to access the tables that need to be scrambled and export the outcome?
  2. Is there any extra setup for event-related rules in Scramble-UI once it has been activated?
  3. Is there any event-related rules example for reference?

It would be very nice if you can share your experience, thanks

Leon

bruno_esperanca
Contributor
0 Kudos

Hi Leon!

What version of TDMS are you using? In my version (3.0) I have the following include available CNV_MBT_TDSAD_ADDR_SCRAM1

Please go into TX SE38 in your system and try viewing this include. This is SAP's standard example.

If you are scrambling only one table per scrambling rule the following code works perfectly:

  

DATA: LV_ALPHA(255).

FIELD-SYMBOLS:

<LF_MAKT>,

<LF_MAKTX>,

<LF_MAKTG>.

ASSIGN ('_WA_R_MAKT') TO <LF_MAKT>.

CHECK <LF_MAKT> IS ASSIGNED.

ASSIGN COMPONENT 'MAKTX' OF STRUCTURE <LF_MAKT> TO <LF_MAKTX>.

ASSIGN COMPONENT 'MAKTG' OF STRUCTURE <LF_MAKT> TO <LF_MAKTG>.

 

IF <LF_MAKTX> IS ASSIGNED

AND <LF_MAKTX> IS NOT INITIAL.

CALL METHOD ZCL_SCRAMBLE=>RND_ALPHA_DOM

EXPORTING I_DOMNAME = 'TEXT40'

IMPORTING E_ALPHA = LV_ALPHA.

<LF_MAKTX> = LV_ALPHA.

ENDIF.

 

IF <LF_MAKTG> IS ASSIGNED

AND <LF_MAKTG> IS NOT INITIAL.

CALL METHOD ZCL_SCRAMBLE=>RND_ALPHA_DOM

EXPORTING I_DOMNAME = 'CHAR40'

IMPORTING E_ALPHA = LV_ALPHA.

<LF_MAKTG> = LV_ALPHA.

ENDIF.

Good luck.