2005 Dec 14 2:03 PM
i am designing a module pool in which two fields are mandatory. i am having an pushbutton 'new row'. by clicking this a new row is added. if i click again the same button without entering the data the system is asking to enter the value in the previous one(which i dont want). i just want to add any no. of empty rows.
if i enter something in any one of the fields then only i need to check, but this is not hapenning.
could anyone tell me how to avoid this.
Thanx in advance
2005 Dec 14 2:06 PM
2005 Dec 14 2:14 PM
You must remove the "required" check box for the fields. They should now longer be mandatory. Now you must check the fields manually in your code. In the PAI flow logic, implement a module inside the loop for check the values.
For example,
PROCESS AFTER INPUT.
*&spwizard: pai flow logic for tablecontrol 'IZSHIPECON'
LOOP AT IZSHIPE.
CHAIN.
FIELD IZSHIPE-OTCS_ADJUSTMENT.
FIELD IZSHIPE-OTCS_AD_RESN.
MODULE IZSHIPECON_MODIFY ON CHAIN-REQUEST.
<b> MODULE IZSHIPECON_CHECKS.</b>
ENDCHAIN.
ENDLOOP.
Now in the module itself, do the checks only if there is something in the field.
MODULE IZSHIPECON_CHECKS INPUT.
* Give error if value is less than 100
<b> IF not IZSHIPE-OTCS_ADJUSTMENT is initial.
if IZSHIPE-OTCS_ADJUSTMENT < 100.
MESSAGE E078.
endif.
ENDIF.</b>
ENDMODULE.
Make sense?
Regards,
Rich Heilman
2005 Dec 14 2:34 PM
Thanx for all for giving immediate replies.
Rich, I had done the coding as you specified only. the only thing which i done in the screen painter is "required " option given to the fields mandatory.
I had a seen another program in which the fields were set as mandatory and also the program executes normally as i specified. i had checked with the code but couldn't find where my program lags.
Regards.
Ateeq
2005 Dec 14 2:38 PM
2006 Jan 06 1:10 PM
Hi Rich,
Your understanding is absolutely correct.
If i have to handle the issue without "required" field and with a message in PAI, I have no problem.
But the users requirement is the field should be "required". in the sense, should display with the "tick mark" which will come when the screen field marked as required.
i checked other programs, where there is a required field in the table control. but not giving error message asking for input in required field.
The message is appearing even when i scroll down, page down.
when i debugged, the message is raising in the loop..endloop in PAI (which is my first statement in PAI)in the iteration of where there is a empty row.
*******************
i had done some modifications and after that i had found that in my table control i am using 'tims' data type for 2 fields and 'raw' data type for a field. these fields when they are initial they like are some a value format i.e., for time '00:00:00' and for raw '000000000000000000'.
i had changed the data type for both of this to 'char'. after converting to char it is working fine. but changing of data type is not a good practice... so do you have any other method to resolve this issue.
Thanx,
Ateeq
Any suggestions....Please
Message was edited by: Ateeq K
Message was edited by: Ateeq K
Message was edited by: Ateeq K
2006 Jan 06 1:55 PM
Hi
Rich what you said it's not true: try to insert the code to manage button to add a new record in your example.
Your program'll work as Ateeq wants.
Ateeq, I think there're somothing wrong is your program.
I created a table control by WIZARD (as Rich has done) and than I added this piece of code to manage to add a new record.
CASE OK_CODE.
WHEN 'ADD'. APPEND INITIAL LINE TO ITA.
....
ENDCASE.
The error for mandatory field is raised only if a value is inserted in whichever field of tc.
Max
2006 Jan 06 4:26 PM
Hi Ateeq
I created a table control based on internal table like that:
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
ERDAT LIKE SY-DATUM,
TIMES LIKE SY-UZEIT,
END OF ITAB.
I don't have any problems.
So you should give us more details of your code.
MAx
2005 Dec 14 2:07 PM
May be you Can remove the mandatory part and include a validation on the rows whenever you wanted to have the field as mandatory
2005 Dec 14 2:10 PM
try to write the validation code in PAI and check out
In PAI after adding new rows , write the code for validation
Message was edited by: chandrasekhar jagarlamudi