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: 

Where i have to write the code to uplaod data ?

Former Member
0 Kudos

Hi

i have one requirement like this, At present i have one report , it is displaying some output in alv grid.

Now i have to store that output in Ztable , for that requirement is we have to create one check box in selection screen to upload data and once we check that check box and execute the report , it displays the output and whenever we comes back at that time ztable is to updated, if ztable is going to be updated first time no problem . If it is updated second time we have to display one popup to user the data is going to be overwritten yes or no like that. This is requirement for that how we can proceed

please send your suggestions

if you have any doubt in this regard please let me know.

thanks in advance

5 REPLIES 5

Former Member
0 Kudos

Hi Sitaram,

If your grid is displayed in selection screen

Try like this

At selection-screen.

Loop at itab into itab where itab-cbox eq 'X'.

select record from ztable based on key ( compare headerline ).

if sy-subrc eq 0.

message i000 with 'Data already exist do you want to over write'.

( You can display lik this message )

else.

insert itab into ztable.

endif.

endloop.

Plzz Reward if it is helpful,

Mahi.

0 Kudos

Thanks for your reply but it is not in selection screen , It is in report output. Here we r using REUSE_ALV_GRID_DISPLAY fm

0 Kudos

That function module takes docking container to display grid formate actually grid is displayed in screen only either it is default selection screen ( 1000 ) or any module pool screen like 100 etc so the code my helpful.

Your requirment is very easy by using classes

i have example code based on my requirment by using class if you want i will send you.

0 Kudos

Great please send it to me, It may be helpful for me

0 Kudos

See this,

My program is module pool program and this code is for screen 400

*" Work area for it_time...............................................

DATA:

BEGIN OF fs_time,

workdate TYPE zcl_timesheet-workdate,

" Date

groupid TYPE zcl_timesheet-groupid,

" Group ID

projectid TYPE zcl_timesheet-projectid,

" Project ID

projectname TYPE zcl_timesheet-projectname,

" Project name

objectid TYPE zcl_timesheet-objectid,

" Object ID

objectname TYPE zcl_timesheet-objectname,

" Object name

activityid TYPE zcl_timesheet-activityid,

" Activity ID

activityname TYPE zcl_timesheet-activityname,

" Activity name

timeworked TYPE zcl_timesheet-timeworked,

" Time spent on work

description TYPE zcl_timesheet-description,

" Description

taskstatus TYPE zcl_timesheet-taskstatus,

" Status of the proj.

billstatus TYPE zcl_timesheet-billstatus,

" Billing status

appstatus TYPE zcl_timesheet-appstatus,

" Staus of the record

wstatus TYPE zcl_timesheet-wstatus,

" Working status

mngcomment TYPE zcl_timesheet-mngcomment,

" Managers comment

END OF fs_time.

"----


  • Internal Tables declarations *

"----


Data:

it_time LIKE STANDARD TABLE OF fs_time.

" Table for alv

"----


  • Data declarations for ALV *

"----


DATA:

g_grid TYPE REF TO cl_gui_custom_container,

g_alv TYPE REF TO cl_gui_alv_grid,

g_container TYPE scrfname VALUE 'CONTAINER',

g_fcatlayo TYPE lvc_s_layo.

"----


  • MODULE STATUS_0400 OUTPUT *

"----


  • This screen is used to display the ALV *

"----


MODULE status_0400 OUTPUT.

SET PF-STATUS 'MAIN'.

*" If program executed in foreground.

IF sy-batch IS INITIAL.

*" If g_grid is initial.

if g_grid is initial.

CREATE OBJECT g_grid

EXPORTING

container_name = g_container.

CREATE OBJECT g_alv

EXPORTING

i_parent = g_grid.

else.

CALL METHOD g_alv->refresh_table_display.

endif. " IF G_GRID IS INITIAL

ENDIF. " IF SY-BATCH IS INITIAL

*" If w_first is initial then then display the default dates.

IF w_FIRST IS INITIAL.

w_ldate = sy-datum - 15.

w_hdate = sy-datum.

ENDIF. " IF W_FIRST IS INITIAL

perform build_fcat_alv_display.

ENDMODULE. " STATUS_0400 OUTPUT

"----


  • Module USER_COMMAND_0400 INPUT *

"----


  • This module is used for PAI event in display timesheet *

"----


MODULE user_command_0400 INPUT.

w_first = c_char_x.

CASE ok_code.

WHEN 'BACK'.

CALL METHOD cl_gui_cfw=>flush.

LEAVE TO SCREEN 0.

WHEN 'EXIT' OR 'CANCEL'.

LEAVE PROGRAM.

WHEN 'REF'.

CALL METHOD g_alv->refresh_table_display.

ENDCASE.

ENDMODULE. " USER_COMMAND_0400 INPUT

"----


  • FORM BUILD_FCAT_ALV_DISPLAY *

"----


  • To build fieldcatalog and display the table in ALV *

"----


  • No parameters are passed to this subroutine *

"----


FORM build_fcat_alv_display .

PERFORM display.

REFRESH it_fcat.

PERFORM build_fcatd USING 'IT_TIME' 'WORKDATE' text-002 '1'.

PERFORM build_fcatd USING 'IT_TIME' 'PROJECTID' text-004 '3'.

PERFORM build_fcatd USING 'IT_TIME' 'PROJECTNAME' text-005 '4'.

PERFORM build_fcatd USING 'IT_TIME' 'OBJECTID' text-006 '5'.

PERFORM build_fcatd USING 'IT_TIME' 'OBJECTNAME' text-007 '6'.

PERFORM build_fcatd USING 'IT_TIME' 'ACTIVITYID' text-008 '7'.

PERFORM build_fcatd USING 'IT_TIME' 'ACTIVITYNAME' text-009 '8'.

PERFORM build_fcatd USING 'IT_TIME' 'TIMEWORKED' text-010 '9'.

PERFORM build_fcatd USING 'IT_TIME' 'DESCRIPTION' text-011 '10'.

PERFORM build_fcatd USING 'IT_TIME' 'APPSTATUS' text-012 '11'.

PERFORM build_fcatd USING 'IT_TIME' 'MNGCOMMENT' text-013 '12'.

PERFORM alv_display USING it_time it_fcat.

ENDFORM. " BUILD_FCAT_ALV_DISPLAY

"----


  • FORM DISPLAY *

"----


  • This Subroutine is used for display the timesheet *

"----


  • There are no interface parameters to be passed to this subroutine *

----


FORM display .

SELECT workdate " Workdate

groupid " Groupid

projectid " Project ID

projectname " Project name

objectid " Object ID

objectname " Object name

activityid " Activity ID

activityname " Activity name

timeworked " Time worked

description " Description

taskstatus " Task status

billstatus " Bill status

appstatus " Approved status

wstatus " Working status

mngcomment " Manager comment

FROM zcl_timesheet

INTO TABLE it_time

WHERE empid EQ zcl_emprecord-empid

AND workdate GT w_ldate

AND workdate LE w_hdate

AND appstatus NE c_char_s.

IF sy-subrc NE 0.

MESSAGE s031.

ENDIF. " IF SY-SUBRC NE 0

ENDFORM. " DISPLAY

Plzz Reward ,

Mahi.