Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Timo_John
Active Participant

I started this already via Twitter how to fetch or map two values from an internal table if you are not interested in the whole line

Input:     lt_vbpa   (just an internal table with some more columns )


target:     lv_kunn  (two fields to be filled ... needed for next method or something.

               lv_land1

Of cause there are lots of solutions, we could make a list out of it, but key is to have FAST, short an understandable code

80s style:

Read Table lt_vbpa assigning <fs>  Key ...

lv_kunnr = <fs>-kunnr.

lv_land1  = <fs>-land1.

New >7.40

lv_kunnr = lt_vbpa[ parvw = "WE" ]-kunnr

lv_land1  = lt_vbpa[ parvw = "WE" ]-land1

* but worse 2 read operations in ITAB performance issue in mass processing.

Via Twitter I did receive some Ideas:

New >7.40 feat. se38

Read Table ltvbpa assigning <fs>  Key ...

assign lt_vbpa[ parvw = "WE" ] to <fs>.

lv_kunnr = <fs>-kunnr.

lv_land1  = <fs>-land1.

* Nicer, one read on the itab only, but still tree lines of code

Solution by enno.wulff

* Also nicer but quite some coding overhead... and again with the performance issue of two reads.

I still do not see a great Idea to do this in a nice way in two lines of code (pls. no #Macros, or two statemts in one line ideas ...)

Thanks for the two of you for your Ideas!

39 Comments