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: 

modul pool scrreen related query

Former Member
0 Kudos

hi abapers,

please solve my query regarding module pool.

i have a module pool screen with table grid and i use upload and download function define on push button, when i press first time upload button my data can easily upload to table grid,

but when i use mouse scroll button then again data can uploaded on table grid.

please tale me if any statement or function is exist to handle this problem.

thanks,

Abhi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Abhilash,

Just clear your Variable for sy-ucomm after uploading and downloading data.

e.g.

ok_code = sy-ucomm.
clear sy-ucomm.

case ok_code.

 when 'UPLOAD'.
   
    perform UPLOAD.
    
    CLEAR OK_CODE.

when others
   ............
   clear ok_code.

endcase.

Or just CASE SY-UCOMM.

Hope it helps you.

Pratik

9 REPLIES 9

Former Member
0 Kudos

??

sujeet2918
Active Contributor
0 Kudos

Hello Abhilash,

Can you send me your code which you have written in PAI event to check entered data?

Have a Nice Day,

Regards,

Sujeet

0 Kudos

HI I HAVE WRITTEN THIS CODE.

{ MODULE USER_COMMAND_5000_TRC_DETL INPUT.

CASE SY-UCOMM.

WHEN 'UPLOAD'.

PERFORM DATA_UPLOAD.

CLEAR SY-UCOMM.

WHEN 'DOWNLOAD'.

PERFORM DOWNLOAD.

ENDCASE.

FORM DATA_UPLOAD .

CALL FUNCTION 'F4_FILENAME'

EXPORTING

FIELD_NAME = 'P_FILE'

IMPORTING

FILE_NAME = P_FILE.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

I_LINE_HEADER = 'X'

I_TAB_RAW_DATA = IT_RAW " WORK TABLE

I_FILENAME = P_FILE "'C:\UPLOAD1.XLS'

TABLES

I_TAB_CONVERTED_DATA = IT_FINAL[] "ACTUAL DATA

EXCEPTIONS

CONVERSION_FAILED = 1

OTHERS = 2.

  • IF SY-SUBRC <> 0.

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

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

  • ENDIF.

ENDFORM. }

Edited by: Abhilash on Apr 16, 2009 12:03 PM

0 Kudos

Hi,

Refer:-

In PAI of screen:-


MODULE USER_COMMAND_5000_TRC_DETL INPUT.
  CASE SY-UCOMM. 
    WHEN 'UPLOAD'.
      PERFORM DATA_UPLOAD.

    WHEN 'DOWNLOAD'.
      PERFORM DOWNLOAD.
  ENDCASE.
ENDMODULE.

In another include:-


FORM DATA_UPLOAD .

  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      FIELD_NAME = 'P_FILE'
    IMPORTING
      FILE_NAME = P_FILE.

  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
      I_LINE_HEADER = 'X'
      I_TAB_RAW_DATA = IT_RAW " WORK TABLE
      I_FILENAME = P_FILE "'C:\UPLOAD1.XLS'
    TABLES
      I_TAB_CONVERTED_DATA = IT_FINAL[] "ACTUAL DATA
    EXCEPTIONS
      CONVERSION_FAILED = 1
      OTHERS = 2.
  IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

Dear abhilash,

It is the problem of sy-ucomm.

when u use user command in pai.

declare a global variable ucomm type sy-ucomm.

and

in user_command module.

ucomm = sy-ucomm.

clear sy-ucomm.

case ucomm.

when 'SAVE'.

when 'UPDT'.

endcase.

the reason your sy-ucomm is not clear.

Former Member
0 Kudos

Hi,



You can check Sy-ucomm value that is,

When 'UPLOAD'.

You can upload the data by using function module:

KD_GET_FILENAME_ON_F4

GUI_UPLOAD

And 

When 'DOWNLOAD.

For downloading the data you have to declare like:

type-pools: TRUXS.

DATA: it_raw TYPE truxs_t_text_data.
*      internal table declared to be passed in the
*      function module used to convert data from xls to sap

And call function Module:

TEXT_CONVERT_XLS_TO_SAP    "for excel file upload

And for text file upload you can use Function Module:

GUI_DOWNLOAD

Endcase.

Hope it helps

Regards

Mansi

Former Member
0 Kudos

Hi Abhilash,

Ive faced a similar kind of a problem..

It was just coz a variable was not getting cleared..

Rather than using sy-ucomm in case statement..

declare a variable ok_code type sy-ucomm..

ok_code = sy-ucomm.

case ok_code.

when 'UPLOAD'.

perform upload_data."or whatever ur form name is

clear ok_code. "sy-ucomm sometimes doesnt gets cleared.

endcase.

try this of it helps..

Former Member
0 Kudos

Hi Abhilash,

Just clear your Variable for sy-ucomm after uploading and downloading data.

e.g.

ok_code = sy-ucomm.
clear sy-ucomm.

case ok_code.

 when 'UPLOAD'.
   
    perform UPLOAD.
    
    CLEAR OK_CODE.

when others
   ............
   clear ok_code.

endcase.

Or just CASE SY-UCOMM.

Hope it helps you.

Pratik

Former Member
0 Kudos

thanks buddy

solve it.

Abhi