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

report submitted from user exit

Former Member
0 Likes
2,827

I would like to know if a report launched from user exit has less priority than report launched from se38 (for example); this is my situation: I am calling a report from a user exit; the report is made by a recording. the report called from transaction don't do anything, but the same record launched in stand alone do exactly what it should do.

can anybody please help me to make the situation a bit clear.

thanks in advance.

Gabriele

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,472

Hi,

What are you trying to achieve via the user exit?

Are you making any call transaction in the report called within the userexit?

Just debug and check if it is successfully called via the user exit.

Regards,

Ankur Parab

I would like to know if a report launched from user exit has less priority than report launched from se38 (for example); this is my situation: I am calling a report from a user exit; the report is made by a recording. the report called from transaction don't do anything, but the same record launched in stand alone do exactly what it should do.

can anybody please help me to make the situation a bit clear.

thanks in advance.

Gabriele

17 REPLIES 17
Read only

Former Member
0 Likes
2,473

Hi,

What are you trying to achieve via the user exit?

Are you making any call transaction in the report called within the userexit?

Just debug and check if it is successfully called via the user exit.

Regards,

Ankur Parab

Read only

0 Likes
2,472

Hi

I am calling some statement retrieved by a recording. I already debugged and it seems no error is given. The proof is that in standalone report works correctly: for testing this error I've cut away all data passing so that calling report in standalone or calling it via exit is absolutley the same thing and same code lines are processed. this make me go crazy because I cannot understand why it doesn't work.

Read only

0 Likes
2,472

Hi,

Can you share your code?

Regards,

Ankur Parab

Read only

0 Likes
2,472

yes.

her it is:

REPORT z_change_moving_price
       NO STANDARD PAGE HEADING LINE-SIZE 255.

  DATA date TYPE string.
  DATA  company TYPE MSEG-BUKRS.
  DATA material TYPE MSEG-MATNR.
  DATA division TYPE MSEG-WERKS.
  DATA price TYPE MBEW-VERPR.

  IMPORT
   material
   division
   date
   price
   company
 FROM MEMORY ID 'CHANGE_MOVING_PRICE'.

DATA str_price TYPE string.
str_price = price.

DATA p_mode(1) TYPE c VALUE 'N'.
DATA: BEGIN OF bdcdata OCCURS 0.
        INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA BEGIN OF mess OCCURS 10.
        INCLUDE STRUCTURE bdcmsgcoll.
DATA END OF mess.

PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
PERFORM bdc_field       USING 'BDC_CURSOR'
                              'MR21HEAD-BUKRS'.
PERFORM bdc_field       USING 'BDC_OKCODE'
                              '=ENTR'.
PERFORM set_text_date CHANGING date.
PERFORM bdc_field       USING 'MR21HEAD-BUDAT'
                              *date*.
PERFORM bdc_field       USING 'MR21HEAD-BUKRS'
                              *company*.


PERFORM bdc_field       USING 'MR21HEAD-SCREEN_VARIANT'
                              'MR21_LAGERMATERIAL_0250'.
PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
PERFORM bdc_field       USING 'BDC_OKCODE'
                              '=ENTR'.
PERFORM bdc_field       USING 'BDC_CURSOR'
                              'CKI_MR21_0250-NEWVALPR(01)'.
PERFORM bdc_field       USING 'MR21HEAD-SCREEN_VARIANT'
                              'MR21_LAGERMATERIAL_0250'.
PERFORM bdc_field       USING 'CKI_MR21_0250-MATNR(01)'
                              *material*.

PERFORM bdc_field       USING 'CKI_MR21_0250-BWKEY(01)'
                              *division*.
PERFORM bdc_field       USING 'CKI_MR21_0250-NEWVALPR(01)'
                                *str_price*.

PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
PERFORM bdc_field       USING 'BDC_OKCODE'
                              '=SAVE'.
PERFORM bdc_field       USING 'BDC_CURSOR'
                              'CKI_MR21_0250-MATNR(02)'.
PERFORM bdc_field       USING 'MR21HEAD-SCREEN_VARIANT'
                              'MR21_LAGERMATERIAL_0250'.
*perform bdc_transaction using 'MR21'.


CALL TRANSACTION 'MR21' USING bdcdata
                                     MODE   p_mode
                                     UPDATE 'A'
                                     MESSAGES INTO mess.

LOOP AT mess.

ENDLOOP.

*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
ENDFORM.                    "BDC_DYNPRO

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
ENDFORM.                    "BDC_FIELD


*&---------------------------------------------------------------------*
*&      Form  set_text_date
*&---------------------------------------------------------------------*
FORM set_text_date CHANGING input_date.
  " local variables
  DATA: month(9),
        year(4),
        day(2).

  IF input_date IS INITIAL.
    RETURN.
  ENDIF.
  " store each components
  WRITE input_date+0(4) TO year.
  WRITE input_date+4(2) TO month.
  WRITE input_date+6(2) TO day.

  CONCATENATE day month year INTO input_date SEPARATED BY '.'.

  " delete leading/trailing spaces
  CONDENSE input_date.

ENDFORM.                    "set_text_date

