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

DS:REPN Parameters

Juwin
Active Contributor
0 Likes
3,680

HI ABAPers,

Is there a way to pass parameters to the following identifiers in a message longtext/ documentation?

DS:TRAS - Link to transaction and skip first screen

DS:REPN - Online execution of report with parameter selection

DS:REPO - Online execution of report


Thanks,

Juwin Pallipat Thomas

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
2,935

There is a way to pass the values to the underlying called object.

For Transaction DS:TRAN, you can pass the values using the parameter ID. The syntax would be


<DS:TRAN.MM03(MAT.&SYST-MSGV1&)>Material Master</>

MAT is the material parameter ID

The values is being passed in the message variable &SYST-MSGV1& -- The message is (Material &1 has low stock.).

So, calling message with this sample, TEST_NP would be sent to MM03:


DATA: lv_matnr TYPE mara-matnr.

lv_matnr = 'TEST_NP'.

MESSAGE i002(z_testmessage) WITH lv_matnr.

For reports DS:REPO, you would need to use the variant to send the value.


<DS:REPO.RM07DOCS.VARI1>Material Documents</>

RM07DOCS is the report

VARI1 is the variant, separated by a dot

To use this, you can create the temporary variant in the report using the variant FMs and delete it after the message is issued.

Regards,
Naimesh Patel

13 REPLIES 13
Read only

deepan_v_s
Active Participant
0 Likes
2,935

Hello Juwin,

Can you please explain the requirement clearly ??

Read only

Juwin
Active Contributor
0 Likes
2,935

While defining a long text for a message, I can insert a link to a transaction or report in the text. But, how can pass parameters from the message, to the linked transaction/ report?

For eg. The message short text may say "Application log 121312421412313 created. To view the complete log, click here". I want the link to directly point to the log messages, not requiring the users to copy-paste the log number to the external transaction.

How can this be done?

Thanks,

Juwin Pallipat Thomas

Read only

naimesh_patel
Active Contributor
0 Likes
2,936

There is a way to pass the values to the underlying called object.

For Transaction DS:TRAN, you can pass the values using the parameter ID. The syntax would be


<DS:TRAN.MM03(MAT.&SYST-MSGV1&)>Material Master</>

MAT is the material parameter ID

The values is being passed in the message variable &SYST-MSGV1& -- The message is (Material &1 has low stock.).

So, calling message with this sample, TEST_NP would be sent to MM03:


DATA: lv_matnr TYPE mara-matnr.

lv_matnr = 'TEST_NP'.

MESSAGE i002(z_testmessage) WITH lv_matnr.

For reports DS:REPO, you would need to use the variant to send the value.


<DS:REPO.RM07DOCS.VARI1>Material Documents</>

RM07DOCS is the report

VARI1 is the variant, separated by a dot

To use this, you can create the temporary variant in the report using the variant FMs and delete it after the message is issued.

Regards,
Naimesh Patel

Read only

Juwin
Active Contributor
0 Likes
2,935

Hi Naimesh,

I tried doing what you suggested. But, got the attached error.

DS:REPO syntax check was OK. Only DS:TRAN failed.


Thanks,

Juwin

Read only

0 Likes
2,935

Ignore the error and activate it.

Regards,
Naimesh Patel

Read only

Juwin
Active Contributor
0 Likes
2,934

Hi Naimesh,

Although the solution worked, I found that there is a limitation to this (DS:TRAN). Length of [ Tcode + Parameter ID + Value + 3 ] cannot be more than 20 characters. If it is more than 20 chars, the value of variable l_dokname is cut off.

Thanks,

Juwin

Read only

0 Likes
2,934

Yes, you are correct that it can't be more than 20 although the FM TRAN_OBJECT_SHOW is able to handle that length up to 60 characters (PERFORM   SET_PARAMETER).


MOVE STRING TO STR.

   DO 60 TIMES.

     ADD 1 TO COUNT_DO.

     MOVE STR+COUNT_DO(1) TO BYTE.

IF BYTE EQ LB.

Can you handle the same requirement via REPS?

Regards,

Naimesh Patel

Read only

Juwin
Active Contributor
0 Likes
2,934

Hi Naimesh,

For my scenario, I will have to create many temporary variants to use REPS option, which I don't prefer to do. Anyways, once I found out about the limitation, I am redesigning my program a little bit, to handle this.

Thanks,

Juwin

Read only

0 Likes
2,934

Or you can use the custom Identifier in the documentation and have a custom class to handle the event.

To achieve it, try like this:

  1. Inherit a custom class say ZCL_EPSS_SAPEVENT_HANDLE from CL_EPSS_SAPEVENT
  2. Redefine the method RESOLVE_LINK and copy the same code fro the super method.
  3. Add WHEN for ZTRA  in the case statement
  4. Redefine the method RESOLVE_LINK
  5. Add a case statement DOC_LINK+3(4). When ZTRA call custom logic, When others call SUPER->RESOLVE_LINK( )
  6. In documentation - use the ZTRA instead of TRAN
  7. Update the EPPS methods table to use this custom class - SM30 for table EPSSA2

