Application Development and Automation 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: 
Read only

Regarding Variants...Please help

Former Member
0 Likes
748

Hello ABAPers,

I have a requirement here.

1. Enter transaction BD10.

2. Click the arrow(multiple selection) besides MATERIAL field on the screen.

3. On the pop up window click on the button 'Import from text file'.

All the materials which are present in the text file will be loaded in to the selection field of the material.

My requirement is I want to automate this whole process. Let me put the requirement in more detail.

1. When I enter transaction BD10, the selection field of the material should be automatically populated with the materials from all the text files in a folder.

For example if the folder contains 10 text files with materials...when I enter BD10 the selection field for material should be populated with all materials from those 10 text files.

I tried using a variant...but I couldn't do it.

All suggestions are most welcome.

Thanks,

Naren

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
703

First you will need a custom program to read the directory and upload the files into the program, then you can put all of the files into one internal table, then using the SUBMIT statement you can submit program RBDSEMAT using the WITH extension for all the matrial.

ranges: r_matnr for mara-matnr.

*  Build r_matnr with the data uploaded.
*  ITAB is an internal table with all of 
*  your uploaded material numbers.

loop at itab.

clear r_matnr.
r_matnr-sign = 'I'.
r_matnr-option  = 'EQ'.
r_matnr-low  = itab-matnr.
append r_matnr.

ENdloop.


SUBMIT RBDSEMAT
      with MATSEL in r_matnr
       and return.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
704

First you will need a custom program to read the directory and upload the files into the program, then you can put all of the files into one internal table, then using the SUBMIT statement you can submit program RBDSEMAT using the WITH extension for all the matrial.

ranges: r_matnr for mara-matnr.

*  Build r_matnr with the data uploaded.
*  ITAB is an internal table with all of 
*  your uploaded material numbers.

loop at itab.

clear r_matnr.
r_matnr-sign = 'I'.
r_matnr-option  = 'EQ'.
r_matnr-low  = itab-matnr.
append r_matnr.

ENdloop.


SUBMIT RBDSEMAT
      with MATSEL in r_matnr
       and return.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

Read only

0 Likes
703

Hello Rich,

Thankyou very much for the solution. I will try your solution and award you the points by the end of the day.

Thanks,

Naren

Read only

0 Likes
703

So then, I am assuming that you know what your doing with the upload part, right?

Regards,

Rich Heilman

Read only

0 Likes
703

Also, here is a proof-of-concept for ya.....




report zrich_0002 .

data: itab type table of makt with header line.
ranges: r_matnr for mara-matnr.

select * into corresponding fields of table itab
         from makt up to 100 rows
              where spras = sy-langu.

loop at itab.

  clear r_matnr.
  r_matnr-sign = 'I'.
  r_matnr-option  = 'EQ'.
  r_matnr-low  = itab-matnr.
  append r_matnr.


endloop.

submit rbdsemat
      with matsel in r_matnr
       via selection-screen
       and return.


check sy-subrc  = 0.

This program will pick up 100 records from MAKT and feed the material numbers into the range, the calls the BD10 program with the range. When the screen for BD10 comes up, notice that you have 100 entries in the material number field.

Regards,

Rich Heilman

Read only

0 Likes
703

Hello Rich,

Thanks a lot for your solution. It has solved my problem. I awarded you full 10 points.

Thanks,

Naren