Skip to Content
author's profile photo Former Member
Former Member

search help exit, how to return values to the hit list

Hi all,

I'm using a search help exit for the first time and the F4IF_SHLP_EXIT_EXAMPLE is useful, but not complete with information. What I couldn't find, is how exactly to what parameter I must give values to result in a hitlist.

In the SELECT STEP, I use a form with a select statement into an internal table. I want to pass these values to the hitlist...but how?

(I'm also surprised that the changing parameters shlp and callcontrol are passed by value...)

Thanks and regards,

Sandra

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 03:10 PM

    Hi,

    Please check the below code you will get the idea.

    FUNCTION BBP_F4IF_LIST_EXIT_VENDOR.

    *"----


    ""Lokale Schnittstelle:

    *" TABLES

    *" SHLP_TAB TYPE SHLP_DESCR_TAB_T

    *" RECORD_TAB STRUCTURE SEAHLPRES

    *" CHANGING

    *" VALUE(SHLP) TYPE SHLP_DESCR_T

    *" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL

    *"----


    • -------------------------------------------------------------------- *

    • SELECT is the only step we handle .... *

    • -------------------------------------------------------------------- *

    IF CALLCONTROL-STEP <> 'SELECT'.

    EXIT.

    ENDIF.

    TYPES: BEGIN OF LTY_EXPORT,

    PARTNER_VENDOR TYPE BU_PARTNER,

    NAME1 TYPE AD_NAME1,

    NAME2 TYPE AD_NAME2,

    COUNTRY TYPE LAND1,

    REGION TYPE REGIO,

    POST_CODE1 TYPE AD_PSTCD1,

    CITY1 TYPE AD_CITY1,

    STREET TYPE AD_STREET,

    BUILDING TYPE AD_BLDNG,

    END OF LTY_EXPORT.

    DATA: LT_EXPORT TYPE STANDARD TABLE OF LTY_EXPORT,

    LS_VAL_SELOPT TYPE DDSHSELOPT,

    LV_INV_PARTY TYPE BU_PARTNER,

    LV_CONTACT_INV TYPE BU_PARTNER,

    LV_CURRENT_TIME TYPE TIMESTAMP,

    LV_CURRENT_DATE TYPE SYSTDATLO,

    LT_PARTNER TYPE BUYPARTNER,

    LS_PARTNER TYPE BUSPARTNER,

    LT_RELATIONSHIPS TYPE STANDARD TABLE OF BAPIBUS1006_RELATIONS,

    LS_RELATION TYPE BAPIBUS1006_RELATIONS,

    LT_PURCH_DATA TYPE STANDARD TABLE OF BBPM_BUT_FRG0061,

    LV_X_IS_VENDOR TYPE XFELD.

    • get timestamp / date to validate address

    CONVERT DATE SY-DATUM TIME SY-UZEIT

    INTO TIME STAMP LV_CURRENT_TIME

    TIME ZONE GC_TIMEZONE_UTC.

    IF SY-SUBRC = 8 OR SY-SUBRC = 12.

    CONVERT DATE SY-DATUM TIME SY-UZEIT

    INTO TIME STAMP LV_CURRENT_TIME

    TIME ZONE SY-ZONLO.

    ENDIF.

    MOVE SY-DATUM TO LV_CURRENT_DATE.

    • ---------------------------------------------------------------------*

    • parameters 'partner_inv_party' has to be passed by the caller

    • -------------------------------------------------------------------- *

    LOOP AT SHLP-SELOPT INTO LS_VAL_SELOPT.

    IF LS_VAL_SELOPT-SHLPFIELD = 'PARTNER_INV_PARTY'.

    LV_INV_PARTY = LS_VAL_SELOPT-LOW(10).

    ENDIF.

    IF LS_VAL_SELOPT-SHLPFIELD = 'CONTACT_INV_PARTY'.

    LV_CONTACT_INV = LS_VAL_SELOPT(10).

    ENDIF.

    ENDLOOP.

    IF LV_INV_PARTY IS INITIAL AND LV_CONTACT_INV IS INITIAL.

    EXIT.

    ELSEIF LV_CONTACT_INV IS INITIAL.

    • so what

    ELSE.

    • get (and probably check) data using the relation

    CALL FUNCTION 'BUPA_RELATIONSHIPS_READ'

    EXPORTING

    IV_PARTNER = LV_CONTACT_INV

    TABLES

    ET_RELATIONSHIPS = LT_RELATIONSHIPS

    EXCEPTIONS

    NO_PARTNER_SPECIFIED = 1

    NO_VALID_RECORD_FOUND = 2

    OTHERS = 3.

    IF SY-SUBRC <> 0 OR LT_RELATIONSHIPS[] IS INITIAL.

    EXIT.

    ENDIF.

    IF LV_INV_PARTY IS INITIAL.

    LOOP AT LT_RELATIONSHIPS INTO LS_RELATION

    WHERE PARTNER2 = LV_CONTACT_INV

    AND RELATIONSHIPCATEGORY = GC_REL_CONTACT.

    LV_INV_PARTY = LS_RELATION-PARTNER1.

    EXIT.

    ENDLOOP.

    ELSE.

    LOOP AT LT_RELATIONSHIPS INTO LS_RELATION

    WHERE PARTNER1 = LV_INV_PARTY

    AND PARTNER2 = LV_CONTACT_INV

    AND RELATIONSHIPCATEGORY = GC_REL_CONTACT.

    EXIT.

    ENDLOOP.

    ENDIF.

    IF SY-SUBRC <> 0.

    EXIT.

    ENDIF.

    ENDIF.

    • -------------------------------------------------------------------- *

    • check if the invoicing party is a vendor

    • -------------------------------------------------------------------- *

    CALL FUNCTION 'BBP_PARTNER_GET_PURCH_DATA_NEW'

    EXPORTING

    PARTNER = LV_INV_PARTY

    TABLES

    ET_PURCH_ORG_SET = LT_PURCH_DATA

    EXCEPTIONS

    PARTNER_NOT_VALID = 0

    OTHERS = 0.

    IF NOT LT_PURCH_DATA[] IS INITIAL.

    LV_X_IS_VENDOR = 'X'.

    ENDIF.

    • -------------------------------------------------------------------- *

    • get the relations

    • -------------------------------------------------------------------- *

    CALL FUNCTION 'BUPA_RELATIONSHIPS_READ'

    EXPORTING

    IV_PARTNER = LV_INV_PARTY

    TABLES

    ET_RELATIONSHIPS = LT_RELATIONSHIPS

    EXCEPTIONS

    NO_PARTNER_SPECIFIED = 1

    NO_VALID_RECORD_FOUND = 2

    OTHERS = 3.

    IF SY-SUBRC <> 0 OR LT_RELATIONSHIPS[] IS INITIAL.

    IF LV_X_IS_VENDOR = 'X'.

    MOVE LV_INV_PARTY TO LS_PARTNER-PARTNER.

    APPEND LS_PARTNER TO LT_PARTNER.

    ELSE.

    EXIT.

    ENDIF.

    ELSE.

    LOOP AT LT_RELATIONSHIPS INTO LS_RELATION

    WHERE PARTNER2 = LV_INV_PARTY

    AND RELATIONSHIPCATEGORY = GC_REL_INV_PARTY.

    LS_PARTNER-PARTNER = LS_RELATION-PARTNER1.

    APPEND LS_PARTNER TO LT_PARTNER.

    ENDLOOP.

    IF SY-SUBRC <> 0.

    IF LV_X_IS_VENDOR = 'X'.

    MOVE LV_INV_PARTY TO LS_PARTNER-PARTNER.

    APPEND LS_PARTNER TO LT_PARTNER.

    ELSE.

    EXIT.

    ENDIF.

    ELSE.

    IF LV_X_IS_VENDOR = 'X'.

    MOVE LV_INV_PARTY TO LS_PARTNER-PARTNER.

    APPEND LS_PARTNER TO LT_PARTNER.

    ENDIF.

    ENDIF.

    ENDIF.

    • -------------------------------------------------------------------- *

    • get the data

    • -------------------------------------------------------------------- *

    SELECT A~PARTNER

    CNAME1 CNAME2 CCOUNTRY CREGION C~POST_CODE1

    CCITY1 CSTREET C~BUILDING

    INTO TABLE LT_EXPORT

    UP TO CALLCONTROL-MAXRECORDS ROWS

    FROM BUT000 AS A INNER JOIN BUT021_FS AS B

    ON BPARTNER = APARTNER

    INNER JOIN ADRC AS C

    ON CADDRNUMBER = BADDRNUMBER

    FOR ALL ENTRIES IN LT_PARTNER

    WHERE A~PARTNER EQ LT_PARTNER-PARTNER

    AND B~VALID_TO GE LV_CURRENT_TIME

    AND B~ADR_KIND EQ GC_STANDARD

    AND B~VALID_FROM LE LV_CURRENT_TIME

    AND C~DATE_FROM LE LV_CURRENT_DATE

    AND C~DATE_TO GE LV_CURRENT_DATE

    AND C~ADDR_GROUP EQ 'BP'.

    IF SY-SUBRC <> 0.

    EXIT.

    ENDIF.

    CALL FUNCTION 'F4UT_RESULTS_MAP'

    TABLES

    SHLP_TAB = SHLP_TAB

    RECORD_TAB = RECORD_TAB

    SOURCE_TAB = LT_EXPORT

    CHANGING

    SHLP = SHLP

    CALLCONTROL = CALLCONTROL

    EXCEPTIONS

    ILLEGAL_STRUCTURE = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    EXIT. "Don't process STEP DISP additionally in this call.

    ELSE.

    CALLCONTROL-STEP = 'DISP'.

    ENDIF.

    ENDFUNCTION.

    Rdg,

    Madhu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.