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

How to block Report or program ??

Former Member
0 Likes
1,132

hi all.

How to block Report or program ??<b>which tcode</b> i can use to temporary suspend the report or program to exexute.

thanks all.

hi all.

How to block Report or program ??<b>which tcode</b> i can use to temporary suspend the report or program to exexute.

thanks all.

5 REPLIES 5
Read only

Former Member
0 Likes
1,042

I'm not sure of your requirement, but see this document... it might help you.....

So, let’s start with creating an order.

The function that we are going to use is CLOI_CHANGES_UPL_31.There is one important point that you have to keep in mind when working with the function: you are given just one call per session. That means, you can create one order or many orders, but with one call. After that, some internal state data is messed up and to save us from initializing it (which has to be done with some really internal functions), we better start a new session if we need to call the function again. So, in my example code below I am going to check whether the current session is not the last one allowed for the current user and call the function in a new task. Note that we have to do the check before EACH call unless we are really sure (I do it only once in the sample code below). <b>Since it’s going to be an asynchronous call, we need to suspend our program until the function running in parallel finishes and get the return data into our program</b>. This is achieved with standard SAP constructs like “performing … on end of task” in the CALL FUNCTION statement and “receive results” in the form that is performed. I am also using a global variable that tells me that the call is over. You can find more useful information in SAP OSS note 545860 that described those specifics about calling that function.

Sample code....

  • 1. Create a production order.

data: t_cloi_ord_exp type standard table of cloiord,

lw_cloi_ord_exp type cloiord,

lt_cloi_msg_obj_log_exp type standard table of cloimoblog,

lt_cloi_methods_exp type standard table of cloimetlog,

t_cloi_messages_exp type standard table of cloimsglog,

lw_cloi_messages_exp type cloimsglog,

ls_cloi_if_par_v2 like cloiifpar.

data: lt_cloi_ordu type standard table of cloiordu,

lw_cloi_ordu type cloiordu,

lt_cloi_ordi type standard table of cloiordi,

lw_cloi_ordi type cloiordi,

lt_cloi_ord_opru type standard table of CLOIOPERU,

lw_cloi_ord_opru type CLOIOPERU.

data:

lf_date like sy-datum,

lf_date2 like sy-datum,

f_flag(1) type c,

f_aufnr like aufk-aufnr.

data: f_act_sess like sm04dic-counter,

f_max_sess like sm04dic-counter.

lf_date = sy-datum + 7. "let's try to schedule it next week

lf_date2 = sy-datum + 14.

clear: ls_cloi_if_par_v2.

  • those fields below are described in SAP help, but nevermind...

ls_cloi_if_par_v2-commitflg = 'C'.

ls_cloi_if_par_v2-r3_version = '40'.

ls_cloi_if_par_v2-metlog_req = 'X'.

ls_cloi_if_par_v2-msglog_req = 'X'.

ls_cloi_if_par_v2-msgobj_req = 'X'.

ls_cloi_if_par_v2-ord_req = 'X'.

ls_cloi_if_par_v2-ordseq_req = 'X'.

ls_cloi_if_par_v2-ordopr_req = 'X'.

  • in case if we have external number range,

  • we have to provide the future order number

lw_cloi_ordi-extaufnr = '1234567890'.

  • material

lw_cloi_ordi-field = 'MATNR'.

lw_cloi_ordi-value = 'MATNUM1'.

append lw_cloi_ordi to lt_cloi_ordi.

  • plant

lw_cloi_ordi-field = 'WERKS'.

lw_cloi_ordi-value = 'W001'.

append lw_cloi_ordi to lt_cloi_ordi.

  • order type

lw_cloi_ordi-field = 'AUART'.

lw_cloi_ordi-value = 'PP01'.

append lw_cloi_ordi to lt_cloi_ordi.

  • quantity

lw_cloi_ordi-field = 'BDMNG'.

lw_cloi_ordi-value = '100'.

append lw_cloi_ordi to lt_cloi_ordi.

lw_cloi_ordi-field = 'GLTRP'. "finish date

lw_cloi_ordi-value = lf_date2.

append lw_cloi_ordi to lt_cloi_ordi.

lw_cloi_ordi-field = 'GSTRP'. "start date

lw_cloi_ordi-value = lf_date.

append lw_cloi_ordi to lt_cloi_ordi.

  • now check if we have one free session

call function 'TH_USER_INFO'

importing

act_sessions = f_act_sess

max_sessions = f_max_sess

exceptions

others = 1.

if sy-subrc 0 or f_act_sess >= f_max_sess.

message e208(00) with 'No more free sessions'.

endif.

  • and finally, let it happen!

clear: f_flag.

call function 'CLOI_CHANGES_UPL_31'

starting new task 'CLOI_TEST'

performing receive_res on end of task

exporting

cloi_if_par = ls_cloi_if_par_v2

tables

cloi_ordi_imp = lt_cloi_ordi

cloi_method_log_exp = lt_cloi_methods_exp

cloi_message_log_exp = t_cloi_messages_exp

cloi_msg_obj_log_exp = lt_cloi_msg_obj_log_exp

cloi_ord_exp = t_cloi_ord_exp.

  • wait till the global variable will be set by our form

wait until f_flag = 'X'.

This is the form that is used to receive results and signalize

the end of processing:

form receive_res using taskname.

