2020 May 28 7:16 AM
Hi,
I have created one Module Pool Program. when user enters truck number and clicks on Get data, below information is coming From Ztable (Attached SS). and I want to set default non editable value for cost Center which is not maintained in ztable and after click on save it should save in ztable. How do i Fix cost center value ?
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'GET'.
SELECT SINGLE * FROM ZDAILY WHERE TRUCK_NO = ZDAILY-TRUCK_NO.
*
WHEN 'SAVE'.
IF ZDAILY IS NOT INITIAL.
UPDATE ZDAILY.
* INSERT zhgvt.
PERFORM TCLEAR.
ENDIF.
WHEN 'DIS'.
CALL TRANSACTION 'ZDAILY_HGV'.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'HGV' .
CALL TRANSACTION 'ZDAILY_HGV1'.
CLEAR HGV.
WHEN 'LV'.
CALL TRANSACTION 'ZDAILY_LV'.
CLEAR LV.
ENDCASE.
*clear : sy-ucomm.
ENDMODULE.
2020 May 28 7:25 AM
Hello nandini_borse
You could create a constant value, this won't be changeable.
CONSTANTS:
lc_kostl_default TYPE kostl VALUE 'some value'.
And then set it if it's initial in the record.
IF ZDAILY IS NOT INITIAL.
IF zdaily-cost_center IS INITIAL.
zdaily-cost_center = lc_kostl_default.
ENDIF.
UPDATE ZDAILY.
* INSERT zhgvt.
PERFORM TCLEAR.
ENDIF.
Kind regards,
Mateusz2020 May 28 7:25 AM
Hello nandini_borse
You could create a constant value, this won't be changeable.
CONSTANTS:
lc_kostl_default TYPE kostl VALUE 'some value'.
And then set it if it's initial in the record.
IF ZDAILY IS NOT INITIAL.
IF zdaily-cost_center IS INITIAL.
zdaily-cost_center = lc_kostl_default.
ENDIF.
UPDATE ZDAILY.
* INSERT zhgvt.
PERFORM TCLEAR.
ENDIF.
Kind regards,
Mateusz2020 May 28 7:34 AM
HI, Thanks for your suggestions,and its working fine absolutly. But now i want this in non editable form.so that no one can change it. It should be fixed.How do i restrict it ?
2020 May 28 7:38 AM
Hello Nandini,
You need to disable the field In the PBO event of your screen.
You can do it like so.
LOOP AT screen.
IF screen-name = 'NAME_OF_YOUR_FIELD'.
screen-input = 0.
MODIFY screen.
ENDIF.
ENDLOOP.
2020 May 28 7:45 AM
2020 May 28 7:50 AM
It has to be the name of the field from your screen. Not your Cost Center variable's name.
Kind regards,2020 May 28 8:03 AM
Hello
Another thought, the screen field name has to be in uppercase. Lowercase letters won't work, even if the name is the same.
Kind regards,2020 May 29 9:05 AM
Hi mateuszadamus
i am facing the same issue again for another one. The req is little bit changed. After Selecting truck no, data for two fileds should come automatically from zvh table after pressing an 'enter' and after click on save button it should save in zdl table. How will i achieved this ?
two tables : ZVH and ZDL (Truck no field is in both table)
req: after F4 on truck no client select Truck Number from list and after pressing enter vehicle category and vehicle Type should come automatically from zvh table and after filling further data user will click on save button, then all this info should save in zdl table.[Attached SS]
2020 May 29 9:33 AM
Hello Nandini,
Hmm, let's see.
PROCESS BEFORE OUTPUT.
MODULE read_zvh_fields.
PROCESS AFTER INPUT.
MODULE process_command.
MODULE read_zvh_fields OUTPUT.
CLEAR: gs_zdl.
IF gv_truck_no IS NOT INITIAL. " only if Truck No filled
SELECT truck_no, field1, field2
FROM zvh
WHERE truck_no = @gv_truck_no. " GV_TRUCK_NO is the name of the field where user selects Truck No.
INTO CORRESPONDING FIELDS of @gs_zdl.
ENDIF.
" update screen fields, if their variables are different from GS_ZDL structure
screen_field1 = gs_zdl-field1.
screen_field2 = gs_zdl-field2.
ENDMODULE.
MODULE process_command INPUT.
CASE gv_ucomm.
WHEN 'SAVE'.
IF gs_zdl IS NOT INITIAL.
MODIFY zdl FROM gs_zdl.
COMMIT WORK AND WAIT.
ENDIF.
WHEN OTHERS.
" do something else.
ENDCASE.
ENDMODULE.
If you want to show the values read from DB on the screen, and you probably do, then you also have to put these values in the screen fields. Do it after you read the values into GS_ZDL structure.
Kind regards,
Mateusz2020 May 29 10:12 AM
Hi, I tried this. But not Working. Can You Please Figure out it. Attached Code.
TABLES : ZDAILY , ZVEHICLE1.
DATA: GS_ZDL TYPE ZDAILY.
DATA: GV_TRUCK_NO TYPE ZDAILY-TRUCK_NO.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_1000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_1000 INPUT.
CASE SY-UCOMM.
WHEN 'SAVE'.
IF GS_ZDL IS NOT INITIAL.
MODIFY ZDAILY FROM GS_ZDL.
COMMIT WORK AND WAIT.
ENDIF.
PERFORM VALIDATION USING ZDAILY.
PERFORM UPDATE.
CLEAR ZDAILY.
WHEN 'NEW'.
CLEAR ZDAILY.
* CLEAR zvehicle1.
WHEN 'DISPLAY'.
CALL TRANSACTION 'ZDAILY_ALV'.
WHEN 'TP'.
CALL TRANSACTION 'ZTOM'.
LEAVE TO TRANSACTION 'ZDMY'.
WHEN 'VIEW'.
CALL TRANSACTION 'ZVIEW'.
LEAVE TO TRANSACTION 'ZDMY'.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'ADD'.
CALL TRANSACTION 'ZADATA'.
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE STATUS_1000 OUTPUT.
IF GV_TRUCK_NO IS NOT INITIAL.
SELECT SINGLE * FROM ZVEHICLE1 INTO CORRESPONDING FIELDS OF GS_ZDL WHERE TRUCK_NO = ZDAILY-TRUCK_NO.
ENDIF.
ZVEHICLE1-VEHICLE_CAT = GS_ZDL-VEHICLE_CATEGORY.
ZVEHICLE1-VEHICLE_TYPE = GS_ZDL-TYPE.
SET PF-STATUS 'TODAY'.
SET TITLEBAR 'DAILY'.
PERFORM TRHGV.
PERFORM TRSTATUS.
PERFORM TRHIRE.
ENDMODULE. " STATUS_0100 OUTPUT
2020 May 29 10:49 AM
Nandini,
Do you want to update the ZVEHICLE table? Where is the code for that?
Kind regards,2020 May 29 11:03 AM
No, Want to update zdaily table.
*&---------------------------------------------------------------------*
*& Modulpool ZTRDETAIL
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
PROGRAM ZTRDETAIL.
TABLES : ZDAILY , ZVEHICLE1.
DATA: GS_ZDL TYPE ZDAILY.
DATA: GV_TRUCK_NO TYPE ZDAILY-TRUCK_NO.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_1000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_1000 INPUT.
CASE SY-UCOMM.
* WHEN ' '.
* IF GV_TRUCK_NO IS NOT INITIAL.
* SELECT SINGLE * FROM ZVEHICLE1 INTO CORRESPONDING FIELDS OF GS_ZDL WHERE TRUCK_NO = ZDAILY-TRUCK_NO.
* ENDIF.
*
* ZVEHICLE1-VEHICLE_CAT = GS_ZDL-VEHICLE_CATEGORY.
* ZVEHICLE1-VEHICLE_TYPE = GS_ZDL-TYPE.
* IF ZDAILY-VEHICLE_CATEGORY IS INITIAL AND ZDAILY-TYPE IS INITIAL.
* ZDAILY-VEHICLE_CATEGORY = LC_VEH_CAT.
* ZDAILY-TYPE = LC_VEH_TYPE.
* ENDIF.
WHEN 'SAVE'.
IF GS_ZDL IS NOT INITIAL.
MODIFY ZDAILY FROM GS_ZDL.
COMMIT WORK AND WAIT.
ENDIF.
PERFORM VALIDATION USING ZDAILY.
PERFORM UPDATE.
CLEAR ZDAILY.
WHEN 'NEW'.
CLEAR ZDAILY.
* CLEAR zvehicle1.
WHEN 'DISPLAY'.
CALL TRANSACTION 'ZDAILY_ALV'.
WHEN 'TP'.
CALL TRANSACTION 'ZTOM'.
LEAVE TO TRANSACTION 'ZDMY'.
WHEN 'VIEW'.
CALL TRANSACTION 'ZVIEW'.
LEAVE TO TRANSACTION 'ZDMY'.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'ADD'.
CALL TRANSACTION 'ZADATA'.
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE STATUS_1000 OUTPUT.
IF GV_TRUCK_NO IS NOT INITIAL.
SELECT SINGLE * FROM ZVEHICLE1 INTO CORRESPONDING FIELDS OF GS_ZDL WHERE TRUCK_NO = ZDAILY-TRUCK_NO.
ENDIF.
ZVEHICLE1-VEHICLE_CAT = GS_ZDL-VEHICLE_CATEGORY.
ZVEHICLE1-VEHICLE_TYPE = GS_ZDL-TYPE.
SET PF-STATUS 'TODAY'.
SET TITLEBAR 'DAILY'.
PERFORM TRHGV.
PERFORM TRSTATUS.
PERFORM TRHIRE.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Form TRHGV
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM TRHGV .
DATA : LT_SRCDEST_DD TYPE TABLE OF VRM_VALUE.
DATA : LT_SRCDEST_SETLEAF TYPE TABLE OF SETLEAF-VALFROM,
LS_SRCDEST_DD LIKE LINE OF LT_SRCDEST_DD.
FIELD-SYMBOLS : <FS_SRCDEST_SETLEAF> LIKE LINE OF LT_SRCDEST_SETLEAF.
SELECT VALFROM FROM SETLEAF INTO TABLE LT_SRCDEST_SETLEAF
WHERE SETNAME = 'ZTRHGV'.
IF SY-SUBRC EQ 0.
APPEND LS_SRCDEST_DD TO LT_SRCDEST_DD.
LOOP AT LT_SRCDEST_SETLEAF ASSIGNING <FS_SRCDEST_SETLEAF>.
LS_SRCDEST_DD-KEY = <FS_SRCDEST_SETLEAF>.
APPEND LS_SRCDEST_DD TO LT_SRCDEST_DD.
CLEAR LS_SRCDEST_DD.
ENDLOOP.
ENDIF.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'ZDAILY-VEHICLE_CATEGORY'
VALUES = LT_SRCDEST_DD
* EXCEPTIONS
* ID_ILLEGAL_NAME = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form TRSTATUS
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM TRSTATUS .
DATA : LT_SRCDEST_DD TYPE TABLE OF VRM_VALUE.
DATA : LT_SRCDEST_SETLEAF TYPE TABLE OF SETLEAF-VALFROM,
LS_SRCDEST_DD LIKE LINE OF LT_SRCDEST_DD.
FIELD-SYMBOLS : <FS_SRCDEST_SETLEAF> LIKE LINE OF LT_SRCDEST_SETLEAF.
SELECT VALFROM FROM SETLEAF INTO TABLE LT_SRCDEST_SETLEAF
WHERE SETNAME = 'ZTRSTATUS'.
IF SY-SUBRC EQ 0.
APPEND LS_SRCDEST_DD TO LT_SRCDEST_DD.
LOOP AT LT_SRCDEST_SETLEAF ASSIGNING <FS_SRCDEST_SETLEAF>.
LS_SRCDEST_DD-KEY = <FS_SRCDEST_SETLEAF>.
APPEND LS_SRCDEST_DD TO LT_SRCDEST_DD.
CLEAR LS_SRCDEST_DD.
ENDLOOP.
ENDIF.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'ZDAILY-STATUS'
VALUES = LT_SRCDEST_DD
* EXCEPTIONS
* ID_ILLEGAL_NAME = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form TRHIRE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM TRHIRE .
DATA : LT_SRCDEST_DD TYPE TABLE OF VRM_VALUE.
DATA : LT_SRCDEST_SETLEAF TYPE TABLE OF SETLEAF-VALFROM,
LS_SRCDEST_DD LIKE LINE OF LT_SRCDEST_DD.
FIELD-SYMBOLS : <FS_SRCDEST_SETLEAF> LIKE LINE OF LT_SRCDEST_SETLEAF.
SELECT VALFROM FROM SETLEAF INTO TABLE LT_SRCDEST_SETLEAF
WHERE SETNAME = 'ZTRHIRE'.
IF SY-SUBRC EQ 0.
APPEND LS_SRCDEST_DD TO LT_SRCDEST_DD.
LOOP AT LT_SRCDEST_SETLEAF ASSIGNING <FS_SRCDEST_SETLEAF>.
LS_SRCDEST_DD-KEY = <FS_SRCDEST_SETLEAF>.
APPEND LS_SRCDEST_DD TO LT_SRCDEST_DD.
CLEAR LS_SRCDEST_DD.
ENDLOOP.
ENDIF.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'ZDAILY-ON_OFF_HIRE'
VALUES = LT_SRCDEST_DD
* EXCEPTIONS
* ID_ILLEGAL_NAME = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form VALIDATION
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> ZDAILY
*&---------------------------------------------------------------------*
FORM VALIDATION USING P_ZDAILY TYPE ZDAILY.
IF P_ZDAILY-TRIPDAT > SY-DATUM.
MESSAGE E002(ZDAILYMESSAGES).
* Schedule date cannot be in the past
ENDIF.
IF P_ZDAILY-TRIPDAT < SY-DATUM .
MESSAGE E001(ZDAILYMESSAGES).
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form UPDATE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM UPDATE .
INSERT ZDAILY.
IF SY-SUBRC EQ 0.
MESSAGE 'Data Updated' TYPE 'S'.
ELSE .
MESSAGE 'Data not Updated ' TYPE 'S'.
ENDIF.
ENDFORM.
<br>
2020 May 29 11:13 AM
Okay.
Is the GV_TRUCK_NO also a name of the input field on the screen, where a user selects the Truck No from F4? This should be it. Otherwise system won't have a value in it.
You're changing values in ZDAILY and ZVEHICLE1 structures.
* ZVEHICLE1-VEHICLE_CAT = GS_ZDL-VEHICLE_CATEGORY.
* ZVEHICLE1-VEHICLE_TYPE = GS_ZDL-TYPE.
* IF ZDAILY-VEHICLE_CATEGORY IS INITIAL AND ZDAILY-TYPE IS INITIAL.
* ZDAILY-VEHICLE_CATEGORY = LC_VEH_CAT.
* ZDAILY-TYPE = LC_VEH_TYPE.
* ENDIF.
But later on, you try to update the ZDAILY table from GS_ZDL structure.
* IF GS_ZDL IS NOT INITIAL.
* MODIFY ZDAILY FROM GS_ZDL.
* COMMIT WORK AND WAIT.
* ENDIF.
Did you want to update the ZDAILY table from ZDAILY structure? Or maybe change value in the GS_ZDL structure?
You have to fix this, tidy the code, remove the unnecessary variables. Do not copy 1 to 1 my example code, as it was just an example of the logic, it most probably won't work. 🙂
I'd use a MODIFY zdaily from SOURCE_STRUCTURE_HERE instead of INSERT. Modify adds new record, if none is found or modifies the existing one. Insert will create an issue if there already is a record with the same key. It's not meant for an update operation.
FORM UPDATE .
INSERT ZDAILY.
IF SY-SUBRC EQ 0.
MESSAGE 'Data Updated' TYPE 'S'.
ELSE .
MESSAGE 'Data not Updated ' TYPE 'S'.
ENDIF.
ENDFORM.
Kind regards,
Mateusz2020 May 29 11:19 AM
One more thing, you're checking if GV_TRUCK_NO was provided, but make a SELECT based on ZDAILY-TRUCK_NO. This should be fixed too. Either you don't need the GV_TRUCK_NO variable, or you should use it in the SELECT WHERE clause.
* IF GV_TRUCK_NO IS NOT INITIAL.
* SELECT SINGLE * FROM ZVEHICLE1 INTO CORRESPONDING FIELDS OF GS_ZDL WHERE TRUCK_NO = ZDAILY-TRUCK_NO.
* ENDIF.
2020 May 29 11:25 AM
Try to reuse your logic, too. See below procedure. I wasn't able to test it, though.
PERFORM set_vrm_values USING 'ZTRHGV' 'ZDAILY-VEHICLE_CATEGORY'.
PERFORM set_vrm_values USING 'ZTRSTATUS' 'ZDAILY-STATUS'.
PERFORM set_vrm_values USING 'ZTRHIRE' 'ZDAILY-ON_OFF_HIRE'.
ENDMODULE. " STATUS_0100 OUTPUT
FORM set_vrm_values
USING
iv_name LIKE setleaf-setname
iv_id TYPE vrm_id.
DATA : lt_srcdest_dd TYPE TABLE OF vrm_value.
DATA : lt_srcdest_setleaf TYPE TABLE OF setleaf-valfrom,
ls_srcdest_dd LIKE LINE OF lt_srcdest_dd.
FIELD-SYMBOLS : <fs_srcdest_setleaf> LIKE LINE OF lt_srcdest_setleaf.
SELECT valfrom FROM setleaf INTO TABLE lt_srcdest_setleaf
WHERE setname = iv_name.
IF sy-subrc EQ 0.
APPEND ls_srcdest_dd TO lt_srcdest_dd.
LOOP AT lt_srcdest_setleaf ASSIGNING <fs_srcdest_setleaf>.
ls_srcdest_dd-key = <fs_srcdest_setleaf>.
APPEND ls_srcdest_dd TO lt_srcdest_dd.
CLEAR ls_srcdest_dd.
ENDLOOP.
ENDIF.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = iv_id
values = lt_srcdest_dd
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
ENDFORM.
2020 May 29 11:36 AM
Here's the whole code with my changes.
PROGRAM ztrdetail.
TABLES : zdaily , zvehicle1.
DATA: gv_truck_no TYPE zdaily-truck_no. " this variable has to be assigned to the screen input field
MODULE user_command_1000 INPUT.
CASE sy-ucomm.
WHEN ' '.
PERFORM read_zvehicle.
WHEN 'SAVE'.
PERFORM validation USING zdaily.
PERFORM update.
CLEAR zdaily.
WHEN 'NEW'.
CLEAR zdaily.
* CLEAR zvehicle1.
WHEN 'DISPLAY'.
CALL TRANSACTION 'ZDAILY_ALV'.
WHEN 'TP'.
CALL TRANSACTION 'ZTOM'.
LEAVE TO TRANSACTION 'ZDMY'.
WHEN 'VIEW'.
CALL TRANSACTION 'ZVIEW'.
LEAVE TO TRANSACTION 'ZDMY'.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'ADD'.
CALL TRANSACTION 'ZADATA'.
ENDCASE.
ENDMODULE.
MODULE status_1000 OUTPUT.
PERFORM read_zvehicle.
SET PF-STATUS 'TODAY'.
SET TITLEBAR 'DAILY'.
PERFORM set_vrm_values USING 'ZTRHGV' 'ZDAILY-VEHICLE_CATEGORY'.
PERFORM set_vrm_values USING 'ZTRSTATUS' 'ZDAILY-STATUS'.
PERFORM set_vrm_values USING 'ZTRHIRE' 'ZDAILY-ON_OFF_HIRE'.
ENDMODULE. " STATUS_0100 OUTPUT
FORM read_zvehicle.
CLEAR zvehicle1.
IF gv_truck_no IS NOT INITIAL. " this field has to be the same as the screen input field
SELECT SINGLE * FROM zvehicle1 INTO zvehicle1 WHERE truck_no = gv_truck_no.
ENDIF.
zdaily-vehicle_category = zvehicle1-vehicle_cat.
zdaily-type = zvehicle1-vehicle_type.
IF zdaily-vehicle_category IS INITIAL.
zdaily-vehicle_category = lc_veh_cat.
ENDIF.
IF zdaily-type IS INITIAL.
zdaily-type = lc_veh_type.
ENDIF.
ENDFORM.
FORM set_vrm_values
USING
iv_name LIKE setleaf-setname
iv_id TYPE vrm_id.
DATA : lt_srcdest_dd TYPE TABLE OF vrm_value.
DATA : lt_srcdest_setleaf TYPE TABLE OF setleaf-valfrom,
ls_srcdest_dd LIKE LINE OF lt_srcdest_dd.
FIELD-SYMBOLS : <fs_srcdest_setleaf> LIKE LINE OF lt_srcdest_setleaf.
SELECT valfrom FROM setleaf INTO TABLE lt_srcdest_setleaf
WHERE setname = iv_name.
IF sy-subrc EQ 0.
APPEND ls_srcdest_dd TO lt_srcdest_dd.
LOOP AT lt_srcdest_setleaf ASSIGNING <fs_srcdest_setleaf>.
ls_srcdest_dd-key = <fs_srcdest_setleaf>.
APPEND ls_srcdest_dd TO lt_srcdest_dd.
CLEAR ls_srcdest_dd.
ENDLOOP.
ENDIF.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = iv_id
values = lt_srcdest_dd
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
ENDFORM.
FORM validation USING is_zdaily TYPE zdaily.
IF is_zdaily-tripdat > sy-datum.
" Schedule date cannot be in the past
MESSAGE e002(zdailymessages).
ENDIF.
IF is_zdaily-tripdat < sy-datum .
MESSAGE e001(zdailymessages).
ENDIF.
ENDFORM.
FORM update.
MODIFY zdaily FROM zdaily.
IF sy-subrc EQ 0.
COMMIT WORK AND WAIT.
MESSAGE 'Data Updated' TYPE 'S'.
ELSE .
ROLLBACK WORK.
MESSAGE 'Data not Updated ' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
ENDFORM.
2020 May 28 7:40 AM
nandini_borse,
Your expectation here is when you don't get the value from Ztable you would like to default a value. In that case you could follow below steps:
1) Query your Ztable ZDAILY first, if you find a cost centre directly assign.
2) Else default the value in your program.
********Pseudo Code*********
Select
from ZDAILY
into wa_zdaily.
If Sy-subrc eq 0 and wa_zdaily-cost_centre is not initial.
**Assign the Cost Centre from Zdaily.
** Update the table
else.
** Default the value (Either a constant in program or a text element or a value maintained in constant table(Best Case))
** Update the table.
endif.
Regards!
2020 May 28 7:49 AM
No,there is no any value in ztable. I have to maintain cost center value from this module pool program. and this cost center value should be fixed,it should be restricted so that user cant change it. after after click on save button it'll updated to ztable.
2020 May 28 8:16 AM
2020 May 28 8:42 AM