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

How to pass the Dynamically table name and RELID in IMPORT x TO y FROM DATABASE dbtab(ar) ID Key

Hello Expert,

I wanted to know is there any way through which we can dynamically pass the table name in IMPORT condition.

For e.g.

DATA : PCLT TYPE DD03L-TABNAME.

DATA: SET_RELID TYPE T52RELID-RELID.

DATA: key TYPE PCLKEY.

DATA: text_version TYPE PVRSN.

DATA: BEGIN OF ptext OCCURS 132.

DATA: line(132).

DATA: END OF ptext.

SET_RELID = 'TX'.

PCLT = 'PCL1'.

KEY = '00001000004005 9999123119960101000'.

TEXT_VERSION = '01'.

IMPORT TEXT_VERSION PTEXT FROM DATABASE <PCLT>(<SET_RELID>) ID KEY.

If i use this then it gives me error message "The Dictionary structure or table "<PCLT>" is either not active or does not exist."

Kindly help me in this matter.

Thanks

Srikanth

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 07, 2014 at 09:30 PM

    Hi Srikanth

    I dont know if there is another solution, but this is what i did using a dynamic subroutine, please check it

    just add this lines to your code

    DATA: prog TYPE c LENGTH 8,

    mess TYPE string,

    sid TYPE string,

    wrd TYPE string,

    dir TYPE trdir,

    OFF(3).

    DATA: lt_code TYPE TABLE OF rssource-line.

    DATA: ls_code TYPE rssource-line.

    perform call_import using pclt set_relid key.

    form call_import USING p_pclt p_set_relid p_key.

    ls_code = 'PROGRAM SUBPOOL.'.

    append ls_code to lt_code.

    ls_code = 'form get_text tables ptext using p_key changing text_version.'.

    append ls_code to lt_code.

    ls_code = 'IMPORT text_version ptext from database'.

    append ls_code to lt_code.

    concatenate p_pclt '(' p_set_relid ')' into ls_code.

    append ls_code to lt_code.

    ls_code = 'id p_key.'.

    append ls_code to lt_code.

    ls_code = 'endform.'.

    append ls_code to lt_code.

    .

    generate subroutine pool lt_code

    name prog

    message mess

    SHORTDUMP-ID sid

    WORD WRD

    OFFSET OFF.

    IF SY-SUBRC EQ 0.

    perform GET_TEXT IN PROGRAM (prog) tables ptext

    USING p_key

    CHANGING text_version .

    ENDIF.

    endform.

    Hope this help

    Regards

    MC

    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.