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

BAPIs Selektion from Range Tables

Hi There,

I have to create BAPI GetList, which has 18 Table-Import Parameters. Those Table Parameters have been created like Ranges ( Sign, Option, Low and High ). How can I know, what der User has given as Input and after this Check wnat to select from Tables for Inputs of Ranges.

Pls give me Support!

Thanks a lot!

Bye

Besi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Feb 08, 2005 at 05:45 PM

    Hi Besi,

    how about defining user input fields like BAPI input fields?

    select-options: s_parm1 for table-field1,

    s_parm2 for table-field2,

    ...

    call function bapi_x_get_list

    tables

    parm1 = s_parm1

    parm2 = s_parm2

    ...

    You will not know, what user has selected, but result of BAPI should match exactly user requirements. If you don't want to define all 18 table parameters on selection-screen, you can define some parameters with ranges s_parm3 for table-field3. That will not be part of selection screen, but can be part of function call.

    Please ask again, when you have problems to translate user selection into bapi parameter.

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2005 at 06:35 PM

    I think Christian is on the right track.

    Inside your BAPI, use the input tables in a select like:

    SELECT * FROM XYZ
      WHERE ABC IN parm1 and
            DEF IN parm2 ...

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello Besi / Charles,

      I'm sure you are aware that, just like a select-options, if a <i>ranges</i> table is empty, it means that <b>all the records</b> have to be considered without restriction. So, if the condition that you have mentioned is checked for, then you are actually forcing the user to enter some restrictions - the user can no longer say that he wants <b>all</b> the values to be considered in the selection. Do you agree with me on that ?

      There's a rather generic and elegant solution for this problem that I have come across. Let me explain.

      1. Let us say that your BAPI has 3 tables parameters - the ranges tables for MANDT , VKORG and BUKRS.

      2. Now you can have another IMPORTING parameter, say OPTIONS as a structure which refers to a dictionary structure, say ZBAPIOPTIONS. You would have to create the structure in the dictionary as something like this:

      CLIENT type BAPI_FLAG

      SALESORG type BAPI_FLAG

      COCODE type BAPI_FLAG.

      3. The above IMPORTING parameter to the BAPI has to be made as MANDATORY. Now whenever the user calls the BAPI, he would always have to specify which of the TABLES parameters have to be conisdered based on the Flags he had set in the IMPORTING parameter OPTIONS.

      So if he fills in the OPTIONS parameters as OPTIONS-COCODE = 'X', then you can have the code in the BAPI which considers only the TABLES parameter BUKRS. No matter what values the user specifies / does not specify, the entire processing will depend only on what <i>options</i> he has set.

      I hope this explanation has been clear enough to drive home the point and that it is adoptable in your case. If it is, then please reward the points and close the thread. If you have any further doubts on this, then please do get back to me.

      Regards,

      Anand Mandalika.

      P.S. The above explanation has been inspired from the way some of the BAPIs like BAPI_PO_CHANGE etc have been programmed. In BAPI_PO_CHANGE, for instance, there's a parameter called POHEADER. There's another parameter called POHEADERX, which is just a structure of flags, specifying which fields of POHEADER are actually to considered as relevant for change.

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.