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

Going to a transaction from a write statement

former_member196438
Participant
0 Likes
1,359

Hi,

I have a simple write statement which gives a PO number and a description about it. When i click on the PO number, it should directly go to transaction ME22N. Please note that i know how to implement the same requirement from the output ALV grid. But now iam not knowing how to go to the transaction from a output write statement. Please suggest what can be done ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,314

Hi,

You need to use AT LINE-SELECTION event for that. See the below help for details

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba3ae35c111d1829f0000e829fbfe/content.htm

Regards,

Atish

Hi,

I have a simple write statement which gives a PO number and a description about it. When i click on the PO number, it should directly go to transaction ME22N. Please note that i know how to implement the same requirement from the output ALV grid. But now iam not knowing how to go to the transaction from a output write statement. Please suggest what can be done ?

12 REPLIES 12
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,314

In list displays we use hotspots as well. Here is an example.



report zrich_0002 no standard page heading.

data: ivbak type table of vbak with header line.

data : cursor_field(30),
       field_value(30) .

select-options: s_vbeln for ivbak-vbeln.

start-of-selection.

  select * into corresponding fields of table ivbak
      from vbak
          where vbeln in s_vbeln.

  loop at ivbak.
    format hotspot on.
    write:/ ivbak-vbeln.
    hide ivbak-vbeln.
    format hotspot off.
  endloop.

at line-selection.

  set parameter id 'AUN' field ivbak-vbeln.
  call transaction 'VA03' and skip first screen.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,315

Hi,

You need to use AT LINE-SELECTION event for that. See the below help for details

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba3ae35c111d1829f0000e829fbfe/content.htm

Regards,

Atish

Read only

0 Likes
1,314

Hi,

I had already tried your suggestion. But when i click on a PO, i get a message on the status bar that Choose a valid Function. Not knowing what to do with this only, i had posted a query here. I would request everybody trying to answer my query, to first try out their solution and then only suggest. thanks in advance.

Read only

0 Likes
1,314

Paste your code so that we can tell you what is wrong in it.

Regards,

Atish

Read only

0 Likes
1,314

Hi Aiswarya,

I believe you are setting PF-STATUS in your program.

The reason for that error is the 'PICK' function code (sy-ucomm) is not present in your GUI Status. If you are setting your own PF-Status then I recommend you open your GUI-Status and assign 'PICK' for Function Key F2.

In case you are not setting your own PF-Status then as Atish said, paste your code so that we can tell what's wrong.

Regards

Nishant

And I hope you are using HIDE for the field that you want to be picked up when you double click.

Message was edited by:

Nishant Rustagi

Read only

0 Likes
1,314

Hi Nishant,

Thanks a lot for ypur valuable suggestion. My code is now working as expected. Thanks again.

Read only

0 Likes
1,314

Hi Nishant,

Could you please explain the purpose of using PICK function ? is it necessary to assign PICK function only and in particular for F2 key ? Kindly explain so that people like me can benefit.

Read only

0 Likes
1,314

Hi,

This is standard SAP fcode need to be assigned to F2 only so that the same can be used in AT LINE SELECTION.

Regards,

Atish

Read only

0 Likes
1,314

Hi ,

as mentioned by Atish, PICK is standard SAP FCode which is used by AT LINE-SELECTION which is same as pressing F2.

Now this doesn't mean you cannot use any other FCODE.

Actually if you assign any other FCODE to F2 Function key it will work but in that case 'AT LINE-SELECTION' will not work.

In that case you'll have to handle this in AT USER-COMMAND.

Cheers

Nishant

Read only

Former Member
0 Likes
1,314

You can also refer below sample program

http://www.sapfans.com/sapfans/qstart/zhello7.html

Regards,

Atish

Read only

Former Member
0 Likes
1,314

Hi ..

Check this..


AT LINE-SELECTION.
READ LINE sy-lilli FIELD VALUE itab-po_num.   "PO field
IF itab-po_num NE SPACE.
CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'
    EXPORTING
      i_ebeln              = itab-po_num
      i_enjoy              = 'X'
      i_edit               = 'X'
*      i_etenr              =
    EXCEPTIONS
      not_found            = 1
      no_authority         = 2
      invalid_call         = 3
      preview_not_possible = 4
      OTHERS               = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDIF.


"PS: with enjoy transaction like ME22n it works perfect


Message was edited by:

Perez C

Read only

Former Member
0 Likes
1,314

REPORT ZRP_TEST3.

data : gt_ekpo type standard table of ekpo,

gs_ekpo type ekpo.

start-of-selection.

SELECT * UP TO 5 ROWS into table gt_ekpo FROM ekpo .

loop at gt_ekpo into gs_ekpo.

write:/, gs_ekpo-ebeln,gs_ekpo-ebelp.

HIDE gs_ekpo-ebeln. "<<<<<<<<<

endloop.

at line-selection.

SET PARAMETER ID 'BES' FIELD gs_ekpo-ebeln.

CALL TRANSACTION 'ME23N'.

The HIDE statement does the job.