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

Re:urgent

Former Member
0 Likes
539

Hi,

my screen field is customer code , i need to fetch values from other table customer code i.e need to create search help, how to link the tables and populated the values to this field

2. if i click the editor is opened in tht i need to write a note : please press enter and should be disabled, when ever i click create or edit or etc this note should appear on the editor how is it possible

Hi,

my screen field is customer code , i need to fetch values from other table customer code i.e need to create search help, how to link the tables and populated the values to this field

2. if i click the editor is opened in tht i need to write a note : please press enter and should be disabled, when ever i click create or edit or etc this note should appear on the editor how is it possible

4 REPLIES 4
Read only

Former Member
0 Likes
515

After creating programs dynamically, you can start them in the normal way from the R/3 System. However, you may want not only to create, but also to start programs at runtime. In this case, you can

use the SUBMIT statement,

work with include programs or subroutines.

To start the created or modified program directly from your running program, use:

Syntax

SUBMIT <prog>.

For more information about the SUBMIT statement, see Calling Executable Programs (Reports)

Assume the following simple report:

REPORT ZDYN3.

WRITE / 'Dynamic Program!'.

The following executable program (report) starts, modifies, and restarts ZDYN3:

REPORT ZMASTER1.

DATA CODE(72) OCCURS 10.

DATA LIN TYPE I.

READ REPORT 'ZDYN3' INTO CODE.

SUBMIT ZDYN3 AND RETURN.

DESCRIBE TABLE CODE LINES LIN.

MODIFY CODE INDEX LIN FROM

'WRITE / ''Dynamic Program Changed!''.'.

INSERT REPORT 'ZDYN3' FROM CODE.

SUBMIT ZDYN3.

The output of this program is displayed on two subsequent output screens. The first screen displays:

Dynamic Program!

The second screen displays:

Dynamic Program Changed !

When you use the SUBMIT statement, all modifications made to a program during runtime take immediate effect before they are submitted. In the above example, ZDYN3 is submitted from ZMASTER1 first in its original and then in its modified form, generating different results.

This is not the case if you change the codes of include programs or subroutines dynamically.

Assume the following include program:

      • INCLUDE ZINCLUD1.

WRITE / 'Original INCLUDE program!'.

and an executable program (report) for modifying and including it:

REPORT ZMASTER2.

DATA CODE(72) OCCURS 10.

DATA LIN TYPE I.

READ REPORT 'ZINCLUD1' INTO CODE.

DESCRIBE TABLE CODE LINES LIN.

MODIFY CODE INDEX LIN FROM

'WRITE / ''Changed INCLUDE program!''.'.

INSERT REPORT 'ZINCLUD1' FROM CODE.

INCLUDE ZINCLUD1.

If you run ZMASTER2, the source code of include program ZINCLUD1 is changed and replaced in the system. However, the last line of ZMASTER2 executes the older version since the runtime object of ZMASTER2 is generated before ZINCLUD1 is modified. Only when ZMASTER2 is run a second time, does the system determine that ZINCLUD1 has been changed. Exactly the same is true if you dynamically modify the source code of a subroutine and call it from within the same program.

One way to solve this problem is to use the INCLUDE statement within an external subroutine that is called by the program. This allows you to create or modify include programs or subroutines and use the updated versions directly in the same program.

Assume the following include program:

      • INCLUDE ZINCLUD1.

WRITE / 'Original INCLUDE program!'.

and an external subroutine:

PROGRAM ZFORM1.

FORM SUB1.

INCLUDE ZINCLUD1.

ENDFORM.

The following program reads the include program, modifies it, enters it back into the system, and calls the subroutine.

REPORT ZMASTER3.

DATA CODE(72) OCCURS 10.

READ REPORT 'ZINCLUD1' INTO CODE.

APPEND 'WRITE / ''Extension of INCLUDE program!''.' TO CODE.

INSERT REPORT 'ZINCLUD1' FROM CODE.

PERFORM SUB1(ZFORM1).

This produces the following output:

Original INCLUDE program!

Extension of INCLUDE program!

In this case, the updated version of the include program is used in the subroutine because its time stamp is checked when the subroutine is called, and not when the calling program is generated.

Message was edited by:

Karthikeyan Pandurangan

Read only

0 Likes
515

Hi karthikeyan,

Thank u so much for your immediate answer , i have developed one customised text editor using create_text ,edit_text etc , if i click on create sapscript editor will open , in that the first line should be disabled, note: press enter should be disabled

How to do this

Read only

Former Member
0 Likes
515

REPORT YSDINT25 .

TYPE-POOLS VRM.

TABLES: ZSDSHR13,stxh.

DATA:IVRM TYPE VRM_VALUES,

NAME TYPE VRM_ID,

IVRM_DATA LIKE LINE OF IVRM.

