문제

Is it possible to dynamically create parameters from table entries?

For example like this:

SELECTION-SCREEN BEGIN OF BLOCK example WITH TITLE text-01
    LOOP AT example_internal_table INTO example_workarea
        IF example_workarea-field = criteria.
            PARAMETERS: (example_workareafield) AS CHECKBOX.
        ENDIF.
     ENDLOOP.
SELECTION-SCREEN END OF BLOCK example.

The code snippet above throws the error that example-workarea-field is not a constant. Does this mean it isn't possible to dynamically declare parameters or am I just doing it wrong? Thanks

도움이 되었습니까?

해결책

Correct. PARAMETERS statements compile into selection screens at compile time, not at runtime. Therefore you cannot do what you want in the way you have proposed.

However, it is possible to have some form of dynamic screens.

Look at the answers to this question: For the I/O fields in a normal ABAP screen, can i get them to behave like a SELECT-OPTIONS?

This gives you two starting points: The use of subscreens, which you can call dynamically, or the use of FREE_SELECTIONS_INIT as examples.

다른 팁

Depending on how crazy you are about this, you can also investigate: http://help.sap.com/abapdocu_702/en/abenabap_language_dynamic.htm

You could load the DYNPRO and dynamically change the screen, activate and then run a report that calls the changed screen.

This is of course a different approach from using PARAMETERS and should only be used for pet projects, not real production code as these statements are for internal use. I believe this is the approach that SE16 uses when it generates a selection screen for a table.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top