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: 

Displaying Material number Quantity storage location wise

Former Member
0 Kudos
1,340

Hello experts,

I have a requirement I need to display the fields in the format given below:

MATERIAL NUMBER               PLANT            STORAGELOC1           STORAGELOC2          

1000                                        1234               1200                                   1500

I am unable to do so using the table mard. So can anyone help.

Regards

Nav

1 ACCEPTED SOLUTION

Former Member
0 Kudos
1,303

Hello Navratan,

Can you tell us the problem you are facing ?

Regards

21 REPLIES 21

aabida_majeed
Participant
0 Kudos
1,303

Hi Kumar,

Do you want this displayed in a report program or via SE16/SE16N ?


Regards.

0 Kudos
1,303

Hello Majeed

I wanted to display it in a report program.

0 Kudos
1,303

Hi Kumar,

At a given time how may materials do you want to view in this manner is it just one or many ?

Regards

0 Kudos
1,303

Hello Majeed



I have created a selection screen and for that particular material number I have to display in the required format.

Regards

Nav

0 Kudos
1,303

Hi Kumar,


In MARD table since there will be varying no of storage.l for different materials when developing the report program you might have to take a dynamic approach.

Regards

0 Kudos
1,303

Hello Majeed,

I am able to display the storage location and material  but it comes in a vertical way but I need to display it in a horizontal manner.

Regards

Nav

Former Member
0 Kudos
1,304

Hello Navratan,

Can you tell us the problem you are facing ?

Regards

0 Kudos
1,303

Hi Sajid,

I have been trying to make a report in the above format but I am unable to do so as I get all the storage location in a vertical format and I need to display it horizontally.

Regards

Nav

0 Kudos
1,303

hi,

i think u have data some thing like this,

and u want display BA60 under storage location1 and BCB0 under storage location 2 respectively,

if this is the case then u need to loop at the internal table and find the count against each material number and accordingly display u r storage location...

0 Kudos
1,303

Hi Navratan,

You can show the storage location report in column wise,  Use dynamic internal table concept by using RTTS Method.

Regards

Rajkumar Narasimman

0 Kudos
1,303

Hello Vinay ,

I just want to display the quantity of stock in the storage location against each material number .I have already tried to create the table dynamically but facing a problem in adding the the quantity for storage location agains each material number.

I want to diaplay it this way:

material              plant                strg loc1               strg loc2

101                    1234                    200

102                    1235                                              1200

0 Kudos
1,303

Hello Rajkumar,

Thanks for your reply I will try the method you suggested .Its really a different approach.

Regards

Navratan

0 Kudos
1,303

Hello Rajkumar,

I tried the way you suggested but in this case I have to manually enter all the quantity for each location and this is really a hectic process and I have to make it such that it keeps on updating and the data are very large so really tough to do so.

Regards

Navratan

0 Kudos
1,303

Hi Navratna,

If you maintain the internal table as shown below, it is possible to use the dynamic internal table concept and convert the alv layout as expected.

material              plant               SLOC      Value  

101                    1234                  LOC1     200

102                    1235                  LOC2     200            

material              plant               strg loc1        strg loc2

101                    1234                  200

102                    1235                                      200

Regards

Rajkumar Narasimman

0 Kudos
1,303

Hello Rajkumar,

I am facing the problem as the storage locations are not fixed and have a huge data that has to be updated automatically.So kindly could you explain me the logic.

Regards

Navratan

0 Kudos
1,303

Hello Navratan,

Adding onto Rajkumar's answer.

I had a similar requirement.

What I did was, made the field names in the internal table the same as (or containing the ) storage location number.

So, this helped me match the data to the appropriate column.

For example,
when looping on the data from mard,
I can see the data contains 3 storage locations.

so, I would build my alv table to have columns as

<other fields> LOC1 LOC2 LOC3

then when putting in data into this table, I can insert into the appropriate column.

0 Kudos
1,303

Hello Sajid,

What I did was made a columns for different storage locations with the same field name as in the table but when I  tried to add the quantity to each storage location I get the same values for every storage location and I have to do add quantity for almost 20 storage location against each material number.If you could then please explain with an example.

Regards

Navratan.

0 Kudos
1,303

Hello Navratan ,

Please find pseudocode below.

Here, I am assuming, you have built the fieldcatalog first and then you have built the dynamic internal table using this field catalog.


Loop at gt_mard.          "get the data from MARD

READ TABLE gt_fieldcat INTO gst_fieldcat

                 WITH KEY fieldname = gt_mard-LGORT.  "here you get the location of the column

      lw_tabix = sy-tabix.     "here you get the position of the column in the alv internal table

ASSIGN COMPONENT lw_tabix OF STRUCTURE <gfs_s_dyntable> TO <gfs_alv_col>. "here you are asigning the data from the alv dynamic table to a. <gfs_s_dyntable> is a structure of the dynamic internal table, which is appended to the internal table. <gfs_alv_col> contains the data.

MOVE gt_mard-LABST TO <gfs_alv_col>.

gw_labst = gw_labst + gt_mard-LABST. "if you need to calculate total stock

endloop.

APPEND <gfs_s_dyntable> TO <gfs_dyntable>. "append struture to internal table.

0 Kudos
1,303

Hello  Sajid,

Thanks for your reply.I will try then let you know about it.

Regards,

Navratan

Former Member
0 Kudos
1,303


Hello Navratan,

You will have to either use the dynamic internal table concept (if the storage locations are not fixed)

Or loop at the data from MARD and enter the data into your internal table. (If the storage locations to be displayed are known and fixed.)

Former Member
0 Kudos
1,303

Thanks everyone for the reply.

Regards

Navratan