You can pass up to 4 variables which you can pass via SY-MSGV* variables as the key. You can have your own syntax for the ZTRA key. I was thinking something like this:

<DS:ZTRA.MMBE.MAT=&SYST-MSGV1&.WRK=&SYST-MSGV2&.CHG=&SYST-MSGV3&>Call MMBE</>

This way you can split the key at dot and get all the parts. First would be the Transaction name. For rest, split at = to get the parameter ID and the value. Set the Parameter IDs with relevant keys and do the call transaction.

You can also have one more key ZTRS to skip the initial screen in call transaction.

Regards,
Naimesh Patel

Updated points 2 & 3 (with 4 & 5) as they were incorrect.

Read only

0 Likes
2,934

Created an article to include this solution : ABAP Overcome Long Text Links Handling using Custom Class

For Report, you can use the static parameter with table type RSPAR. Set the values before the message and use the same parameter in SUBMIT statement within the ZREP.

Regards,
Naimesh Patel

Read only

Juwin
Active Contributor
0 Likes
2,934
Set the values before the message and use the same parameter in SUBMIT statement within the ZREP.


My situation is:

Invoice output triggers a program for some subsequent processing. From that program, I need to store results in an application log and add a message in the output message processing log saying 'Application log xxxx created'. Once the user goes into the invoice and double clicks on that message from the processing log, there should be a link which will take him to the application log directly.


Since the message is not thrown from my own program, I cannot set the parameter values from my program, before the application log display is called.


Thanks,

Juwin

Read only

0 Likes
2,934

To suit your requirement, you can create a new custom doctype say ZLOG and handle that in the event handler.

This is my message:


"Processing log for Invoice &1 generated in application log &2.

MESSAGE I003(Z_TEST) with '123' '778501'.

I'm passing the billing document in SYST-MSGV1 and application log in SYST-MSGV2.

In the long text, add this new doc type


<DS:ZLOG.V1=&SYST-MSGV1&.V2=&SYST-MSGV2&>click to see log</>

Now in the event handler class, create a new method ZSHOW_LOG and call in the RESOLVE_LINK.

  CASE  doc_link+3(4).

    when 'ZLOG'.
      me
->ZSHOW_LOG( ).

The method SHOW_LOG would split the parts and obtain the application log number and invoice number. Call FM  APPL_LOG_DISPLAY_WITH_LOGNO to display the log.

METHOD zshow_log.

 
TYPES: tt_parts   TYPE STANDARD TABLE OF char50.
 
DATA: lv_part   TYPE char50.
 
DATA: lt_parts  TYPE tt_parts.
 
DATA: lt_params TYPE tt_parts.
 
DATA: lv_param  TYPE char10,
        lv_value 
TYPE char50.

 
DATA: lv_vbeln  TYPE vbrk-vbeln,
        lv_applog
TYPE balognr.

 
"
 
SPLIT doc_link+8  "Ignore DS:ZLOG.
   
AT '.'
   
INTO TABLE lt_parts.
*
 
LOOP AT lt_parts INTO lv_part.
   
CLEAR: lv_param, lv_value.

   
SPLIT lv_part
     
AT '='
     
INTO lv_param
           lv_value
.

   
CASE sy-tabix.
     
WHEN 1.
        lv_vbeln
= lv_value.
     
WHEN 2.
        lv_applog
= lv_value.
     
WHEN OTHERS.
       
EXIT.
   
ENDCASE.
 
ENDLOOP.


* Show log
 
TYPE-POOLS: szal.
 
DATA: lt_log_numbers TYPE szal_lognumbers.
 
DATA: ls_prof       TYPE bal_s_prof.


 
CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
   
IMPORTING
      e_s_display_profile
= ls_prof.

 
CONCATENATE 'Display Log for Invoice:' lv_vbeln
   
INTO ls_prof-title
   
SEPARATED BY space.
  ls_prof-use_grid  =
'X'.
  ls_prof-show_all  =
'X'.
  ls_prof-exp_level
= 0"1
  ls_prof
-disvariant-report = sy-repid.

 
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
   
EXPORTING
     
input  = lv_applog
   
IMPORTING
     
output = lv_applog.
 
APPEND lv_applog TO lt_log_numbers.

 
CALL FUNCTION 'APPL_LOG_DISPLAY_WITH_LOGNO'
   
EXPORTING
      i_s_display_profile
= ls_prof
   
TABLES
      lognumbers         
= lt_log_numbers
   
EXCEPTIONS
      no_authority       
= 1
     
OTHERS              = 2.
 
IF sy-subrc <> 0.
   
MESSAGE 'Unable to display logs' TYPE 'I'.
 
ENDIF.

ENDMETHOD.

Regards,
Naimesh Patel

Read only

Juwin
Active Contributor
0 Likes
2,934

Yep, that's almost similar to what I ended up doing. But, didn't create a new doctype. I used a custom parameter id to pass the invoice number to my custom transaction.

Thanks,

Juwin