Application Development 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: 

How to clear SAP Memory set using SET PARAMETER

Former Member
0 Kudos

Hi,

I know this is a repetitive question in SCN. But I couldn't resolve the issue using the solution already provided here.

I have an ALV output, in which one field is for Process Order, which is shown as hyperlink.

When you click on any process order, it should call COR3 with the selected Process order.

My problem is always the first process order is getting displayed always.

i.e. I select order O1 and it goes to COR3 to display O1. If I come back and select O2, it goes to COR3 to display O1 again.

I am using the following code for this requirement.

          v_aufnr = wa_final1-proc_order.

          SET PARAMETER ID 'ANR' FIELD v_aufnr.

          CALL TRANSACTION 'COR3' AND SKIP FIRST SCREEN.

          CLEAR v_aufnr.

          SET PARAMETER ID 'ANR' FIELD v_aufnr.

Still it is not working.

Any help will be greatly appreciated.

Regards,

Shail.

1 ACCEPTED SOLUTION

PeterJonker
Active Contributor
0 Kudos

Just curious because I have done this many times and never had this problem.

I have been debugging and found out that after your statement parameter id BR1 is used.

so if you change your code to:

          v_aufnr = wa_final1-proc_order.

          SET PARAMETER ID '
BR1' FIELD v_aufnr.

          CALL TRANSACTION 'COR3' AND SKIP FIRST SCREEN.

don't clear anything here, not bnecessary

15 REPLIES 15

Former Member
0 Kudos

I believe issue is with the way you get process order number from ALV.

No matter which line is clicked, first process order number gets set.

Put a breakpoint to confirm that when you click on line 3, process order of line 3 reaches v_aufnr or not.

After confirming this, you can focus on getting selected row index (cl_gui_alv_grid->get_selected_rows if using classes), and fetching correct process order number.

PeterJonker
Active Contributor
0 Kudos

Just curious because I have done this many times and never had this problem.

I have been debugging and found out that after your statement parameter id BR1 is used.

so if you change your code to:

          v_aufnr = wa_final1-proc_order.

          SET PARAMETER ID '
BR1' FIELD v_aufnr.

          CALL TRANSACTION 'COR3' AND SKIP FIRST SCREEN.

don't clear anything here, not bnecessary

0 Kudos

Thanks Peter.

Your solution is working fine for me now.

But, do you know how you came across 'BR1' instead of 'ANR' , as I could see only 'ANR' if I goto COR3 and press F1 on Order number ?

Regards,

Shail.

0 Kudos

Well I created a small program in which I select a few process orders, display in alv and implement method handle_doubleclick.

I used the same parameter-id as you did and set a breakpoint at statement set parameter id.

The after that I go in debugging in COR3 and in the PBO event for the first screen, the first perform is called: MODULE get_parameter. And when you go in there......well try out and you will see.

former_member186077
Active Participant
0 Kudos

Hi ,

Hope you are populating the order number from the selected record.

Please check in debugging if you are  able to see the second order being picked up during the set parameter execution.

also please check if you are looping again to read the order instead use read statement for the selected record for the right order number.

Thanks and Regards,

Sriranjani Chimakurthy.

PeterJonker
Active Contributor
0 Kudos

PARAMETER ID 'BR1'  in stead of 'ANR' WILL work. I created a test program and it works perfect.

0 Kudos

Hi Peter,

I understood what you are saying.

But, how did you come to know that the parameter id 'BR1' is for AUFNR field for COR3 transaction ?

In which table,we can find the linkage between the field and the parameter id ?

I searched in DD04L table, but couldn't get the entry for parameter id 'BR1'.

Regards,

Shail.

0 Kudos

Not in ddic, code in first module in the PBO of the initial screen of transaction (SE93 -> double-click on dynpro, double-click on first module)

Regards,

Raymond

0 Kudos

Really only by debugging the code. If you go in the MODULE get_parameter which is called when you start TC COR3, then you see the following code:

MODULE GET_PARAMETER OUTPUT.

  IF CAUFVD-AUFNR IS INITIAL.
    GET PARAMETER ID 'BR1' FIELD *CAUFVD-AUFNR.
    IF NOT *CAUFVD-AUFNR IS INITIAL.
      CAUFVD-AUFNR = *CAUFVD-AUFNR.
    ENDIF.
  ENDIF.

ENDMODULE.                             " GET_PARAMETER  OUTPUT

That made me realize that any parameter-id that needs to be set is BR1 and not ANR as you can find in F1 information on the screenfield. I honestly think this is a bug and SAP should repair it. The data element AUFNR has parameter-id ANR and I don't see the reason why SAP uses another one in this transaction.

raymond_giuseppi
Active Contributor
0 Kudos
  • How did you code read of the selected line record in your ALV (user_command, event HOTSPOT_CLICK or ?)
  • How did you find that the memory id is ANR, yes this is the default for the data element, alas for some transactions related to Process Order Number, it is also BR1 (*)

Regards,

Raymond

(*) Assumed that ANR also can be checked but only if BR1 is initial, so first time you set ANR, and COR3 will set BR1, and during following calls; COR3 will only read BR1, let you test...

0 Kudos

Hi Raymond,

- I used HOTSPOT_CLICK event to do the processing . I use the OO ALV method for the same.

- I found out that the parameter id is ANR, by pressing F1 at Order number in COR3 and proceeded

  by setting it in the program.

I was not aware of this Parameter id 'BR1'.

I would definitely be interested to know if there is some place where we link BR1 and Process order number.

Regards,

Shail.

0 Kudos

Alas PARAMETER ID can be used in Abap statement, so you can not always find the information in ddic nor in dynpro field definition but in module of the program. So usually I look at initial transaction dynpro for modules with names like 'INIT_TRANSACTION' or 'GET_PARAMETER'.

So, small list of tricks than can do the job

  • Modules of the transaction initial dynpro (here module "get_parameter" in SAPLCOKO / 5110)
  • Start transaction in debug mode with Watchpoints defined on the required dynpro field.
  • Perform Where Used on the transaction (here you could find transaction that use BR1 or BR1 and ANR or small BDC, but you could also  find some standard transactions that only use ANR and got in the same trouble before a note corrected them)

Regards,

Raymond

manukapur
Active Participant
0 Kudos

Just set it to space. A workaround.

SET PARAMETER ID 'ANR' FIELD space.

Regards,

Manu

Former Member
0 Kudos

FREE is for clearing up memory occupied by internal tables.

DELETE from memory ID is to clear data from SAP memory (Parameter ID's)

Syntax

FREE MEMORY ID id.

 

Effect

This statement has the same effect as the statement

DELETE FROM MEMORY ID id.

Former Member
0 Kudos

Hello:

First of all, thank you for the information about the BR1 value, instead of ANR.

Now, I'm trying to call the IW39 transaction, but there is a field called "Period", which refers to Dates "DATUV" and "DATUB".

These dates are filled when the transaction starts, and they don't have any PARAMETER ID defined by SAP.

My question is, how could I erase those values from this transaction, so I can see the Maintenance Order correctly? Right now, the transaction is telling me that there are no orders, but it's because of the dates.

Thanks in advance.

Greetings.

Teresa.