Anda di halaman 1dari 6

Introduction: This article will discuss in detail how to access or update the value of one field in the F4 help

event of another field. Requirement and scenario: We often come across requirements where in values in the F4 help of one field should be based upon the value in another field. For example take a scenario where there are two fields on the selection screen. A value is entered in the first field, now the values in the F4 help of the second field should be based on the value entered in the first field. The challenge here is the first field value is not directly accessible (or read) in the F4 help event of the second field. We will see how to tackle this challenge. Steps to be followed: Step1: Create a program in SE38 with two selection screen fields.

Here I have taken two fields: Company code & Sales Organization on selection screen. If you see the F4 help of the Sales organization field it gives the below values.

You can see Sales Organizations belonging to different company codes (MAC,TRE etc). Now we want to limit the Sales Org. values based on the company code value entered in the company code field.

In this case I want to have the Sales Org. values as TRE1, TRE2, TRE3 as I have entered company code value equal to TRE.

Step2: Now we will create a custom F4 help for the sales organization field using below selection screen event: AT SELECTION SCREEN ON VALUE REQUEST for field. Check table or value table for the Sales organization field is TVKO. Step3: Write the below code in the above mentioned event.

Click here to continue... Step4: Here we come across a challenge: The company code field s_bukrs is not directly accessible in this event. You can see the same in below debugging screen shot.

Step4: To overcome this challenge we need to use the Function Module DYNP_VALUES_READ. We need to pass the field name as the importing parameter to this FM and you can get the field values as the exporting parameter. Write the following code in the above event.

Step5: In this way we can get the value of the company code field and it can be used further for limiting the sales organization values as below:

Additional information: In the above example we have seen how to read the value in the company code field, similarly we can modify/update the value in the company code field using the FM DYNP_VALUES_UPDATE. Refer the below code which needs to be written in the same selection screen event:

Company code is defaulted to MAC as below;

Summary: In this way we can access/update one field in the F4 help of another field.

Anda mungkin juga menyukai