Purpose Implement and call up your own function module |
Solution
Transaction LS02N (Change Storage Bin) contains blocking indicators and a blocking code: We want to add a small textbox so that the user can enter an explanatory text for the blocking: The GuiXT script defines the text entry field as Textbox: BoxSize
G[Status]
(9,78) (see below for full GuiXT script) In the SAP DataDictionary we add a field ZZBLOCKINGREASON in table
LAGP: As you see, the maximum size is 400 characters. If longer texts are needed we can use an SAP long text instead of defining the field within data LAGP. Next, we write two function modules for reading and updating the variable: Z_READ_LAGP_BLOCKINGREASON
In the GuiXT script we read the text When the user saves the storage bin data, we call up an InputScript:
// save, include blocking
reason text which updates the blocking reason text: // update blocking
reason text if
V[errmsg] // Process
Update endif As you see, we first execute "/0" (Enter) and do the update after the Enter, so that our text update is not carried out when there are any error messages concerning the data entered by the user. On the other hand, if the /11 aborts with an error message, our text would already be updated. Pobably we can live with this situation. If not, we can first perform the "/11", then check the success message and if it is ok call up our text update function. GuiXT script "sapml01s.e0400" // clear variables ls02n.xxxx if new transaction Clear V[ls02n.*] Clear text[ls02n.*] Set V[ls02n.transactiond] "&V[_transactionid]" endif // key fields Set V[ls02n.lgtyp] "&F[LAGP-LGTYP]" Set V[ls02n.lgpla] "&F[LAGP-LGPLA]" if V[ls02n.lgnum] and _V[ls02n.lgtyp] and _ V[ls02n.lgpla] and _ not V[ls02n.readtext=X] // read blocking reason text Call "Z_READ_LAGP_BLOCKINGREASON" _ in.LGNUM="&F[LAGP-LGNUM]" _ in.LGTYP="&F[LAGP-LGTYP]" _ in.LGPLA="&F[LAGP-LGPLA]" _ table.BLOCKINGREASON="ls02n.blockingreason" // indicate:
text read endif // data entry possible? Set V[ls02.readonly] "" else Set V[ls02.readonly] "-readOnly" endif BoxSize G[Status] (9,78)Text (19,2) "Comment" TextBox (19.5,1.4) (22.5,61.4) _ name="ls02n.blockingreason" _ "&V[ls02.readonly]" // shift standard fields below the text boxpos T[Stock per storage bin] (24,1) pos P[First Page] (33,33) pos P[Previous Page] (33,37) pos P[Next Page] (33,41) pos P[Last Page] (33,45) pos P[Stor.unit] (33,16) pos P[Quant] (33,1) // on save, include blocking reason text |
Components |