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 define this type in this code

Former Member
0 Kudos

Hi all.

I am trying to make a program work , but got stuck  on how to define this type : "zmsg_type"

REPORT  myProgram.

PARAMETERS :p_all TYPE zmsg_type AS LISTBOX VISIBLE LENGTH 10


                                                   
USER-COMMAND us1,   " Message type


                           p_email
TYPE   ad_smtpadr     MODIF ID md2,
                         
p_print  TYPE   tsp03-padest   MODIF ID md3.

TYPES : BEGIN OF lty_all,
                all
TYPE zmsg_type,
             
END OF
lty_all.




Thank you very much.




1 ACCEPTED SOLUTION

GirieshM
Active Contributor
0 Kudos

Hi Sami,

The data element or pre defined data types must be used in such place.

Have you created the data element zmsg_type?.

May I know what is your requirement, you can get some idea with example program provided by SAP.

With Regards,

Giriesh M

10 REPLIES 10

GirieshM
Active Contributor
0 Kudos

Hi Sami,

The data element or pre defined data types must be used in such place.

Have you created the data element zmsg_type?.

May I know what is your requirement, you can get some idea with example program provided by SAP.

With Regards,

Giriesh M

Former Member
0 Kudos

Hi Giriesh.

Thank you for your answer. I am just trying to copy/paste this code and see how it works .

But I have to define zmsg_type somehow which I didnt know how.

the code is here from saptechnical  by Jayshree Santosh Mahajan, Cognizant.

REPORT  zdemo_prg.

PARAMETERS :p_kschl TYPE zmsg_type AS LISTBOX VISIBLE LENGTH 10
                               
USER-COMMAND us1,   " Message type
            p_email
TYPE ad_smtpadr   MODIF ID md2, " Recipient email address
            p_print
TYPE tsp03-padest MODIF ID md3, " Printer Name
             p_fax  
TYPE na_telfx     MODIF ID md4." Fax Number

TYPES : BEGIN OF lty_kschl,
         kschl
TYPE zmsg_type,
       
END OF lty_kschl.

DATA : lt_kschl TYPE STANDARD TABLE OF lty_kschl,
       ls_kschl
TYPE lty_kschl.
CLEAR : lt_kschl[].

AT SELECTION-SCREEN OUTPUT.
 
LOOP AT SCREEN.
   
CASE p_kschl.
     
WHEN 'EMAIL'.
       
IF screen-group1 = 'MD3' OR screen-group1 = 'MD4'.
          screen-invisible =
1.
          screen-input     =
0.
        ENDIF.
     
WHEN 'PRINT'.
       
IF screen-group1 = 'MD2' OR screen-group1 = 'MD4'.
          screen-invisible =
1.
          screen-input     =
0.

        ENDIF.
     
WHEN 'FAX'.
       
IF screen-group1 = 'MD2' OR screen-group1 = 'MD3'.
          screen-invisible =
1.
          screen-input     =
0.
        ENDIF.
    ENDCASE.
   
MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_kschl.
 
IF lt_kschl[] IS INITIAL.
    ls_kschl-kschl =
'EMAIL'.
   
APPEND ls_kschl TO lt_kschl.
   
CLEAR ls_kschl.

    ls_kschl-kschl =
'PRINT'.
   
APPEND ls_kschl TO lt_kschl.
   
CLEAR ls_kschl.

    ls_kschl-kschl =
'FAX'.
   
APPEND ls_kschl TO lt_kschl.
   
CLEAR ls_kschl.

   
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
     
EXPORTING
        retfield    =
'KSCHL'
        dynpprog    = sy-repid
        dynpnr      = sy-dynnr
        dynprofield =
'P_KSCHL'
        value_org   =
'S'
     
TABLES
        value_tab   = lt_kschl.
  ENDIF.

Former Member
0 Kudos

I think you've picked a bad example of hiding parameters based on values in other parameters. If you search, you'll find many.

Rob

GirieshM
Active Contributor
0 Kudos

Hi Sami,

From your program I guess he tries to create zmsg_type same as the data element for KSCHL with character 5 and some value ranges.

You can create the data element in SE11 Tcode with the values in value range.

With Regards,

Giriesh M

Former Member
0 Kudos

I was trying to find example codes that uses : At selection-screen output , MODIF ID...etc.

Thank you Rob.

Former Member
0 Kudos

Press F1 on MODIF and you will see an example.

Rob

Former Member
0 Kudos

Thank you very much. I only needed to create a data element in se11 (zmsg_type). That's all .

Thank you guys for your help . I really appreciate it .

Cheers.

Former Member
0 Kudos

You must define type zmsg_type before declaring parameter p_all. (But it may contain a single field only.)

Rob

Message was edited by: Rob Burbank

Former Member
0 Kudos

Look at SAP report DEMO_SEL_SCREEN_SCREEN_OPT.

Rob

Former Member
0 Kudos

You need to define any local types before using them. The statement for defining your own local data types in a program is TYPES. You can declare something like depending upon your usage -

TYPES: zmsg_type(length as per your requirement) TYPE c .