Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

calling program from another program and passing values between them

Former Member
0 Kudos

Hi Experts,

I want to call abap program (program2) from another abap program(program1). The called program 2 has its own selection screen ( or variant) and calculate multiple colums and generate output file.

I would like to pass values to this second program 2 and return one of the columns from this to first program ( program 1)

Could you please let me know how to pass values from first program to second program and then return column values to first program so that it can be used further.

SUBMIT ZSDS_DEMAND1 using selection-set 'DEMAND1' and return.

Thanks

5 REPLIES 5

Former Member
0 Kudos

with the option of SUBMIT you can pass your parameters from program 1 to program 2.

In program 2, you should use the instruction "EXPORT TO MEMORY" with data you want to pass to program 1.

In program 1, then, with "IMPORT FROM MEMORY", you get data passed by program 2

0 Kudos

thanks andrea.

The program 2 has it own selection screen with wmultiple fields (which is available as a variant).

I want use all fields of selection screen as it except 1 column ( lets say material number) which i want to pass via program 1.

so basically i want to call program 2 which should use its existing selection screen parameter except one field. This one parameter field (e:gmaterial) which i want to pass via program1.

How to do it?

0 Kudos

probably multiple posts on forums about open_job function module, submit keyword, etc. Search forums and look at your ABAP Help for submit keyword.

0 Kudos

Hi try this way...


          
* Calling report and export the ouput to memory
    SUBMIT <reportname>
             WITH matnr    in s_matnr      "for select options
             WITH werks eq  p_matnr     " for parameters
              EXPORTING LIST TO MEMORY AND RETURN.

prabhudas

Former Member
0 Kudos

Hi,

try this way...



  SUBMIT <reportname>
          WITH fields
          EXPORTING LIST TO MEMORY AND RETURN.

* read list from memory into table
  CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
      listobject = lt_listobject.

*Spool content in Ascii format
  CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
      listobject         = lt_listobject
      listasci           = txtlines.

  CALL FUNCTION 'LIST_FREE_MEMORY'
    TABLES
      listobject = lt_listobject.


  txtlines1[] = txtlines[].
  CLEAR : txtlines .REFRESH txtlines.
  LOOP AT txtlines1.
    IF txtlines1(1) EQ '|' .                  "for every two fields the Pipe symbols will be there for alv report  
      MOVE txtlines to w_char.
      "split w_char at '|' into internal table fields
      "APPEND <Internaltable>.
    ENDIF.
  ENDLOOP.

"Use the above internal table data in other query processing

Prabhudas