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 create my own fcode ?

former_member196593
Participant
0 Kudos

Hi gurus,

*PFKY-PFKEY  =  'ZSTATUS1'.--------------------> here i created my own gui status with back,cancel,buttons after running my selection screen when click back button i could n't get should i pass anything infcode_tab or how can i get my own sy-ucomm for this selection screen??

*PFKY-PROGRAM = SY-REPID.-----------------------> am passing my program name

CALL FUNCTION 'FREE_SELECTIONS_DIALOG'

  EXPORTING

  selection_id = v_selid

  title = l_title

  status = 1

  IMPORTING

  where_clauses = t_where

  expressions = t_expr

  field_ranges = t_fldranges

  number_of_active_fields = v_noactflds

PFKEY               =  PFKY

  TABLES

  fields_tab = t_fields

  fcode_tab = t_fcode

  EXCEPTIONS

  internal_error = 1

  no_action = 2

  selid_not_found = 3

  illegal_status = 4

  OTHERS = 5.

"my own fcode am not gettting here.

if sy-ucomm = 'back'

whtvr i whant

endif.

3 REPLIES 3

Former Member
0 Kudos

1. In report program, create a screen.

2. Uncomment Module Status and Module User Command.

3. Double-click on MODULE STATUS_9000 and call it in program.

4. Double-click on MENU.

Autres Fonctions > Adapter Modèle






6. Programme: SAPLSALV

Statut: STANDARD


8. Check the function code of the buttons which you intend to use


9. In screen, double-click on MODULE USER_COMMAND

10. Add the function code to be used:

Here you can use a constant to keep the value &F03, so that it is more meaningful to use:

CASE sy-ucomm.

WHEN c_back.

etc...

0 Kudos

thatks for ur reply i know that whatvr ur saying

thats dynamic selection screen FM  Here i dont knw the screen number.....

Former Member
0 Kudos

Hi,

Can you check the documentation of the FM.

You have to use like below!

ORIGIN: 'CUS' (customer)

DBNA: empty (no logical database used)

NAME: CHARLY

  ...

TABLES: ABCD, XYZW.

TYPE-POOLS RSDS.

DATA TEXPR TYPE RSDS_TEXPR.

DATA TWHERE TYPE RSDS_TWHERE.

DATA TRANGE TYPE RSDS_TRANGE.

DATA DS_CLAUSES TYPE RSDS_WHERE.

DATA BEGIN OF TABS OCCURS 10.

  INCLUDE STRUCTURE RSDSTABS.

DATA END OF TABS.

DATA BEGIN OF FIELDS OCCURS 10.

  INCLUDE STRUCTURE RSDSFIELDS.

DATA END OF FIELDS.

DATA SELID LIKE RSDYNSEL-SELID.

DATA ACTNUM LIKE SY-TFILL.

DATA TITLE LIKE SY-TITLE VALUE 'My title'.

  ... (Fill tables TABS and FIELDS,

  ... e.g. TABS should contain the tables ABCD and XYZW,

  ... FIELDS the fields ABCD-F1, ABCD-F2 and XYZW-F0)

CALL FUNCTION 'FREE_SELECTIONS_INIT'

EXPORTING

  EXPRESSIONS = TEXPR.

KIND = 'G'

  FIELD_GROUPS_KEY = QCAT

  IMPORTING

  SELECTION_ID = SELID

EXPRESSIONS = TEXPR

  WHERE_CLAUSES = TWHERE

  FIELD_RANGES = TRANGE

  NUMBER_OF_ACTIVE_FIELDS = ACTNUM

  TABLES

TABLES_TAB = TABS

  FIELDS_TAB = FIELDS

  EXCEPTIONS

  FIELDS_INCOMPLETE = 01

FIELDS_NO_JOIN = 02

  FIELD_NOT_FOUND = 03

  NO_TABLES = 04

TABLE_NOT_FOUND = 05

  EXPRESSION_NOT_SUPPORTED = 06

  INCORRECT_EXPRESSION = 07

ILLEGAL_KIND = 08

  AREA_NOT_FOUND = 09

  INCONSISTENT_AREA = 10

  KIND_F_NO_FIELDS_LEFT = 11

  KIND_F_NO_FIELDS = 12

TOO_MANY_FIELDS = 13.

IF SY-SUBRC = 0.

  CALL FUNCTION 'FREE_SELECTIONS_DIALOG'

  EXPORTING

SELECTION_ID = SELID

  TITLE = TITLE

  IMPORTING

  WHERE_CLAUSES = TWHERE

  EXPRESSIONS = TEXPR

FIELD_RANGES = TRANGE

  NUMBER_OF_ACTIVE_FIELDS = ACTNUM

  TABLES

  FIELDS_TAB = FIELDS

  EXCEPTIONS

  INTERNAL_ERROR = 01

NO_ACTION = 02

  NO_FIELDS_SELECTED = 03

  NO_TABLES_SELECTED = 04

  SELID_NOT_FOUND = 05.

  IF SY-SUBRC = 0.

  CLEAR DS_CLAUSES.

  MOVE 'ABCD' TO DS_CLAUSES-TABLENAME.

  READ TABLE TWHERE WITH KEY DS_CLAUSES-TABLENAME INTO DS_CLAUSES.

  SELECT * FROM ABCD WHERE ...

AND (DS_CLAUSES-WHERE_TAB).

  ...

  ENDIF.

ENDIF.