data: lt_cloi_msg_obj_log_exp type standard table of cloimoblog,

lt_cloi_methods_exp type standard table of cloimetlog.

receive results from function 'CLOI_CHANGES_UPL_31'

tables

cloi_method_log_exp = lt_cloi_methods_exp

cloi_message_log_exp = t_cloi_messages_exp

cloi_msg_obj_log_exp = lt_cloi_msg_obj_log_exp

cloi_ord_exp = t_cloi_ord_exp.

f_flag = 'X'.

endform.

The list of created production orders is returned back in the global table t_cloi_ord_exp. Now, let’s release them. (Setting, for example, technically complete status is similar). We are going to use the parameter cloi_ordu_imp instead of cloi_ordi_imp (I for insert, U for update). We populate the field FIELD with the value “METHOD” to say that we are not setting any values but we want to call a “method” of releasing the order (method in the same sense as in object programming).

  • release created prod order

clear: lt_cloi_ordu.

loop at t_cloi_ord_exp into lw_cloi_ord_exp.

check not lw_cloi_ord_exp-aufnr is initial.

clear: lw_cloi_ordu.

lw_cloi_ordu-aufnr = lw_cloi_ord_exp-aufnr.

f_aufnr = lw_cloi_ord_exp-aufnr.

  • Methods:

  • SetTechnicalComplete

  • RevokeTechnicalCompletion

  • Schedule

  • Release

  • SetUserStatus

  • RevokeUserStatus

lw_cloi_ordu-field = 'METHOD'.

lw_cloi_ordu-value = 'Release'.

append lw_cloi_ordu to lt_cloi_ordu.

endloop.

clear: lt_cloi_methods_exp, t_cloi_messages_exp,

lt_cloi_msg_obj_log_exp, t_cloi_ord_exp.

clear: f_flag.

call function 'CLOI_CHANGES_UPL_31'

starting new task 'CLOI_TEST'

performing receive_res on end of task

exporting

cloi_if_par = ls_cloi_if_par_v2

tables

cloi_ordu_imp = lt_cloi_ordu

cloi_method_log_exp = lt_cloi_methods_exp

cloi_message_log_exp = t_cloi_messages_exp

cloi_msg_obj_log_exp = lt_cloi_msg_obj_log_exp

cloi_ord_exp = t_cloi_ord_exp.

wait until f_flag = 'X'.

Now, as the order is created and released, let’s do some simple change. We are going to change the workcenter of the order’s operation.

  • change the work center of the operation 0010

clear: lt_cloi_ord_opru.

clear: lw_cloi_ord_opru.

lw_cloi_ord_opru-aufnr = f_aufnr.

lw_cloi_ord_opru-aplfl = 0.

lw_cloi_ord_opru-vornr = '0010'.

lw_cloi_ord_opru-field = 'ARBID'.

  • note that this is the internal ID of workcenter!

lw_cloi_ord_opru-value = '10000001'.

append lw_cloi_ord_opru to lt_cloi_ord_opru.

clear: lt_cloi_methods_exp, t_cloi_messages_exp,

lt_cloi_msg_obj_log_exp, t_cloi_ord_exp.

clear: f_flag.

call function 'CLOI_CHANGES_UPL_31'

starting new task 'CLOI_TEST'

performing receive_res on end of task

exporting

cloi_if_par = ls_cloi_if_par_v2

tables

cloi_ord_opru_imp = lt_cloi_ord_opru

cloi_method_log_exp = lt_cloi_methods_exp

cloi_message_log_exp = t_cloi_messages_exp

cloi_msg_obj_log_exp = lt_cloi_msg_obj_log_exp

cloi_ord_exp = t_cloi_ord_exp.

wait until f_flag = 'X'.

That’s it! The function that we use doesn’t let us do anything we may need, but it can be very useful anyways....

Hope this might help you....

Regards,

Pavan

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,042

You can use transaction SM01 to lock/unlock transactions.

Regards

Read only

0 Likes
1,042

Raymond,

Even I have a similar requirement.

I am having a program XYZ which is having an include ABC.This program XYZ is no longer in use but lies in Production.This program XYZ is not having a checkbox called psum and not used in the include ABC.

At a later date

I have another program FGH which is having the same include ABC.This report is having a checkbox called psum which is used even in the include ABC.

Now the problem is when I transport this program FGH it is showing an error that program XYZ is having a include ABC where psum is in use but not declared as a checkbox in the program XYZ.

What is the best way to avoid this problem.XYZ is no longer in use and I don't want this error to be repeated in the future whenever FGH is transported.

Kindly let me know.

Thanks,

K.Kiran.

Read only

0 Likes
1,042

Comment the include instruction in the older main program (or comment all instructions) and then transport it or you can delete and transport the old program. (comment is better of course)

Or you can check the value of sy-cprog (main program) in the include, assigning a field-symbol to the new checkbox if the include is called by the new program. (and checking again before using it)

Regards

Read only

Former Member
0 Likes
1,042

Hi,

in the attributes of program check the <b>Editor flag</b> checkbox

<b>Editor lock flag</b>

The editor lock flag prevents other users from making changes to the

program. This includes attributes, documentation and text elements, as

well as the functions "Rename" and "Delete".

Only the last person to change the program can remove the flag.

<b>Use</b>

Enables an individual user to lock the program. Also facilitates locking

of the program source for PC download purposes.