cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Customization of Sales Order Screen Based on the Material Type

SHRADDHA2
Explorer
0 Kudos
514

Scenario description: 

  1. We want the moment we enter the flight ticket item in the line item level, custom fields specific to the flight ticket should show, we don't want other irrelevant custom field to pop up. And likewise for hotel accommodation as well. IN short custom field visibility should depend on the material we are entering at line item level.
  2. We are generating the purchase requisition from the sale order using item category DBAB as the tickets are real time procured based on customer requirement. Custom fields filled with data in sale order should flow to Purchase requisition which will be generated from sale order. The custom field data should flow from PR to PO.
  3. We also want Custom fields data from sales orders should flow to billing documents as well. Standard copy control does not support custom field.
  4. A company is selling flight tickets and hotel accommodation service both in one sale order. 


    First Scenario:

    1. We want the moment we enter the flight ticket item in the line item level, custom fields specific to the flight ticket should show, we don't want other irrelevant custom fields to pop up. And likewise for hotel accommodation as well. Inshort custom field visibility should depend on the material we are entering at line item level.
    2. We have activated the BADI: 

      Hiding of Custom Item Fields for Mass Change of Sales Documents

      ID : SD_MASSCHG_SLSDOC_ITM_HIDE_EXT

      SHRADDHA2_1-1715767884389.png

      And this is the logic we have copied from the sample code provided by SAP: Can you let me know what changes we need to make to the logic?


       

Accepted Solutions (1)

Accepted Solutions (1)

Meghana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Please use the BAdI: ‘SD_SLS_FIELDPROP_ITEM’. It is designed to set field properties for custom fields in sales document items.

FIELDPROPERTIES: Table containing one line for each custom field for the sales document item. For each line (and thus, for each field) the properties Read-Only, Invisible and Mandatory can be set.

- Check if the sales document item material is a flight ticket

- Loop through the field properties table and set custom fields specific to flight ticket as visible and set other custom fields as invisible

    IF salesdocumentitem-material = 'ABC'.

     LOOP AT field_properties INTO ls_field_properties.

      " Set custom fields specific to flight ticket as visible

      IF ls_field_properties-field_name = 'YY1_FLIGHT_FIELD1' OR

         ls_field_properties-field_name = 'YY1_FLIGHT_FIELD2'.

        ls_field_properties-invisible = ''.

      ELSE.

        " Set other custom fields as invisible

        ls_field_properties-invisible = 'X'.

      ENDIF.

    MODIFY field_properties FROM ls_field_properties.

  ENDLOOP.

ENDIF.

 

Regarding custom fields, some Custom Fields can be used in different scenarios if these scenarios are allowed by the Business Context, which is visible within the Custom Field under Tab "Business Scenarios". You can extend the Custom Field to these available scenarios only.

Best regards,

Meghana

Answers (0)