DATA : LANGUAGE like T002-SPRAS value 'E',

ACTION like ttxct-function,

TEXTTITLE like ttxit-tdtext.

data:OKCODE TYPE SY-UCOMM.

data: begin of wa_groupname occurs 0.

include structure ZSDSHR13.

data end of wa_groupname .

data: save_ok like OKCODE.

DATA BEGIN OF TEXTHEADER.

include structure thead.

data end of textheader.

data count type i.

data begin of textlines occurs 0.

include structure tline.

data end of textlines.

call screen 200.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module STATUS_0200 output.

SET PF-STATUS 'MENU'.

SET TITLEBAR 'GUI'.

endmodule. " STATUS_0200 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module USER_COMMAND_0200 input.

save_ok = OKCODE.

case save_ok.

when 'DISPLAY'.

refresh wa_groupname.

if wa_groupname-zcustcode = ' ' and wa_groupname-zgroupname = ' '.

message s000(ZMSG) with 'Please Enter the values'.

else.

select single * from ZSDSHR13 where zcustcode = wa_groupname-zcustcode and

zgroupname = wa_groupname-zgroupname .

if sy-subrc eq 0.

perform display_editor using wa_groupname-zgroupname.

else.

message s000(ZMSG) with 'Record does not exists'.

endif.

endif.

when 'CREATE'.

refresh wa_groupname.

select MAX( ZSNO ) into count from ZSDSHR13 .

if count is initial.

count = 1.

else .

count = count + 1.

endif.

select single * from ZSDSHR13 where zcustcode = wa_groupname-zcustcode and

zgroupname = wa_groupname-zgroupname .

if sy-subrc eq 0.

message s000(ZMSG) with 'Record already exist'.

elseif wa_groupname-zcustcode = ' ' and wa_groupname-zgroupname = ' '.

message s000(ZMSG) with 'Please Enter the values'.

else.

ZSDSHR13-ZSNO = count.

ZSDSHR13-ZCUSTCODE = wa_groupname-zcustcode.

ZSDSHR13-ZGROUPNAME = wa_groupname-zgroupname.

ZSDSHR13-UNAME = sy-uname.

perform create_editor using wa_groupname-zgroupname.

message s000(ZMSG) with 'Record Created Successfully'.

INSERT ZSDSHR13.

endif.

WHEN 'EDIT'.

refresh wa_groupname.

select single * from ZSDSHR13 where zcustcode = wa_groupname-zcustcode and

zgroupname = wa_groupname-zgroupname .

if sy-subrc eq 0.

message s000(ZMSG) with 'Record is being edited'.

perform edit_editor using wa_groupname-zgroupname.

else.

message s000(ZMSG) with 'Record has not been saved or created for editing'.

endif.

when 'CLEAR'.

wa_groupname-zcustcode = ' '.

wa_groupname-zgroupname = ' '.

refresh wa_groupname.

when 'DELETE'.

refresh wa_groupname.

if wa_groupname-zcustcode = ' ' and wa_groupname-zgroupname = ' '.

message s000(ZMSG) with 'Please Enter the values'.

else.

SELECT * FROM ZSDSHR13 INTO TABLE wa_groupname.

Delete ZSDSHR13 FROM wa_groupname.

if sy-subrc = 0.

message s000(ZMSG) with 'Record Deleted'.

endif.

endif.

when 'BACK'.

leave program.

endcase.

endmodule. " USER_COMMAND_0200 INPUT

&----


*& Form display_editor

&----


  • text

----


  • -->P_WA_GROUPNAME_ZSOCC text

----


form display_editor using p_wa_groupname_zsocc.

TEXTHEADER-TDOBJECT = 'TEXT'.

TEXTHEADER-TDNAME = p_wa_groupname_zsocc.

TEXTHEADER-TDID = 'ST'.

TEXTHEADER-TDSPRAS = 'E'.

TEXTHEADER-TDLINESIZE = 100.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = 'ST'

language = 'E'

name = p_wa_groupname_zsocc

object = 'TEXT'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

IMPORTING

HEADER = textheader

tables

lines = textlines

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 1

.

CALL FUNCTION 'EDIT_TEXT'

EXPORTING

DISPLAY = 'X'

  • EDITOR_TITLE = p_wa_groupname_zsocc

header = TEXTHEADER

  • PAGE = ' '

  • WINDOW = ' '

SAVE = SPACE

  • LINE_EDITOR = ' '

  • CONTROL = ' '

  • PROGRAM = ' '

  • LOCAL_CAT = ' '

IMPORTING

FUNCTION = ACTION

NEWHEADER = TEXTHEADER

  • RESULT =

tables

lines = TEXTLINES.

*

*message e000(zmsg) with p_wa_groupname_zsocc.

endform. " display_editor

&----


*& Form edit_editor

&----


  • text

