‎2009 Sep 20 8:45 AM
Hello,
Ive declared a new local variable like this in my program:
ZIAUSWG TYPE MGAUSWG
I want to append values to this structure/Table:
First row 01
second row 20
How can append values to this kind of structures.
KInd regards
‎2009 Sep 20 9:09 AM
Hi,
Try like this
ZIAUSWG TYPE TABLE OF MGAUSWG with header line .
ZIAUSWG-field1 = '10'.
append ZIAUSWG.
clear ZIAUSWG.
ZIAUSWG-field1 = '20'.
append ZIAUSWG.
clear ZIAUSWG.
loop at ZIAUSWG.
write: ZIAUSWG-field1.
endloop.
Regards,
Vikranth
‎2009 Sep 20 9:01 AM
Hello David
I am not able to understand the question. Just tell me MGAUSWG is a table type or data element?
Regards
Anand.
‎2009 Sep 20 9:06 AM
Hello,
Is a table:
WLCL_ZIAUSWG TYPE MGAUSWG.
The original is IAUSWG TYPE MGAUSWG.
This table contains the screens from material master, I just want to know how to append values to this table in a program.
IAUSWG-ROW1 = 01
IAUSWG-ROW2 = 02
IAUSWG-ROW3 = 03
Kind Regards.
‎2009 Sep 20 9:14 AM
Hello David
Try in the following way.
DATA: WA_MGAUSWG LIKE LINE OF MGAUSWG.
WA_MGAUSWG = '01'.
APPEND WA_MGAUSWG TO IAUSWG.
WA_MGAUSWG = '02'.
APPEND WA_MGAUSWG TO IAUSWG.
WA_MGAUSWG = '03'.
APPEND WA_MGAUSWG TO IAUSWG.
Best regards
[How2SAP.com|http://www.how2sap.com/blog/alv/multi-line-alv-using-row_pos-in-field-catalog/]
‎2009 Sep 20 9:44 AM
Hello,
How can I create an Internal table that I can use to add my values and then assign it to my ZIAWUG variable?
Kind Regards
‎2009 Sep 20 9:09 AM
Hi,
Try like this
ZIAUSWG TYPE TABLE OF MGAUSWG with header line .
ZIAUSWG-field1 = '10'.
append ZIAUSWG.
clear ZIAUSWG.
ZIAUSWG-field1 = '20'.
append ZIAUSWG.
clear ZIAUSWG.
loop at ZIAUSWG.
write: ZIAUSWG-field1.
endloop.
Regards,
Vikranth
‎2009 Sep 20 9:53 AM
Hello,
In the case of this proposal, the compailer says : Tables with headers are no longer supported in the OO context.
Kind Regards
‎2009 Sep 20 10:19 AM
Hello David
Follow the following steps:
DATA: ZIAUSWG TYPE STANDARD TABLE OF MGAUSWG,
WA_MGAUSWG TYPE MGAUSWG.
WA_MGAUSWG-field1 = '10'.
append WA_MGAUSWG TO ZIAUSWG.
WA_MGAUSWG-field1 = '20'.
append WA_MGAUSWG TO ZIAUSWG.
WA_MGAUSWG-field1 = '30'.
append WA_MGAUSWG TO ZIAUSWG.
Check it. This should work.
Cheers
Anand
[How2SAP.com|http://www.how2sap.com/blog/sap-abap/persisting-setget-parameter-values-in-user-profile/]
‎2009 Sep 20 10:40 AM
Hello,
Yes, this in fact works like a charm, only a final question, how I can assign this structure to my other variable:
DATA: ZIAUSWG TYPE MGAUSWG.
DATA: ZZIAUSWG TYPE STANDARD TABLE OF MGAUSWG,
WA_MGAUSWG TYPE MGAUSWG.
WA_MGAUSWG-AUSWG = '10'.
append WA_MGAUSWG TO ZZIAUSWG.
WA_MGAUSWG-AUSWG = '20'.
append WA_MGAUSWG TO ZZIAUSWG.
WA_MGAUSWG-AUSWG = '30'.
append WA_MGAUSWG TO ZZIAUSWG.
How can I assign ZZIAUSWG. to ZIAUSWG
Kind Regards
‎2009 Sep 20 11:06 AM
This is what I got.
I want to Assign:
ZZIAUSWG Standard Table[16x1(4)]
To:
ZIAUSWG Structure: flat & charlike
Kind Regards
‎2009 Sep 20 3:34 PM
Structures cannot hold any records like tables do. They can only be used for reference structures in the programs. They hold values only during the execution of the program i,e runtime . Declare a internal table of the type of the structure and assign.
‎2009 Sep 20 9:30 AM
Hi David,
You need to first decide which field of the table is to be populated.
Then take help on APPEND by pressing f1 on the same.
Populate the field with desired value in workarea and append the same to internal table.
Hope its help you.
‎2009 Sep 20 4:37 PM
Hi David,
possibly you haven't got too much ABAP training. A book could help you.
Before getting too many too confusing answers here in the forum, it is always worth to use
[SAP online help - it is free!|http://help.sap.com/]
as a primary source.
For you, [Internal Tables, Creating Internal Tables, Processing Internal Tables|http://help.sap.com/saphelp_NW70EHP1/helpdata/en/c9/5472f6787f11d194c90000e8353423/frameset.htm] may be helpful.
Kind regards,
Clemens
‎2009 Sep 20 6:57 PM
Hello,
I just wanted to say that my problem was solved, Im a JAVA programmer and Im really used to a different way of using objects.
Thanks to those how made a constructive response.
This what the final result:
INTERFACE METHOD:
@78\QImporting@ ZIRMMG1 TYPE RMMG1 Mat. Master Maintenance: Initial Parameters - Orig. Material
@79\QExporting@ ZIAUSWG_RET TYPE STANDARD TABLE Material Maintenance: Selected Screens
method ZINTF_ASSIGN_VIEWS~ASSIGNPLANTVIEWS.
WRITE:/5 'MATERIAL RECIEVED' COLOR 5 INTENSIFIED,
35 'PLANT RECIEVED' COLOR 5 INTENSIFIED.
SKIP.
WRITE:/5 ZIRMMG1-MATNR,
35 ZIRMMG1-WERKS.
SKIP.
DATA: ZZIAUSWG TYPE STANDARD TABLE OF MGAUSWG,
WA_MGAUSWG TYPE MGAUSWG.
WA_MGAUSWG-AUSWG = '07'.
append WA_MGAUSWG TO ZZIAUSWG.
WA_MGAUSWG-AUSWG = '08'.
append WA_MGAUSWG TO ZZIAUSWG.
WA_MGAUSWG-AUSWG = '09'.
ZIAUSWG_RET = ZZIAUSWG.
endmethod.