Edited by: Gabriele Montori on Jul 20, 2009 2:39 PM

Read only

0 Likes
2,472

Hi,

In the exit are you directly making a call to the transaction MR21 or are you submitting the report?

What error do you exactly face?

Is call transaction the only alternative to achieve your solution. Can it ne done via some BAPI or FM?

Regards,

Ankur Parab

Read only

0 Likes
2,472

Hi,

What messages do you get in mess?

Regards,

Ankur Parab

Read only

0 Likes
2,472

Hi ,

try the below way..instead of Export and Import...

 
   DATA date TYPE string.

"Comment Below code
   DATA date TYPE string.
   DATA  company TYPE MSEG-BUKRS.
   DATA material TYPE MSEG-MATNR.
   DATA division TYPE MSEG-WERKS.
   DATA price TYPE MBEW-VERPR.
   IMPORT
    material
    division
    date
    price
    company
  FROM MEMORY ID 'CHANGE_MOVING_PRICE'.
"Comment Upto now

" Try this way..
parameters :  material TYPE MSEG-MATNR no-display,    "try this way
                      division TYPE MSEG-WERKS no-display,      "try this way
                      date      TYPE Sy-datum no-display,                 "try this way
                      price    TYPE MBEW-VERPR no-display,          "try this way
                       company TYPE MSEG-BUKRS no-display.      "try this way
"Try this way

  

Step 2..write code in the user exit by submit program with above parameters Passsing..


"write this in the user-exit..
submit z_change_moving_price
with material  = material 
with division = division
with date     = date
with price   = price
with company = company
and Return.

Prabhudas

Read only

0 Likes
2,472

hi

The call to transaction is in a report that I sublit from FM of user exit. and it seems there is no working fm to update price material (seen on many posts). I cannot understand the error I get from call transaction .. the messages table (when calling from exit and NOT when launching report in standalone) is not empty and error is type E but I cannot undestand which kind of error is ... also sy-subrc returning from CALL TRANSACTION is 1001 (I cannot undestand .. on help it talks about break point while processing ... but there aren't) ...

Read only

0 Likes
2,472

Hi

If you can see the record of table message by debug, u should find out the class and the number of the message, anyway it's not good to insert a CALL TRANSACION is a user-exit, the LUW (an do the flow) of calling transaction could be damaged:

All database updating should be done in update task.

Max

Read only

0 Likes
2,472

Hi Gabriele,

Does the error messages have any message id and message number?

While debbugging is it possible for you to do call transaction in foreground mode and check if you encounter in error?

Regards,

Ankur Parab

Read only

0 Likes
2,472

hi

this is what the call transaction returns:

TCODE	                                MR21
DYNAME	                                   	SAPRCKM_MR21
DYNUMB	                                   	0201
MSGTYP	                                   	E
MSGSPRA	                                I
MSGID	                                   	M3
MSGNR	                                   	024
MSGV1	                                   	M1010000060
MSGV2	                                   	SVILUPPO
MSGV3	                                   
MSGV4	                                   
ENV	                                   	        CTU
FLDNAME	                                   	CKI_MR21_0250-NEWVALPR(01)

Read only

0 Likes
2,472

Hi,

If you check the message no 24 of message id M3; it says Valuation data for material & is locked by the user &.

The material is M1010000060 and the user is SVILUPPO

I think your material is already locked in your current transaction and you are trying to change its price via the exit.

This is not allowed.

Regards,

Ankur Parab

Edited by: Ankur Parab on Jul 20, 2009 7:33 PM

Read only

0 Likes
2,472

I think you fully understand what is my error .. I'll search a way to avoid the problem.

thank you very much

Read only

0 Likes
2,472

Hi Gabriele

Just as Ankur Parab says

the main transaction is locking the material so the tra MR21 fails, so just as I said in my previous answer, it's not a good idea to insert a recording there.

U should considere all database updating has to be done at the end of transaction, so u should insert your modification in a user-exit triggered as soon as the saving process start; the main transaction runs the own saving process in update task with V1 process, so your saving processo should be of type V2 in order to run it after the main process.

So u should create a Z function module with the flag UPDATE MODULE and START DELAYED, the submit of the report has to be placed in this function module, and the function module in the user-exit, using a calling like this:

CALL FUNCTION <Z MY FUNCTION> IN UPDATE TASK.

In this way your function module so your recording will be processed at the end, when all lock will be just deleted.

Let's know why u need to insert a recording there.

Max

Read only

former_member404244
Active Contributor
0 Likes
2,472

HI,

The main concept of an Customer exitt is to enhance the SAP functionality and for Userexit to overwrite the SAP functionality..Basically we use the exits to do the above...It is fine that u r calling the program , what u r expecting after this..Do u want to return back to userexit once ur work is done OR u want to enhance something after it is called...

Did u tried ur code in a FM and getting the information in the import paramters??

Regards,

Nagaraj

Read only

Former Member
0 Likes
2,472

Hello,

In case you have recorded this to run in slient (background mode) then try changing the mode and run in foreground mode.

See if this can help.

Thanks,

Augustin.

Read only

0 Likes
2,472

I tried the permutations of values in calls