----


  • -->P_WA_GROUPNAME_ZSOCC text

----


form edit_editor using p_wa_groupname_zsocc.

TEXTHEADER-TDOBJECT = 'TEXT'.

TEXTHEADER-TDNAME = p_wa_groupname_zsocc.

TEXTHEADER-TDID = 'ST'.

TEXTHEADER-TDSPRAS = 'E'.

TEXTHEADER-TDLINESIZE = 100.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = 'ST'

language = 'E'

name = p_wa_groupname_zsocc

object = 'TEXT'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

IMPORTING

HEADER = TEXTHEADER

tables

lines = textlines

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 1

.

CALL FUNCTION 'EDIT_TEXT'

EXPORTING

DISPLAY = ' '

  • EDITOR_TITLE = p_wa_groupname_zsocc

header = TEXTHEADER

  • PAGE = ' '

  • WINDOW = ' '

SAVE = SPACE

  • LINE_EDITOR = ' '

  • CONTROL = ' '

  • PROGRAM = ' '

  • LOCAL_CAT = ' '

IMPORTING

FUNCTION = ACTION

NEWHEADER = TEXTHEADER

  • RESULT =

tables

lines = TEXTLINES.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

header = TEXTHEADER

  • INSERT = ' '

  • SAVEMODE_DIRECT = ' '

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

IMPORTING

  • FUNCTION =

NEWHEADER = TEXTHEADER

tables

lines = TEXTLINES

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 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.

CALL FUNCTION 'COMMIT_TEXT'

EXPORTING

OBJECT = 'TEXT'

NAME = p_wa_groupname_zsocc

ID = 'ST'

LANGUAGE = 'E'

  • SAVEMODE_DIRECT = ' '

  • KEEP = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • COMMIT_COUNT =

  • TABLES

  • T_OBJECT =

  • T_NAME =

  • T_ID =

  • T_LANGUAGE =

.

endform. " edit_editor

&----


*& Form create_editor

&----


  • text

----


  • -->P_WA_GROUPNAME_ZSOCC text

----


form create_editor using p_wa_groupname_zsocc.

TEXTHEADER-TDOBJECT = 'TEXT'.

TEXTHEADER-TDNAME = p_wa_groupname_zsocc.

TEXTHEADER-TDID = 'ST' .

TEXTHEADER-TDSPRAS = 'E'.

TEXTHEADER-TDLINESIZE = 100.

CALL FUNCTION 'INIT_TEXT'

EXPORTING

ID = 'ST'

LANGUAGE = 'E'

NAME = p_wa_groupname_zsocc

OBJECT = 'TEXT'

IMPORTING

HEADER = TEXTHEADER

TABLES

LINES = TEXTLINES

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 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.

CALL FUNCTION 'EDIT_TEXT'

EXPORTING

DISPLAY = ' '

  • EDITOR_TITLE = p_wa_groupname_zsocc

header = TEXTHEADER

  • PAGE = ' '

  • WINDOW = ' '

SAVE = SPACE

  • LINE_EDITOR = ' '

  • CONTROL = ' '

  • PROGRAM = ' '

  • LOCAL_CAT = ' '

IMPORTING

FUNCTION = ACTION

NEWHEADER = TEXTHEADER

  • RESULT =

tables

lines = TEXTLINES.

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

fid = 'ST'

flanguage = 'E'

fname = p_wa_groupname_zsocc

fobject = 'TEXT'

  • SAVE_DIRECT = 'X'

  • FFORMAT = '*'

tables

flines = TEXTLINES

  • EXCEPTIONS

  • NO_INIT = 1

  • NO_SAVE = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

header = TEXTHEADER

  • INSERT = ' '

  • SAVEMODE_DIRECT = ' '

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

IMPORTING

  • FUNCTION =

NEWHEADER = TEXTHEADER

tables

lines = TEXTLINES

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 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.

CALL FUNCTION 'COMMIT_TEXT'

EXPORTING

OBJECT = 'TEXT'

NAME = p_wa_groupname_zsocc

ID = 'ST'

LANGUAGE = 'E'

  • SAVEMODE_DIRECT = ' '

  • KEEP = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • COMMIT_COUNT =

  • TABLES

  • T_OBJECT =

  • T_NAME =

  • T_ID =

  • T_LANGUAGE =

.

endform. " create_editor

Read only

Former Member
0 Likes
515

hi Sravanthigopal,

1.i think ur requirement is to produce F4 help for customer code based on values of other table's customer code. use FM F4IF_INT_TABLE_VALUE_REQUEST;

use RETFIELD as name of screen filed like KUNNR, pass the table fill with customer code of other table; catch the return table, read with index 1. filll the screen field (KNA1-KUNNR) with the value of return.

2. check the sy-ucomm or ok_code of the edit and create; flush a success message.

Regards

Krishnendu